/* ==========================================================================
   buhui996 Core — reset / base / components / utilities
   官网、控制台、后台三端共用。依赖 tokens.css。
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-4) 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
::selection { background: var(--brand-100); color: var(--brand-900); }

/* ---------- Icon（SVG sprite: assets/icons.svg） ---------- */
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 26px; height: 26px; }

/* ---------- Typography helpers ---------- */
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-lg { font-size: var(--fs-lg); }
.text-success { color: var(--success-600); }
.text-danger { color: var(--danger-600); }
.text-warning { color: var(--warning-600); }
.text-brand { color: var(--brand-600); }
.fw-medium { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--brand-600); font-weight: var(--fw-medium); }
.link:hover { color: var(--brand-700); text-decoration: underline; text-underline-offset: 3px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout utilities ---------- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1 1 0; min-width: 0; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-6 { gap: var(--s-6); }
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }

.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2.grid-stack-md { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .hide-sm { display: none !important; }
}

/* ---------- Button ---------- */
.btn {
  --btn-h: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--btn-h); padding: 0 var(--s-4);
  border-radius: var(--r); border: 1px solid transparent;
  font-size: var(--fs-base); font-weight: var(--fw-regular); line-height: 1;
  white-space: nowrap; user-select: none;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--brand-700); }
.btn-secondary { background: var(--surface); color: var(--gray-800); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-soft:hover { background: var(--brand-100); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }
.btn-danger { background: var(--danger-500); color: #fff; }
.btn-danger:hover { background: var(--danger-600); }
.btn-danger-soft { background: var(--danger-50); color: var(--danger-600); }
.btn-danger-soft:hover { background: #FBDADB; }
.btn-success { background: var(--success-500); color: #fff; }
.btn-success:hover { background: var(--success-600); }

.btn-xs { --btn-h: 26px; padding: 0 var(--s-2); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-sm { --btn-h: 32px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn-lg { --btn-h: 46px; padding: 0 var(--s-6); font-size: var(--fs-lg); border-radius: var(--r-md); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: var(--btn-h); padding: 0; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--s-4); }
.label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--gray-700); }
.label .req { color: var(--danger-500); margin-left: 2px; }
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.hint.is-error { color: var(--danger-600); }

.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 var(--s-3);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  font-size: var(--fs-base);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--gray-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
.input.is-error { border-color: var(--danger-500); }
.input.is-error:focus { box-shadow: var(--ring-danger); }
.input:disabled, .select:disabled { background: var(--gray-50); color: var(--text-3); cursor: not-allowed; }
.input-lg { height: 44px; font-size: var(--fs-md); }
.input-sm, .select-sm { height: 32px; font-size: var(--fs-sm); }
.textarea { height: auto; min-height: 88px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: var(--lh-snug); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B778C' stroke-width='2' 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 10px center; background-size: 16px;
}

/* 带前后缀的输入框 */
.input-group {
  display: flex; align-items: stretch; width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input-group:focus-within { border-color: var(--brand-500); box-shadow: var(--ring); }
.input-group .input { border: 0; box-shadow: none; background: transparent; min-width: 0; }
.input-group .input:focus { box-shadow: none; }
.input-addon {
  display: inline-flex; align-items: center; padding: 0 var(--s-3);
  color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap;
}
.input-addon .icon { width: 16px; height: 16px; }
.input-group > .btn { height: auto; border-radius: 0 calc(var(--r) - 1px) calc(var(--r) - 1px) 0; border: 0; border-left: 1px solid var(--border); }

/* 原生复选/单选：只换主题色，保持轻量 */
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-600); width: 16px; height: 16px; margin: 0; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }

/* Switch */
.switch { position: relative; display: inline-flex; flex: none; width: 36px; height: 20px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: var(--r-full); background: var(--gray-300);
  transition: background-color var(--dur) var(--ease-out); pointer-events: none;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-out);
}
.switch input:checked + span { background: var(--brand-600); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* 选项卡片（radio 包在 label 里，用 :has 高亮，无需 JS） */
.option-card {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.option-card:hover { border-color: var(--brand-300); }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-500); }
.option-card:has(input:focus-visible) { box-shadow: var(--ring); }
.option-card .oc-title { font-weight: var(--fw-semibold); color: var(--text); }
.option-card .oc-sub { font-size: var(--fs-xs); color: var(--text-3); }
.option-card .oc-tag { position: absolute; top: -9px; right: 10px; }
.option-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* Stepper 数量 */
.stepper { display: inline-flex; align-self: flex-start; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); }
.stepper button { width: 34px; height: 36px; display: grid; place-items: center; color: var(--text-2); }
.stepper button:hover { color: var(--brand-600); background: var(--gray-50); }
.stepper input { width: 48px; height: 36px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--brand-50); }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
  min-width: 0;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border);
}
.card-header.no-border { border-bottom: 0; padding-bottom: 0; }
.card-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.card-desc { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.card-body { padding: var(--s-5); }
.card-body.tight { padding: var(--s-3) var(--s-5); }
.card-footer { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); background: var(--surface-muted); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-flush { padding: 0; }
.card-hover { transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
.card-hover:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 6px; border-radius: var(--r-xs);
  font-size: var(--fs-xs); font-weight: var(--fw-regular); line-height: 1; white-space: nowrap;
  background: var(--gray-100); color: var(--gray-700);
}
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-brand   { background: var(--brand-50);   color: var(--brand-700); }
.badge-success { background: var(--success-50); color: var(--success-600); }
.badge-warning { background: var(--warning-50); color: var(--warning-600); }
.badge-danger  { background: var(--danger-50);  color: var(--danger-600); }
.badge-info    { background: var(--info-50);    color: var(--info-600); }
.badge-violet  { background: var(--violet-50);  color: var(--violet-600); }
.badge-solid   { background: var(--brand-600);  color: #fff; }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }

/* ---------- Table ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: var(--fs-sm); }
.table th {
  text-align: left; font-weight: var(--fw-medium); color: var(--text-3); white-space: nowrap;
  padding: 10px var(--s-4); background: var(--surface-muted); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px var(--s-4); border-bottom: 1px solid var(--gray-100); vertical-align: middle; white-space: nowrap; }
.table tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--gray-25); }
.table tbody tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: var(--s-5); }
.table th:last-child, .table td:last-child { padding-right: var(--s-5); }
.table .col-check { width: 44px; }
.table .col-actions { text-align: right; }
.table .is-selected { background: var(--brand-50) !important; }
.table .cell-main { font-weight: var(--fw-medium); color: var(--text); }
.table .cell-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.table-actions { display: inline-flex; gap: var(--s-1); justify-content: flex-end; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--s-6); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: var(--s-3) 0; font-size: var(--fs-base); font-weight: var(--fw-medium);
  color: var(--text-3); white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--text); }
.tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--brand-600); border-radius: 2px;
  transform: scaleX(0); transition: transform var(--dur) var(--ease-out);
}
.tab[aria-selected="true"], .tab.is-active { color: var(--brand-700); }
.tab[aria-selected="true"]::after, .tab.is-active::after { transform: scaleX(1); }
.tab .count { font-size: var(--fs-xs); padding: 0 5px; border-radius: var(--r-xs); background: var(--gray-100); color: var(--text-3); }
.tab[aria-selected="true"] .count, .tab.is-active .count { background: var(--brand-50); color: var(--brand-700); }

/* Segmented control */
.segmented { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r); background: var(--gray-100); }
.segmented button {
  height: 30px; padding: 0 var(--s-3); border-radius: calc(var(--r) - 2px);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-2);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }

