/* =====================================================================
 *  DataPulse · 设计系统（手写 CSS，无构建步骤）
 *  风格：极简 / 线条感 / 轻动效
 *  - 只用 1px 描边区分层级，几乎不用阴影
 *  - 统一 10px 圆角、8px 间距栅格
 *  - 所有交互 150~260ms ease-out
 *  =================================================================== */

/* ------------------------------------------------------------------ */
/*  1. 设计令牌                                                        */
/* ------------------------------------------------------------------ */
:root {
  /* 色彩 */
  --bg: #fafafb;
  --bg-raised: #ffffff;
  --bg-soft: #f4f4f6;
  --bg-sunken: #efeff2;

  --fg: #14141a;
  --fg-muted: #61616e;
  --fg-subtle: #9a9aa8;

  --line: #e9e9ee;
  --line-strong: #d6d6de;
  --line-hard: #b9b9c4;

  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-soft: #f5f3ff;
  --accent-line: #ddd6fe;
  --accent-ring: rgba(109, 40, 217, 0.16);

  --ok: #047857;
  --ok-soft: #ecfdf5;
  --ok-line: #a7f3d0;

  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-line: #fcd34d;

  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --bad-line: #fecaca;

  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --info-line: #bfdbfe;

  /* 尺寸 */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  --topbar-h: 56px;
  --bottomnav-h: 62px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica,
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms;
  --t: 200ms;
  --t-slow: 320ms;

  /* 浮层 */
  --shadow-pop: 0 1px 2px rgba(16, 16, 26, 0.04),
    0 12px 32px -12px rgba(16, 16, 26, 0.18);
  --shadow-modal: 0 24px 64px -24px rgba(16, 16, 26, 0.32);

  --z-nav: 40;
  --z-pop: 60;
  --z-modal: 80;
  --z-toast: 100;
}

/* ------------------------------------------------------------------ */
/*  2. 基础                                                            */
/* ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: 1.3;
}

p { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

ul, ol { margin: 0; padding: 0; list-style: none; }

svg { display: block; flex: none; }

/* 图标默认尺寸（组件内的 > svg 规则优先级更高） */
.i { width: 16px; height: 16px; }

/* 线性图标的基础描边（CSS 兜底）。
   模板里的 icon() 宏会写上这些表现属性，但 JS 动态拼出来的
   `<svg class="i"><use href="#i-xxx"/></svg>` 往往没有；
   少了它们浏览器会按 SVG 默认的 fill:black + stroke:none 画，
   图标就变成一坨黑块。统一在 CSS 里定死，谁拼都不会再出错。 */
svg.i {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] { display: none !important; }

/* 打开弹窗时锁定背景滚动 */
body.modal-open { overflow: hidden; }

::selection {
  background: var(--accent);
  color: #fff;
}

/* 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--line-hard); background-clip: content-box; }

/* 焦点可见性 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ------------------------------------------------------------------ */
/*  3. 动效                                                            */
/* ------------------------------------------------------------------ */
@keyframes dp-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes dp-rise {
  from { opacity: 0; transform: translateY(8px) }
  to { opacity: 1; transform: none }
}
@keyframes dp-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.975) }
  to { opacity: 1; transform: none }
}
@keyframes dp-sheet-up {
  from { transform: translateY(100%) }
  to { transform: none }
}
@keyframes dp-drop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98) }
  to { opacity: 1; transform: none }
}
@keyframes dp-toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98) }
  to { opacity: 1; transform: none }
}
@keyframes dp-spin { to { transform: rotate(360deg) } }
@keyframes dp-pulse {
  0%, 100% { opacity: 1; transform: scale(1) }
  50% { opacity: 0.45; transform: scale(0.82) }
}
@keyframes dp-shimmer {
  from { background-position: -180% 0 }
  to { background-position: 180% 0 }
}
@keyframes dp-draw { from { transform: scaleX(0) } to { transform: scaleX(1) } }
@keyframes dp-bar-grow { from { transform: scaleY(0.02) } to { transform: scaleY(1) } }
@keyframes dp-blob {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1) }
  50% { transform: translate3d(3%, -4%, 0) scale(1.08) }
}

.anim-fade { animation: dp-fade var(--t) var(--ease-out) both }
.anim-rise { animation: dp-rise var(--t-slow) var(--ease-out) both }
.anim-pop { animation: dp-pop 220ms var(--ease-out) both }

/* 逐项入场：给容器加 .stagger，子项按序延迟 */
.stagger > * { animation: dp-rise 380ms var(--ease-out) both }
.stagger > *:nth-child(1) { animation-delay: 20ms }
.stagger > *:nth-child(2) { animation-delay: 60ms }
.stagger > *:nth-child(3) { animation-delay: 100ms }
.stagger > *:nth-child(4) { animation-delay: 140ms }
.stagger > *:nth-child(5) { animation-delay: 180ms }
.stagger > *:nth-child(6) { animation-delay: 220ms }
.stagger > *:nth-child(n + 7) { animation-delay: 260ms }

.spin { animation: dp-spin 900ms linear infinite }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------------ */
/*  4. 布局原语                                                        */
/* ------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
@media (min-width: 720px) { .container { padding: 0 var(--sp-6) } }

.stack { display: flex; flex-direction: column; gap: var(--sp-4) }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2) }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-6) }

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.row-wrap { flex-wrap: wrap }
.spacer { flex: 1 1 auto; min-width: 0 }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--sp-4) }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--sp-4) }
/* 参差排布（JS 给每张卡片分配列与行跨度）：下方的卡片会上移填补留空 */
.masonry {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 4px;
  column-gap: var(--sp-4);
  row-gap: 0;
  align-items: start;
}
@media (min-width: 720px) {
  .masonry { grid-template-columns: repeat(2, minmax(0, 1fr)) }
}
.masonry > * { min-width: 0 }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) }
}
@media (min-width: 1000px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .grid-3.wide { grid-template-columns: repeat(3, minmax(0, 1fr)) }
}

.text-xs { font-size: 12px }
.text-sm { font-size: 13px }
.text-lg { font-size: 16px }
.text-xl { font-size: 19px }
.muted { color: var(--fg-muted) }
.subtle { color: var(--fg-subtle) }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums }
.nowrap { white-space: nowrap }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.center { text-align: center }
.strong { font-weight: 600 }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

/* 细线分隔 */
.hr { height: 1px; background: var(--line); border: 0; margin: 0 }
.hr-v { width: 1px; align-self: stretch; background: var(--line) }

/* ------------------------------------------------------------------ */
/*  5. 按钮                                                            */
/* ------------------------------------------------------------------ */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--fg);
  --btn-line: var(--line-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--btn-line);
  border-radius: var(--r);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
  transition: background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.btn > svg { width: 15px; height: 15px; transition: transform var(--t) var(--ease) }
.btn:hover { background: var(--bg-soft); border-color: var(--line-hard) }
.btn:active { transform: translateY(1px) }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.btn-primary {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  --btn-line: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover) }
.btn-primary:hover > svg { transform: scale(1.08) }

.btn-soft {
  --btn-bg: var(--accent-soft);
  --btn-fg: var(--accent);
  --btn-line: var(--accent-line);
}
.btn-soft:hover { background: #ede9fe; border-color: var(--accent) }

.btn-ghost { --btn-line: transparent }
.btn-ghost:hover { background: var(--bg-soft); border-color: transparent }

.btn-danger { --btn-fg: var(--bad); --btn-line: var(--bad-line) }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad) }

.btn-danger-solid {
  --btn-bg: var(--bad);
  --btn-fg: #fff;
  --btn-line: var(--bad);
}
.btn-danger-solid:hover { background: #991b1b; border-color: #991b1b }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm) }
.btn-sm > svg { width: 13px; height: 13px }
.btn-lg { height: 42px; padding: 0 var(--sp-5); font-size: 14px; border-radius: var(--r) }
.btn-lg > svg { width: 17px; height: 17px }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}
.btn-icon.btn-sm { width: 28px; height: 28px }

.btn-block { width: 100% }

/* 按钮内联加载 */
.btn[data-loading="1"] { pointer-events: none; opacity: 0.7 }
.btn[data-loading="1"]::after {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: dp-spin 700ms linear infinite;
}
.btn[data-loading="1"] > svg { display: none }