/* ---------- Stat ---------- */
.stat { padding: var(--s-5); }
.stat-label { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-3); }
.stat-value { margin-top: var(--s-2); font-size: var(--fs-3xl); font-weight: var(--fw-medium); letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-value small { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-3); margin-left: 2px; }
.stat-foot { margin-top: var(--s-2); font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.delta.up { color: var(--success-600); }
.delta.down { color: var(--danger-600); }

/* 图标底块：产品线配色 */
.icon-box {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--r-xs);
  background: var(--brand-50); color: var(--brand-600);
}
.icon-box.lg { width: 44px; height: 44px; border-radius: var(--r-md); }
.icon-box.lg .icon { width: 22px; height: 22px; }
.icon-box.sm { width: 28px; height: 28px; border-radius: var(--r-sm); }
.icon-box.sm .icon { width: 15px; height: 15px; }
.tone-brand, .tone-teal, .tone-violet, .tone-amber { background: var(--brand-50); color: var(--brand-600); }
.tone-gray   { background: var(--gray-100);  color: var(--gray-600); }
.tone-danger { background: var(--danger-50); color: var(--danger-600); }

/* ---------- Progress ---------- */
.progress { height: 4px; border-radius: var(--r-full); background: var(--gray-100); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand-500); }
.progress.is-warning > span { background: var(--warning-500); }
.progress.is-danger > span { background: var(--danger-500); }
.progress.is-success > span { background: var(--success-500); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-100); color: var(--brand-700);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: var(--fs-lg); }