/* 图标按钮的悬浮位移 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 30px;
  padding: 0 var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  font-size: 12.5px;
  transition: all var(--t-fast) var(--ease);
}
.icon-btn > svg { width: 14px; height: 14px }
.icon-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

/* ------------------------------------------------------------------ */
/*  6. 表单                                                            */
/* ------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0 }

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-muted);
}
.field-label > svg { width: 13px; height: 13px }

.input,
.textarea,
.select {
  width: 100%;
  height: 38px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg-raised);
  color: var(--fg);
  font-size: 14px;
  transition: border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.input::placeholder,
.textarea::placeholder { color: var(--fg-subtle) }

.input:hover,
.textarea:hover,
.select:hover { border-color: var(--line-hard) }

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: var(--sp-3);
  line-height: 1.6;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2361616e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.input-icon { position: relative; display: flex; align-items: center }
.input-icon > svg:first-child {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--fg-subtle);
  pointer-events: none;
  transition: color var(--t-fast) var(--ease);
}
.input-icon > .input { padding-left: 34px }
.input-icon:focus-within > svg:first-child { color: var(--accent) }
.input-icon > .input-action {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  color: var(--fg-subtle);
  transition: all var(--t-fast) var(--ease);
}
.input-icon > .input-action:hover { color: var(--accent); background: var(--accent-soft) }
.input-icon > .input-action > svg { width: 15px; height: 15px }

/* 带静态前后缀的输入组：协议前缀 / 账号密码行 */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.input-group > .input {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 8px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
}
.input-group > .input:focus { box-shadow: none; border-color: var(--accent) }
.input-group:focus-within > .input-group-prefix {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.input-group-prefix {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--bg-soft);
  color: var(--fg-subtle);
  font-size: 12.5px;
  font-family: var(--font-mono);
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.input-group-prefix > svg { width: 14px; height: 14px }
/* 长前缀（如完整域名）需要可截断，否则会把输入框挤没 */
.input-group-prefix.is-wide {
  display: block;
  line-height: 36px;
  max-width: 52%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}
.input-group > .input-action {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  color: var(--fg-subtle);
  transition: all var(--t-fast) var(--ease);
}
.input-group > .input-action:hover { color: var(--accent); background: var(--accent-soft) }
.input-group > .input-action > svg { width: 15px; height: 15px }
.input-group > .input.has-action { padding-right: 34px }

/* 账号配置：一行一个账号，可编辑账号名与密码 */
.acct-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-raised);
  transition: border-color var(--t-fast) var(--ease);
}
.acct-row:hover { border-color: var(--line-strong) }
.acct-fields {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.acct-fields .line-index { flex: none }
.acct-status { flex: none }
.acct-meta {
  font-size: 11.5px;
  color: var(--fg-subtle);
  padding-left: 26px;
}
@media (max-width: 560px) {
  .acct-meta { padding-left: 0 }
}

/* 字段说明里的小代码片段 */
.field-hint code {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* 站点公告正文：保留换行、超长可滚 */
.announcement-body {
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 52dvh;
  overflow: auto;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-soft);
}

/* 字段级错误提示 */
.field-error {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--bad);
  animation: dp-rise 200ms var(--ease-out) both;
}
.field-error > svg { width: 12px; height: 12px }

/* 字段说明（非错误） */
.field-hint {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--fg-subtle);
}
.input[aria-invalid="true"] {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

/* 开关 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 22px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
  flex: none;
}
.switch::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line-strong);
  transition: transform var(--t) var(--ease-out), border-color var(--t) var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent) }
.switch[aria-checked="true"]::after {
  transform: translateX(16px);
  border-color: transparent;
}

/* 复选框 */
.check {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg-raised);
  flex: none;
  transition: all var(--t-fast) var(--ease);
}
.check:hover { border-color: var(--accent) }
.check[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}
.check > svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 12px;
  color: #fff;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
}
.check[aria-checked="true"] > svg {
  animation: dp-check 260ms var(--ease-out) forwards;
}
@keyframes dp-check { to { stroke-dashoffset: 0 } }

/* 单选 */
.radio {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.radio:hover { border-color: var(--line-hard); background: var(--bg-soft) }
.radio > span:first-child {
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-hard);
  border-radius: 50%;
  flex: none;
  position: relative;
  transition: border-color var(--t-fast) var(--ease);
}
.radio[data-checked="1"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.radio[data-checked="1"] > span:first-child { border-color: var(--accent) }
.radio[data-checked="1"] > span:first-child::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  animation: dp-pop 180ms var(--ease-out) both;
}

/* 分段控件 */
.segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-soft);
}
.segment > button {
  height: 26px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: all var(--t-fast) var(--ease);
}
.segment > button:hover { color: var(--fg) }
.segment > button[aria-selected="true"] {
  background: var(--bg-raised);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  box-shadow: 0 1px 2px rgba(16, 16, 26, 0.04);
}
.segment-full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100% }

/* 自定义下拉 */
.dp-select { position: relative; min-width: 0 }
.dp-select > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  height: 38px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg-raised);
  font-size: 14px;
  text-align: left;
  transition: all var(--t-fast) var(--ease);
}
.dp-select > button:hover { border-color: var(--line-hard) }
.dp-select > button[aria-expanded="true"],
.dp-select > button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  outline: none;
}
.dp-select > button > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dp-select > button > span[data-placeholder="1"] { color: var(--fg-subtle) }
.dp-select > button > svg {
  width: 15px;
  height: 15px;
  color: var(--fg-subtle);
  transition: transform var(--t) var(--ease);
}
.dp-select > button[aria-expanded="true"] > svg { transform: rotate(180deg) }