/* ---------- Alert / Notice ---------- */
.alert {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--info-50); color: var(--info-600); font-size: var(--fs-sm); line-height: var(--lh-snug);
  border: 1px solid rgba(0, 0, 0, .08);
}
.alert .icon { margin-top: 1px; width: 16px; height: 16px; }
.alert b { color: inherit; font-weight: var(--fw-semibold); }
.alert-warning { background: var(--warning-50); color: var(--warning-600); border-color: rgba(224, 138, 0, .18); }
.alert-success { background: var(--success-50); color: var(--success-600); border-color: rgba(18, 160, 106, .18); }
.alert-danger  { background: var(--danger-50);  color: var(--danger-600);  border-color: rgba(229, 72, 77, .18); }
.alert-brand   { background: var(--brand-50);   color: var(--brand-700);   border-color: rgba(0, 0, 0, .08); }

/* ---------- Key-value list ---------- */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 10px var(--s-4); font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); }
.kv dd { color: var(--text); min-width: 0; word-break: break-all; }

/* ---------- Copy field（连接串、API Key） ---------- */
.copy-field {
  display: flex; align-items: center; gap: var(--s-2);
  height: 38px; padding: 0 4px 0 var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-muted);
  font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--gray-800);
}
.copy-field > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-field .btn { flex: none; }

/* ---------- Code block ---------- */
.code {
  position: relative; margin: 0; padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md); background: var(--navy-900); color: #D4D4D4;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7;
  overflow-x: auto; white-space: pre;
}
.code .c-key { color: #FFFFFF; }
.code .c-str { color: #9BE3C4; }
.code .c-com { color: #7A7A7A; }
.code .c-num { color: #F5C177; }
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 6px 6px var(--s-4); background: var(--navy-800); color: #A3A3A3;
  border-radius: var(--r-md) var(--r-md) 0 0; font-size: var(--fs-xs);
}
.code-head + .code { border-radius: 0 0 var(--r-md) var(--r-md); }
.code-head .btn-ghost { color: #A3A3A3; }
.code-head .btn-ghost:hover { background: var(--navy-700); color: #fff; }

/* ---------- Timeline（订单进度） ---------- */
.timeline { position: relative; display: flex; flex-direction: column; gap: var(--s-4); }
.timeline-item { position: relative; display: flex; gap: var(--s-3); }
.timeline-item::before {
  content: ""; position: absolute; left: 9px; top: 22px; bottom: calc(-1 * var(--s-4)); width: 2px; background: var(--gray-200);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: relative; z-index: 1; flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 2px solid var(--gray-300);
}
.timeline-dot .icon { width: 11px; height: 11px; stroke-width: 3; }
.timeline-item.is-done .timeline-dot { background: var(--success-500); border-color: var(--success-500); color: #fff; }
.timeline-item.is-done::before { background: var(--success-500); }
.timeline-item.is-current .timeline-dot { border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--brand-100); }
.timeline-item.is-current .timeline-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-500); }
.timeline-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.timeline-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

/* 横向步骤条 */
.steps { display: flex; align-items: center; gap: var(--s-2); counter-reset: step; }
.step { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 12px; font-weight: var(--fw-semibold); background: var(--gray-100); color: var(--text-3);
}
.step.is-active { color: var(--text); font-weight: var(--fw-medium); }
.step.is-active::before { background: var(--brand-600); color: #fff; }
.step.is-done::before { content: "✓"; background: var(--success-50); color: var(--success-600); }
.steps .sep { flex: 1; min-width: 16px; height: 1px; background: var(--border-strong); }

/* ---------- Dialog（原生 <dialog>：modal / drawer） ---------- */
dialog { padding: 0; border: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
.modal {
  width: min(520px, calc(100vw - 32px)); margin: auto;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.modal[open] { animation: modal-in var(--dur-slow) var(--ease-out); }
.modal[open]::backdrop { animation: fade-in var(--dur-slow) var(--ease-out); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-6) 0; }
.modal-title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.modal-body { padding: var(--s-5) var(--s-6); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--surface-muted); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.drawer {
  position: fixed; inset: 0 0 0 auto; height: 100%; width: min(480px, 100vw); margin: 0 0 0 auto;
  display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-lg);
}
.drawer:not([open]) { display: none; }
.drawer[open] { animation: drawer-in var(--dur-slow) var(--ease-out); }
.drawer[open]::backdrop { animation: fade-in var(--dur-slow) var(--ease-out); }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s-5) var(--s-6); }
.drawer-footer { display: flex; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--surface-muted); }
.drawer-section + .drawer-section { margin-top: var(--s-6); padding-top: var(--s-6); border-top: 1px dashed var(--border); }
.section-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-3); letter-spacing: .04em; margin-bottom: var(--s-3); }