.dp-menu {
  position: absolute;
  z-index: var(--z-pop);
  top: calc(100% + 5px);
  left: 0;
  min-width: 100%;
  max-height: 280px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop);
  animation: dp-drop 160ms var(--ease-out) both;
}
.dp-menu > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  text-align: left;
  color: var(--fg);
  transition: background var(--t-fast) var(--ease);
}
.dp-menu > button:hover { background: var(--bg-soft) }
.dp-menu > button[aria-selected="true"] { color: var(--accent); font-weight: 500 }
.dp-menu > button > svg { width: 14px; height: 14px }
/* 下方放不下时向上弹（JS 计算，避免被 overflow 祖先裁掉） */
.dp-menu[data-flip="1"] {
  top: auto;
  bottom: calc(100% + 5px);
  transform-origin: bottom;
}

/* 看板设置卡片里的下拉菜单不能被卡片自身的 overflow:hidden 裁掉
   （必须带 .surface 才能赢得同优先级的 .surface 规则） */
.surface[data-dash-card] { overflow: visible }

/* 智能排序规则行 */
.rule-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.rule-row > .rule-index {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
}
.rule-row > .dp-select { min-width: 128px }
.rule-row > .rule-field { flex: 1 1 128px }
.rule-row > .rule-dir { flex: 1 1 128px }
.rule-row > [data-action="dash-del-rule"] { flex: none; margin-left: auto }

/* ------------------------------------------------------------------ */
/*  7. 标签 / 徽记                                                     */
/* ------------------------------------------------------------------ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
  flex: none;
}
.tag > svg { width: 12px; height: 12px }
.tag-accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft) }
.tag-ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft) }
.tag-warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft) }
.tag-bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft) }
.tag-info { color: var(--info); border-color: var(--info-line); background: var(--info-soft) }
.tag-plain { background: var(--bg-soft); border-color: var(--line) }
.tag-lg { height: 26px; padding: 0 10px; font-size: 12.5px }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-subtle);
  flex: none;
}
.dot-ok { background: var(--ok) }
.dot-warn { background: var(--warn) }
.dot-bad { background: var(--bad) }
.dot-accent { background: var(--accent) }
.dot-live { animation: dp-pulse 1.6s var(--ease) infinite }

.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}

.kv { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap }
.kv > b { font-weight: 600; font-variant-numeric: tabular-nums }

/* ------------------------------------------------------------------ */
/*  8. 面板 / 卡片                                                     */
/* ------------------------------------------------------------------ */
.surface {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  overflow: hidden;
  transition: border-color var(--t) var(--ease);
}
.surface:hover { border-color: var(--line-strong) }
.surface-flat:hover { border-color: var(--line) }

.surface-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  row-gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}
/* 标题右侧的徽标/说明靠左紧贴标题；按钮组统一靠右，窄屏放不下时整组换行 */
.surface-head .spacer { display: none }
.surface-head > .head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-left: auto;
}
.surface-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}
.surface-title > svg { width: 16px; height: 16px; color: var(--accent); flex: none }

/* 窄屏下隐藏次要说明，把空间让给标题 */
.head-desc { display: none; flex: none }
@media (min-width: 1000px) {
  .head-desc {
    display: block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
.surface-body { padding: var(--sp-4) }
.surface-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.surface-desc {
  padding: 0 var(--sp-4) var(--sp-3);
  font-size: 12.5px;
  color: var(--fg-muted);
}

/* 统计块 */
.stat {
  position: relative;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-raised);
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line-strong);
  transform-origin: top;
  animation: dp-bar-grow 420ms var(--ease-out) both;
}
.stat-accent::before { background: var(--accent) }
.stat-ok::before { background: var(--ok) }
.stat-warn::before { background: var(--warn) }
.stat-bad::before { background: var(--bad) }
.stat-value {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-label { font-size: 11.5px; color: var(--fg-muted); margin-top: 2px }
.stat-accent .stat-value { color: var(--accent) }
.stat-ok .stat-value { color: var(--ok) }
.stat-warn .stat-value { color: var(--warn) }
.stat-bad .stat-value { color: var(--bad) }

/* ------------------------------------------------------------------ */
/*  9. 表格 / 商品列表                                                 */
/* ------------------------------------------------------------------ */
.tbl-wrap { width: 100%; overflow-x: auto }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px }
.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0 var(--sp-3);
  height: 40px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-muted);
  text-align: left;
  white-space: nowrap;
}
.tbl tbody td {
  padding: 0 var(--sp-3);
  height: 46px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.tbl tbody tr {
  transition: background var(--t-fast) var(--ease);
}
.tbl tbody tr[data-goods-row] { cursor: pointer }
.tbl tbody tr:hover { background: var(--bg-soft) }
.tbl tbody tr:last-child td { border-bottom: 0 }

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  margin-left: -6px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast) var(--ease);
}
.th-sort:hover { color: var(--accent); background: var(--accent-soft) }
.th-sort > svg { width: 12px; height: 12px; opacity: 0.5 }
.th-sort[data-active="1"] { color: var(--accent) }
.th-sort[data-active="1"] > svg { opacity: 1 }

.td-num { text-align: center; font-variant-numeric: tabular-nums }
.td-actions { text-align: right }

.tr-muted { opacity: 0.62 }

/* 已勾选的行 */
.tr-picked, .tr-picked:hover { background: var(--accent-soft) !important }
.tr-picked td { border-bottom-color: var(--accent-line) }
tr[data-gs-row] { cursor: pointer }
tr[data-add-row] { cursor: pointer }

/* 商品行内的商品名区块 */
.goods {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.goods-id {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  flex: none;
}
.goods-name { font-weight: 500; min-width: 0 }

/* 进度条（成功率） */
.bar {
  position: relative;
  width: 54px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  overflow: hidden;
}
.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--fg-subtle);
  transform-origin: left;
  transition: width var(--t-slow) var(--ease-out);
}
.bar-ok > i { background: var(--ok) }
.bar-warn > i { background: var(--warn) }
.bar-bad > i { background: var(--bad) }

.rate { display: inline-flex; align-items: center; gap: 7px }
.rate > b { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 42px; text-align: right }

/* ---------------- 手机端商品卡片 ---------------- */
.goods-cards { display: none }

@media (max-width: 899px) {
  .tbl-wrap { display: none }
  .goods-cards {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-3);
  }
}

.gcard {
  position: relative;
  padding: var(--sp-3) var(--sp-3) 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-raised);
  cursor: pointer;
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.gcard:active { transform: scale(0.995) }
.gcard::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: var(--r-full);
  background: transparent;
  transition: background var(--t) var(--ease);
}
.gcard:hover::before { background: var(--accent) }

.gcard-top { display: flex; align-items: flex-start; gap: var(--sp-2) }
.gcard-title {
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.4;
  min-width: 0;
}
.gcard-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px }
.gcard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3) var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--line);
}
@media (min-width: 560px) {
  .gcard-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) }
}
.gcard-grid > div { min-width: 0 }
.gcard-grid dt { font-size: 10.5px; color: var(--fg-subtle); margin-bottom: 2px }
.gcard-grid dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.gcard-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.gcard-actions .btn { flex: 1 }

/* ------------------------------------------------------------------ */
/*  10. 应用外壳                                                       */
/* ------------------------------------------------------------------ */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-raised) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  min-width: 0;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
  transition: transform var(--t) var(--ease-out);
}
.brand-mark > svg { width: 17px; height: 17px }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05) }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0 }
.brand-name { font-size: 14px; font-weight: 650; letter-spacing: -0.01em }
.brand-sub { font-size: 10.5px; color: var(--fg-subtle) }

/* 顶部导航：下划线跟随 */
.nav { display: none }
@media (min-width: 900px) {
  .nav { display: flex; align-items: center; gap: 2px; margin-left: var(--sp-4) }
}
.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--topbar-h);
  padding: 0 13px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color var(--t) var(--ease);
}
.nav-item > svg { width: 15px; height: 15px; transition: transform var(--t) var(--ease-out) }
.nav-item::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--t) var(--ease-out);
}
.nav-item:hover { color: var(--fg) }
.nav-item:hover > svg { transform: translateY(-1px) }
.nav-item[aria-current="true"] { color: var(--accent) }
.nav-item[aria-current="true"]::after { transform: scaleX(1) }

/* 底部导航（手机） */
.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-nav);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
@media (min-width: 900px) { .bottomnav { display: none } }

.bottomnav > button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--fg-subtle);
  transition: color var(--t) var(--ease);
}
.bottomnav > button > svg { width: 20px; height: 20px; transition: transform var(--t) var(--ease-out) }
.bottomnav > button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 26px;
  height: 2px;
  margin-left: -13px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--t) var(--ease-out);
}
.bottomnav > button[aria-current="true"] { color: var(--accent) }
.bottomnav > button[aria-current="true"]::before { transform: scaleX(1) }
.bottomnav > button[aria-current="true"] > svg { transform: translateY(-1px) scale(1.06) }