@keyframes modal-in  { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in   { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: var(--z-toast);
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 10px var(--s-4); border-radius: var(--r-md);
  background: var(--gray-900); color: #fff; font-size: var(--fs-sm); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Dropdown（CSS :focus-within，无 JS） ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: var(--z-overlay); min-width: 180px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), visibility 0s linear var(--dur);
}
.dropdown:focus-within .dropdown-menu, .dropdown.is-open .dropdown-menu {
  opacity: 1; visibility: visible; transform: none; transition-delay: 0s;
}
.dropdown-item { display: flex; align-items: center; gap: var(--s-2); width: 100%; padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-2); text-align: left; }
.dropdown-item:hover { background: var(--gray-50); color: var(--text); }
.dropdown-item.is-danger { color: var(--danger-600); }
.dropdown-sep { height: 1px; margin: 6px 0; background: var(--border); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); flex-wrap: wrap; }
.pager { display: inline-flex; gap: 4px; }
.pager a, .pager span {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: var(--r-sm); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.pager a:hover { background: var(--gray-100); color: var(--text); }
.pager .is-active { background: var(--brand-600); color: #fff; }

/* ---------- Empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--s-12) var(--s-6); color: var(--text-3); }
.empty .icon-box { width: 52px; height: 52px; border-radius: var(--r-lg); margin-bottom: var(--s-4); }
.empty .icon-box .icon { width: 24px; height: 24px; }
.empty-title { color: var(--text); font-weight: var(--fw-semibold); font-size: var(--fs-md); }
.empty p { margin-top: 4px; font-size: var(--fs-sm); max-width: 320px; }

/* ---------- Skeleton（加载态，唯一允许的循环动画之一） ---------- */
.skeleton {
  display: block; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 37%, var(--gray-100) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------- Status dot ---------- */
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-400); }
.status-dot.is-online::before { background: var(--success-500); box-shadow: 0 0 0 3px var(--success-50); }
.status-dot.is-warn::before { background: var(--warning-500); box-shadow: 0 0 0 3px var(--warning-50); }
.status-dot.is-off::before { background: var(--danger-500); box-shadow: 0 0 0 3px var(--danger-50); }

/* ---------- Chart（内联 SVG，无图表库） ---------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--gray-100); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-size: 11px; font-family: var(--font-sans); }
.chart .bar { fill: var(--brand-200); transition: fill var(--dur-fast) var(--ease-out); }
.chart .bar:hover, .chart .bar.is-active { fill: var(--brand-500); }
.chart .line { fill: none; stroke: var(--brand-500); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-2 { fill: none; stroke: var(--teal-500); stroke-width: 2; stroke-dasharray: 4 4; stroke-linejoin: round; }
.chart .point { fill: #fff; stroke: var(--brand-500); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-4); font-size: var(--fs-xs); color: var(--text-3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Scroll reveal（官网专用；无 JS 时直接显示） ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 480ms var(--ease-out), transform 480ms var(--ease-out); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 60ms !important; }
.reveal-d2 { transition-delay: 120ms !important; }
.reveal-d3 { transition-delay: 180ms !important; }

/* ---------- 尊重系统"减少动态效果" ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Dropzone（上传） ---------- */
.dropzone {
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 72px; padding: var(--s-4); text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-muted);
  font-size: var(--fs-sm); color: var(--text-3); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--brand-400); background: var(--brand-50); color: var(--brand-700); }
.dropzone:focus-within { box-shadow: var(--ring); }

/* ---------- 商品标识（中性方块，接入后替换为官方授权图标） ---------- */
.monogram { background: var(--gray-100) !important; color: var(--gray-700) !important; border: 1px solid var(--border); }