main.app-main {
  flex: 1 1 auto;
  padding: var(--sp-5) 0 calc(var(--bottomnav-h) + var(--sp-8) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 900px) {
  main.app-main { padding: var(--sp-6) 0 var(--sp-10) }
}

/* 页面标题区 */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-head-main { min-width: 0; flex: 1 1 220px }
.page-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.page-title > svg { width: 19px; height: 19px; color: var(--accent) }
.page-sub { font-size: 12.5px; color: var(--fg-muted); margin-top: 3px }

/* 同步状态胶囊 */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--bg-raised);
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.sync-pill:hover { border-color: var(--line-strong); color: var(--fg) }
.sync-pill > svg { width: 13px; height: 13px }
.sync-pill[data-state="syncing"],
.sync-pill[data-state="loading"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft) }
.sync-pill[data-state="loading"] { cursor: progress }

/* 用户菜单 */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 4px 0 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--bg-raised);
  transition: all var(--t-fast) var(--ease);
  max-width: 150px;
}
.user-chip:hover { border-color: var(--line-strong); background: var(--bg-soft) }
.user-chip-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  flex: none;
  text-transform: uppercase;
}
.user-chip-name { font-size: 12.5px; font-weight: 500; min-width: 0 }
.user-chip-caret { width: 13px; height: 13px; color: var(--fg-subtle); flex: none; margin-right: 3px }

/* ------------------------------------------------------------------ */
/*  11. 工具栏 / 筛选                                                  */
/* ------------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  margin-bottom: var(--sp-4);
}
.toolbar .input-icon { flex: 1 1 200px; min-width: 0 }
.toolbar .input { height: 34px }
.toolbar .input-icon > .input { padding-left: 32px }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  font-size: 12px;
  color: var(--fg-muted);
  transition: all var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--fg) }
.chip > svg { width: 12px; height: 12px }
.chip-removable > button {
  display: flex;
  align-items: center;
  margin-right: -3px;
  color: var(--fg-subtle);
}
.chip-removable > button:hover { color: var(--bad) }

/* ------------------------------------------------------------------ */
/*  12. 弹窗 / 抽屉                                                    */
/* ------------------------------------------------------------------ */
.scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(18, 18, 26, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: dp-fade 180ms var(--ease-out) both;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
@media (min-width: 640px) {
  .modal { align-items: center; padding: var(--sp-6) }
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 92dvh;
  border: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--bg-raised);
  box-shadow: var(--shadow-modal);
  animation: dp-sheet-up 280ms var(--ease-out) both;
  overflow: hidden;
}
@media (min-width: 640px) {
  .modal-panel {
    max-width: var(--modal-w, 520px);
    max-height: 88dvh;
    border-radius: var(--r-lg);
    animation: dp-pop 220ms var(--ease-out) both;
  }
}

/* 手机端顶部拖拽条 */
.modal-grip {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}
.modal-grip::after {
  content: "";
  width: 36px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--line-strong);
}
@media (min-width: 640px) { .modal-grip { display: none } }

.modal[data-state="closing"] .modal-panel {
  animation: dp-fade 170ms var(--ease) reverse both;
}
.modal[data-state="closing"] .scrim {
  animation: dp-fade 170ms var(--ease) reverse both;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.modal-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
}
.modal-title > svg { width: 17px; height: 17px; color: var(--accent) }
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--fg-subtle);
  transition: all var(--t-fast) var(--ease);
  flex: none;
}
.modal-close:hover { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft) }
.modal-close > svg { width: 16px; height: 16px }

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-4);
  overscroll-behavior: contain;
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  flex: none;
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
}
.modal-foot .btn { flex: none }
@media (max-width: 479px) {
  .modal-foot { flex-wrap: wrap }
  .modal-foot .btn { flex: 1 1 auto }
}

/* ------------------------------------------------------------------ */
/*  13. 提示条 / 空状态 / 骨架                                         */
/* ------------------------------------------------------------------ */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: 10px var(--sp-3);
  border: 1px solid var(--line);
  border-left-width: 2px;
  border-radius: var(--r);
  background: var(--bg-raised);
  font-size: 12.5px;
  color: var(--fg-muted);
}
.notice > svg { width: 15px; height: 15px; flex: none; margin-top: 1px }
.notice-accent { border-left-color: var(--accent); background: var(--accent-soft); color: #4c1d95 }
.notice-accent > svg { color: var(--accent) }
.notice-warn { border-left-color: var(--warn); background: var(--warn-soft); color: #78350f }
.notice-warn > svg { color: var(--warn) }
.notice-bad { border-left-color: var(--bad); background: var(--bad-soft); color: #7f1d1d }
.notice-bad > svg { color: var(--bad) }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-10) var(--sp-4);
  text-align: center;
}
.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--fg-subtle);
  background: var(--bg-soft);
}
.empty-icon > svg { width: 24px; height: 24px }
.empty-title { font-size: 14px; font-weight: 600 }
.empty-text { font-size: 12.5px; color: var(--fg-muted); max-width: 340px }
.empty .btn { margin-top: var(--sp-3) }

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(
    90deg,
    var(--bg-sunken) 25%,
    #f9f9fb 50%,
    var(--bg-sunken) 75%
  );
  background-size: 200% 100%;
  animation: dp-shimmer 1.4s linear infinite;
}
.sk-line { height: 11px; margin: 6px 0 }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: dp-spin 720ms linear infinite;
}

/* ------------------------------------------------------------------ */
/*  14. Toast                                                          */
/* ------------------------------------------------------------------ */
.toaster {
  position: fixed;
  z-index: var(--z-toast);
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: calc(var(--bottomnav-h) + var(--sp-3) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
@media (min-width: 900px) {
  .toaster {
    left: auto;
    right: var(--sp-5);
    bottom: var(--sp-5);
    width: 360px;
  }
}

.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px var(--sp-3) 11px var(--sp-4);
  border: 1px solid var(--line);
  border-left-width: 2px;
  border-radius: var(--r);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: dp-toast-in 240ms var(--ease-out) both;
}
.toast[data-leaving="1"] {
  animation: dp-fade 160ms var(--ease) reverse both;
}
.toast > svg { width: 16px; height: 16px; margin-top: 1px; flex: none; color: var(--fg-muted) }
.toast-body { flex: 1 1 auto; min-width: 0 }
.toast-title { font-size: 13px; font-weight: 600 }
.toast-desc { font-size: 12px; color: var(--fg-muted); margin-top: 1px }
.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  color: var(--fg-subtle);
  flex: none;
  transition: all var(--t-fast) var(--ease);
}
.toast-close:hover { color: var(--fg); background: var(--bg-soft) }
.toast-close > svg { width: 13px; height: 13px }
.toast-ok { border-left-color: var(--ok) }
.toast-ok > svg { color: var(--ok) }
.toast-bad { border-left-color: var(--bad) }
.toast-bad > svg { color: var(--bad) }
.toast-warn { border-left-color: var(--warn) }
.toast-warn > svg { color: var(--warn) }
.toast-info { border-left-color: var(--accent) }
.toast-info > svg { color: var(--accent) }

/* ------------------------------------------------------------------ */
/*  15. 认证页                                                         */
/* ------------------------------------------------------------------ */
.auth-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--sp-5) var(--sp-4);
  overflow: hidden;
  background: var(--bg);
}
/* 背景细线网格 + 流动光斑 */
.auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 25%, transparent 78%);
  opacity: 0.7;
}
.auth-blob {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.3;
  pointer-events: none;
  animation: dp-blob 18s var(--ease) infinite;
}
.auth-blob-1 { top: -140px; left: -100px; background: #ddd6fe }
.auth-blob-2 { bottom: -160px; right: -120px; background: #fbcfe8; animation-delay: -9s }

.auth-card {
  position: relative;
  width: 100%;
  max-width: 396px;
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: dp-pop 380ms var(--ease-out) both;
}
@media (min-width: 480px) { .auth-card { padding: var(--sp-8) var(--sp-6) var(--sp-6) } }

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
  text-align: center;
}
.auth-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  animation: dp-pop 500ms var(--ease-out) both 80ms;
  transition: transform var(--t-slow) var(--ease-out);
}
.auth-mark:hover { transform: rotate(-8deg) scale(1.06) }
.auth-mark > svg { width: 24px; height: 24px }
.auth-name { font-size: 21px; font-weight: 700; letter-spacing: -0.025em }
.auth-sub { font-size: 12.5px; color: var(--fg-muted) }

.auth-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-5);
}
.auth-tab {
  position: relative;
  height: 40px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color var(--t) var(--ease);
}
.auth-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--t) var(--ease-out);
}
.auth-tab:hover { color: var(--fg) }
.auth-tab[aria-selected="true"] { color: var(--accent); font-weight: 600 }
.auth-tab[aria-selected="true"]::after { transform: scaleX(1) }

.auth-foot {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--fg-subtle);
  text-align: center;
}

/* ------------------------------------------------------------------ */
/*  16. 商品详情                                                       */
/* ------------------------------------------------------------------ */
.goods-hero { display: flex; align-items: flex-start; gap: var(--sp-3) }
.goods-hero-title { font-size: 16px; font-weight: 650; line-height: 1.35; letter-spacing: -0.015em }
.goods-hero-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px }

.chart-box {
  position: relative;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-raised);
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: 0 var(--sp-1) var(--sp-2);
  font-size: 11px;
  color: var(--fg-muted);
}
.chart-legend > span { display: inline-flex; align-items: center; gap: 5px }
.chart-legend i {
  width: 14px;
  height: 2px;
  border-radius: 2px;
  display: block;
}
.chart-tip {
  position: absolute;
  z-index: 2;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop);
  font-size: 11.5px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -110%);
  animation: dp-fade 120ms var(--ease) both;
}
.chart-tip b { font-variant-numeric: tabular-nums }

/* 详情里的参数标签 */
.params { display: flex; flex-wrap: wrap; gap: 6px }

/* ------------------------------------------------------------------ */
/*  17. 检测库列表                                                     */
/* ------------------------------------------------------------------ */
.lib-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.lib-card:hover { border-color: var(--line-strong) }
.lib-card:hover .lib-order { opacity: 1 }

.lib-order {
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0.55;
  transition: opacity var(--t) var(--ease);
  flex: none;
}
.lib-order > button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg-subtle);
  transition: all var(--t-fast) var(--ease);
}
.lib-order > button > svg { width: 11px; height: 11px }
.lib-order > button:hover:not([disabled]) {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.lib-order > button[disabled] { opacity: 0.3; pointer-events: none }

.lib-main { flex: 1 1 auto; min-width: 0 }
.lib-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em }
.lib-desc {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.lib-actions { display: flex; align-items: center; gap: 4px; flex: none }
@media (max-width: 719px) {
  .lib-card { flex-wrap: wrap }
  .lib-actions { width: 100%; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line) }
  .lib-actions .icon-btn { flex: 1; justify-content: center }
}

/* ------------------------------------------------------------------ */
/*  18. 账号行 / 规则行                                                */
/* ------------------------------------------------------------------ */
.line-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-raised);
  transition: all var(--t-fast) var(--ease);
}
.line-item:hover { border-color: var(--line-strong); background: var(--bg-soft) }
.line-index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  flex: none;
}
.line-main { flex: 1 1 auto; min-width: 0 }
.line-title { font-size: 13.5px; font-weight: 550 }
.line-sub { font-size: 11.5px; color: var(--fg-muted); margin-top: 1px }

/* ------------------------------------------------------------------ */
/*  19. 图表                                                           */
/* ------------------------------------------------------------------ */
.chart-svg { width: 100%; height: auto; display: block; overflow: visible }
.chart-grid { stroke: var(--line); stroke-dasharray: 3 4 }
.chart-axis { stroke: var(--line-strong) }
.chart-tick { font-size: 10px; fill: var(--fg-subtle) }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round }
.chart-dot { r: 0; transition: r var(--t-fast) var(--ease) }
.chart-hit { fill: transparent; cursor: crosshair }
.chart-cursor { stroke: var(--line-strong); stroke-dasharray: 3 3 }
.chart-area { opacity: 0.07 }

/* 线条描画动画 */
.chart-anim { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); animation: dp-stroke 900ms var(--ease-out) forwards }
@keyframes dp-stroke { to { stroke-dashoffset: 0 } }

/* ------------------------------------------------------------------ */
/*  20. 细节                                                           */
/* ------------------------------------------------------------------ */
.scroll-x {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none }

/* 语义化文字色 */
.text-ok { color: var(--ok) }
.text-warn { color: var(--warn) }
.text-bad { color: var(--bad) }
.text-accent { color: var(--accent) }

/* 两行截断 */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rise-on-load > * { animation: dp-rise 420ms var(--ease-out) both }

/* 顶部加载进度条 */
.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: calc(var(--z-toast) + 1);
  pointer-events: none;
  background: transparent;
}
.top-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #c026d3);
  transition: width 300ms var(--ease);
}
.top-progress[data-active="1"] > i { width: 90% }
.top-progress[data-done="1"] > i { width: 100%; opacity: 0; transition: width 160ms linear, opacity 240ms var(--ease) 80ms }

/* 窄屏下的顶栏精简 */
@media (max-width: 719px) {
  .topbar .btn-label { display: none }
  .topbar .user-chip-name { display: none }
  .topbar .user-chip { padding: 0 4px }
  .topbar .user-chip-caret { display: none }
}
@media (max-width: 560px) {
  .sync-pill { display: none }
  .brand-sub { display: none }
}

/* 移动端安全区 */
@supports (padding: max(0px)) {
  .container { padding-left: max(var(--sp-4), env(safe-area-inset-left)); padding-right: max(var(--sp-4), env(safe-area-inset-right)) }
}
