/* 发票查验 — 沿用「灰」主题（灰.css 里的 simple-large 预设），qiaomu-design 极致抛光版。
 *
 * token 名和上游一致（shadcn 风格：--background/--foreground/--card/--primary…），
 * 嵌进那套前端后由它的 :root 接管，本页自动跟着换肤。单独跑时用下面的兜底值。
 * 暗色：跟随系统，也认 <html class="dark">（宿主的主题开关就能直接控制本页）。
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --background: #fcfcfd;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #1060DC;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted: #f8fafc;
  --muted-foreground: #64748b;
  --accent: #e2e8f0;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --success: #10b981;
  --success-foreground: #ffffff;
  --warning: #f59e0b;
  --warning-foreground: #0f172a;
  --info: #1060DC;
  --info-foreground: #ffffff;
  --neutral: #475569;
  --border: #e2e8f0;
  --input: #cbd5e1;
  --ring: #1060DC;

  --chart-1: #1060DC;
  --chart-2: #00B553;
  --chart-3: #3b82f6;
  --chart-4: #f59e0b;
  --chart-5: #ef4444;

  --sidebar: #f8fafc;
  --skeleton-base: #e2e8f0;
  --skeleton-highlight: #f1f5f9;

  --radius: 0.75rem;
  --radius-sm: calc(var(--radius) * .5);
  --radius-md: calc(var(--radius) * .75);
  --spacing: .3rem;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* simple-large 的字号偏大，可读性更好 */
  --text-xs: .9rem;
  --text-sm: 1rem;
  --text-base: 1.125rem;
  --text-lg: 1.25rem;
  --text-xl: 1.45rem;

  /* 阴影与微光系统 (Elevations & Glows) */
  --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 3px 0 rgba(0, 0, 0, 0.02);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 10px 30px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-popover: 0 20px 40px -8px rgba(15, 23, 42, 0.16), 0 8px 16px -4px rgba(15, 23, 42, 0.08);

  /* Emil Kowalski 贝塞尔动效曲线 */
  --ease-out-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark {
  --background: #0b0f17;
  --foreground: #f8fafc;
  --card: #131b2e;
  --card-foreground: #f8fafc;
  --popover: #172036;
  --popover-foreground: #f8fafc;
  --primary: #f8fafc;
  --primary-foreground: #090d16;
  --secondary: #1e293b;
  --secondary-foreground: #f8fafc;
  --muted: #1e293b;
  --muted-foreground: #94a3b8;
  --accent: #334155;
  --accent-foreground: #f8fafc;
  --destructive: #f87171;
  --destructive-foreground: #090d16;
  --success: #34d399;
  --success-foreground: #090d16;
  --warning: #fbbf24;
  --warning-foreground: #090d16;
  --info: #60a5fa;
  --info-foreground: #090d16;
  --neutral: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --input: rgba(255, 255, 255, 0.14);
  --ring: #f8fafc;

  --chart-1: #f8fafc;
  --chart-2: #34d399;
  --chart-3: #60a5fa;
  --chart-4: #fbbf24;
  --chart-5: #f87171;

  --sidebar: #0f172a;
  --skeleton-base: #1e293b;
  --skeleton-highlight: #334155;

  --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-card: 0 4px 24px -2px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 36px -4px rgba(0, 0, 0, 0.45);
  --shadow-popover: 0 24px 48px -8px rgba(0, 0, 0, 0.6);
}

/* 宿主没给 .dark 时跟随系统；宿主显式给了 .light 就不跟 */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --background: #0b0f17;
    --foreground: #f8fafc;
    --card: #131b2e;
    --card-foreground: #f8fafc;
    --popover: #172036;
    --popover-foreground: #f8fafc;
    --primary: #f8fafc;
    --primary-foreground: #090d16;
    --secondary: #1e293b;
    --secondary-foreground: #f8fafc;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --accent: #334155;
    --accent-foreground: #f8fafc;
    --destructive: #f87171;
    --destructive-foreground: #090d16;
    --success: #34d399;
    --success-foreground: #090d16;
    --warning: #fbbf24;
    --warning-foreground: #090d16;
    --info: #60a5fa;
    --info-foreground: #090d16;
    --neutral: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --input: rgba(255, 255, 255, 0.14);
    --ring: #f8fafc;
    --chart-1: #f8fafc;
    --chart-2: #34d399;
    --chart-3: #60a5fa;
    --chart-4: #fbbf24;
    --chart-5: #f87171;
    --sidebar: #0f172a;
    --skeleton-base: #1e293b;
    --skeleton-highlight: #334155;
    --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-card: 0 4px 24px -2px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 12px 36px -4px rgba(0, 0, 0, 0.45);
    --shadow-popover: 0 24px 48px -8px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

/* ---------------------------------------------------------------- 全局滚动条美化 (浅灰色极简 Scrollbar) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.7);
  border-radius: 999px;
  transition: background-color 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.9);
}
::-webkit-scrollbar-corner {
  background: transparent;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(203, 213, 225, 0.7) transparent;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: var(--text-sm)/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.spacer { flex: 1; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- 登录 */
.login-mask {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--sidebar) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s var(--ease-out-smooth);
}
.login-card {
  width: 380px; padding: 36px 32px;
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-popover);
  display: flex; flex-direction: column; gap: 18px;
  transition: transform 0.25s var(--ease-out-smooth), box-shadow 0.25s var(--ease-out-smooth);
}
.login-card h1 { margin: 0; font-size: var(--text-xl); font-weight: 700; letter-spacing: -.03em; }
.login-sub { margin: -10px 0 4px; color: var(--muted-foreground); font-size: var(--text-xs); }
.login-card label {
  display: flex; flex-direction: column; gap: 7px;
  font-size: var(--text-xs); color: var(--muted-foreground); font-weight: 500;
}
.login-error { color: var(--destructive); font-size: var(--text-xs); white-space: pre-wrap; min-height: 18px; }

/* ---------------------------------------------------------------- 布局 */
.app { display: flex; flex-direction: column; height: 100vh; animation: fadeIn 0.35s var(--ease-out-smooth); }
.main {
  flex: 1; min-height: 0; padding: 24px;
  display: flex; flex-direction: column; gap: 18px; overflow: auto;
}

.section-head { display: flex; align-items: center; gap: 12px; flex: none; }
.section-head__title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -.03em; }
.section-head__sub { color: var(--muted-foreground); font-size: var(--text-xs); }
.section-head__actions { display: flex; align-items: center; gap: 8px; }

.top-row { display: flex; gap: 18px; align-items: stretch; flex: none; }
.cy-card { width: 280px; flex: none; align-self: flex-start; }
.mid-column { flex: 1; min-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.right-column { width: 390px; flex: none; display: flex; flex-direction: column; gap: 18px; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  transition: border-color 0.2s var(--ease-out-smooth), box-shadow 0.2s var(--ease-out-smooth), transform 0.2s var(--ease-out-smooth);
}
.card:hover {
  border-color: color-mix(in srgb, var(--border) 70%, var(--ring));
  box-shadow: var(--shadow-hover);
}
.tree-card, .chart-card { overflow: hidden; }

.card__header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px 14px;
}
.card__title {
  font-size: var(--text-base); font-weight: 600; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 8px;
}
.card__title::before {
  content: ""; display: inline-block; width: 3px; height: 14px;
  background: var(--primary); border-radius: 2px; opacity: 0.85;
}
.card__sub { font-size: var(--text-xs); color: var(--muted-foreground); font-family: var(--font-mono); }
.card__body { padding: 4px 22px 22px; display: flex; flex-direction: column; gap: 16px; }

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-col { display: flex; flex-direction: column; gap: 7px; }
.company-row { display: flex; align-items: center; gap: 10px; }
.company-row .btn { white-space: nowrap !important; flex: none; }
.qr-row { display: flex; align-items: center; gap: 12px; flex: none; }
.field__label { font-size: var(--text-xs); color: var(--muted-foreground); cursor: help; font-weight: 500; transition: color 0.15s ease; }
.field__label:hover { color: var(--foreground); }
.hint { margin-left: auto; font-size: var(--text-xs); color: var(--muted-foreground); font-family: var(--font-mono); }

/* ---------------------------------------------------------------- 控件 */
.input {
  height: 40px; padding: 0 14px; width: 100%;
  font: var(--text-xs)/1 var(--font-sans); color: var(--foreground);
  background: color-mix(in srgb, var(--background) 90%, var(--card));
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  transition: border-color .2s var(--ease-out-smooth), box-shadow .2s var(--ease-out-smooth), background-color .2s ease;
}
.input:hover:not(:disabled) { border-color: var(--ring); }
.input:focus {
  outline: none; border-color: var(--ring);
  background: var(--card);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 16%, transparent), 0 2px 4px rgba(0,0,0,0.04);
}
.input:disabled { background: var(--muted); color: var(--muted-foreground); cursor: not-allowed; opacity: 0.65; }
.input--mini { width: 68px; text-align: center; font-family: var(--font-mono); font-weight: 500; }
.select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
  appearance: none;
  -webkit-appearance: none;
}
.select--sm { width: 118px; }
.select--md { width: 250px; }

.template-wrap {
  position: relative;
}

.template-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.template-preview-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s var(--ease-out-smooth);
}
.template-preview-tag:hover {
  opacity: 1;
}

.template-preview-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 120;
  width: 410px;
  background: color-mix(in srgb, var(--popover) 98%, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 48px -10px rgba(16, 96, 220, 0.22), 0 8px 24px -6px rgba(0, 0, 0, 0.25);
  padding: 12px 14px 14px;
  animation: modalScaleIn 0.25s var(--ease-spring);
}

.preview-popover__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.preview-popover__title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--foreground);
}

.preview-popover__badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  color: var(--primary);
  font-weight: 600;
}

.preview-popover__body {
  width: 100%;
  height: 250px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.range-row { display: flex; align-items: center; gap: 10px; }
.range-row__sep { width: 18px; height: 2px; background: var(--border); border-radius: 1px; }

.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; cursor: pointer; border-radius: 999px;
  background: var(--secondary); border: 1px solid var(--border);
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.switch span::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted-foreground);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform .25s var(--ease-spring), background-color .2s ease;
}
.switch input:checked + span { background: var(--primary); border-color: var(--primary); }
.switch input:checked + span::before { transform: translateX(20px); background: var(--primary-foreground); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }

.textarea {
  flex: 1; min-height: 200px; padding: 16px 110px 16px 16px; resize: none; width: 100%;
  font: var(--text-xs)/1.8 var(--font-mono); color: var(--foreground);
  background: color-mix(in srgb, var(--background) 95%, var(--card));
  border: 1px solid var(--input);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  transition: border-color .2s var(--ease-out-smooth), box-shadow .2s var(--ease-out-smooth);
}
.textarea:focus {
  outline: none; border-color: var(--ring); background: var(--card);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 16%, transparent), 0 2px 6px rgba(0,0,0,0.04);
}
.textarea::placeholder { color: var(--muted-foreground); opacity: .75; }

.hint--floating {
  position: absolute;
  top: 20px;
  right: 20px;
  margin: 0;
  padding: 3px 10px;
  font-size: .85rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  pointer-events: none;
  user-select: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.numbers-row {
  display: flex;
  flex: 1;
  width: 100%;
}

.numbers-row .textarea-wrap {
  flex: 1;
  width: 100%;
  min-width: 0;
}

.queue-cards-col {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-card {
  flex: 1;
  min-height: 110px;
}
.queue-card .card__header {
  padding: 12px 16px 6px;
}
.queue-card .card__title {
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}
.queue-card .card__title::before { display: none; }
.queue-card .card__body {
  padding: 0 16px 12px;
  font-size: var(--text-xs);
  overflow: auto;
}

.history-card {
  margin-top: 4px;
}
.history-card .card__header {
  padding: 12px 16px 6px;
}
.history-card .card__title::before { display: none; }
.history-card .card__body {
  padding: 0 16px 12px;
  max-height: 270px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--background);
  transition: transform 0.15s var(--ease-out-smooth), border-color 0.15s ease, box-shadow 0.15s ease;
}
.history-item:hover {
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--border) 60%, var(--ring));
  box-shadow: var(--shadow-subtle);
}
.history-item:last-child {
  margin-bottom: 0;
}
.history-item__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-xs);
  min-width: 0;
  flex: 1;
}
.history-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  min-width: 0;
}
.history-item__title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item__meta {
  color: var(--muted-foreground);
  font-size: .85rem;
  font-family: var(--font-mono);
}

.textarea-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}
.textarea-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.textarea-footer .job-box {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  background: transparent;
  border: none !important;
  box-shadow: none !important;
}
.textarea-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; cursor: pointer;
  border-radius: var(--radius-md);
  background: var(--secondary); color: var(--secondary-foreground);
  border: 1px solid var(--border);
  font: 500 var(--text-xs)/1 var(--font-sans);
  box-shadow: var(--shadow-subtle);
  transition: transform .15s var(--ease-spring), background-color .15s ease, border-color .15s ease, opacity .15s ease, box-shadow .15s ease;
  user-select: none;
}
.btn:hover {
  background: var(--accent); color: var(--accent-foreground);
  border-color: color-mix(in srgb, var(--border) 50%, var(--ring));
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.btn:active {
  transform: scale(0.985) translateY(0);
}
.btn--primary {
  background: var(--primary); color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 25%, transparent);
}
.btn--primary:hover {
  background: var(--primary); color: var(--primary-foreground) !important; opacity: .92;
  border-color: var(--primary);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent);
}
.btn--primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--lg { height: 46px; font-size: var(--text-sm); font-weight: 600; width: 100%; }
.btn--ghost { background: transparent; color: var(--muted-foreground); border-color: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--accent); color: var(--accent-foreground); border-color: transparent; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: var(--text-xs); background: var(--secondary);
  color: var(--secondary-foreground); border: 1px solid var(--border);
  font-weight: 500;
  transition: background-color 0.15s ease, transform 0.15s var(--ease-out-smooth);
}
.chip--accent { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.chip--good { background: color-mix(in srgb, var(--success) 18%, var(--card)); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.chip--warn { background: color-mix(in srgb, var(--warning) 18%, var(--card)); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.chip--button { cursor: pointer; }
.chip--button:hover { background: var(--accent); color: var(--accent-foreground); transform: translateY(-1px); }

/* 处理方式 —— 悬浮 Popover 菜单 */
.modes-wrapper {
  position: relative;
  width: 100%;
}
.modes {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-popover);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transition: opacity .2s var(--ease-out-smooth), transform .2s var(--ease-out-smooth), visibility .2s ease;
  pointer-events: none;
}
.modes::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 14px;
}
.modes-wrapper:hover .modes,
.modes-wrapper .modes:hover,
.modes-wrapper:focus-within .modes {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.mode {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--background);
  transition: background-color .15s ease, border-color .15s ease, transform .15s var(--ease-out-smooth);
}
.mode:hover { background: var(--muted); border-color: color-mix(in srgb, var(--border) 60%, var(--ring)); transform: translateX(2px); }
.mode input { margin-top: 3px; accent-color: var(--primary); }
.mode span { display: flex; flex-direction: column; line-height: 1.45; }
.mode b { font-weight: 600; font-size: var(--text-xs); color: var(--foreground); }
.mode i { font-style: normal; font-size: var(--text-xs); color: var(--muted-foreground); opacity: .9; margin-top: 2px; }
.mode:has(input:checked) { border-color: var(--ring); background: color-mix(in srgb, var(--ring) 6%, var(--card)); }

/* ---------------------------------------------------------------- 上下游树 */
.tree-card { flex: 1; min-height: 240px; }
.tree { padding: 0 22px 18px; overflow: auto; font-size: var(--text-xs); }
.tree__group { margin-bottom: 14px; }
.tree__head {
  font-weight: 600; color: var(--muted-foreground); padding: 6px 0;
  font-size: var(--text-xs); letter-spacing: .06em; text-transform: uppercase;
}
.tree__item {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0 6px 14px; color: var(--foreground);
  border-left: 2px solid var(--border); margin-left: 2px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.tree__item:hover { border-left-color: var(--primary); background: color-mix(in srgb, var(--primary) 4%, transparent); }
.tree__item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree__amount { color: var(--muted-foreground); font-family: var(--font-mono); flex: none; }
.empty { color: var(--muted-foreground); padding: 28px 4px; text-align: center; font-size: var(--text-xs); }

/* ---------------------------------------------------------------- 任务状态 */
.op-card { flex: none; }
.job-box {
  font-size: var(--text-xs);
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .2s var(--ease-out-smooth);
}
.btn--sm {
  height: 30px; padding: 0 12px; font-size: var(--text-xs); border-radius: var(--radius-sm);
}

.job__idle { color: var(--muted-foreground); text-align: left; }
.job__line { display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.job__stage { color: var(--foreground); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bar {
  margin-top: 8px; height: 6px; border-radius: 999px; background: var(--muted);
  overflow: hidden; position: relative;
}
.bar > i {
  display: block; height: 100%; background: var(--primary);
  border-radius: 999px; transition: width .35s var(--ease-out-smooth);
  position: relative; overflow: hidden;
}
.bar > i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 1.8s infinite;
}

.job__msg { display: none !important; }
.state-done { color: var(--success); font-weight: 600; }
.state-error { color: var(--destructive); font-weight: 600; }

/* ---------------------------------------------------------------- 图表 */
.chart-card { flex: 1; min-height: 560px; }
.chart { flex: 1; min-height: 490px; }
.chart-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); font-size: var(--text-xs);
}

/* ---------------------------------------------------------------- 弹窗 */
.modal-backdrop, .drawer-mask {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--foreground) 40%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  animation: fadeIn 0.25s var(--ease-out-smooth);
}
.modal-backdrop { align-items: center; justify-content: center; }
.modal {
  width: 540px; max-width: 92vw;
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
  animation: modalScaleIn 0.3s var(--ease-spring);
}
.modal__head { padding: 24px 26px 12px; font-size: var(--text-lg); font-weight: 700; letter-spacing: -.025em; }
.modal__body {
  margin: 0; padding: 0 26px 20px; max-height: 50vh; overflow: auto;
  font: var(--text-xs)/1.8 var(--font-sans); white-space: pre-wrap; color: var(--muted-foreground);
}
.modal__foot {
  display: flex; gap: 12px; justify-content: flex-end;
  padding: 18px 26px; background: color-mix(in srgb, var(--muted) 80%, var(--card));
  border-top: 1px solid var(--border);
}

.drawer-mask { justify-content: flex-end; }
.drawer {
  width: 480px; max-width: 96vw;
  background: var(--sidebar); color: var(--foreground);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-popover);
  animation: drawerSlideIn 0.3s var(--ease-out-smooth);
}
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px; border-bottom: 1px solid var(--border);
  font-size: var(--text-base); font-weight: 700;
}
.drawer__body { padding: 10px 26px 30px; overflow: auto; }
.drawer__body h3 {
  font-size: var(--text-xs); color: var(--muted-foreground); font-weight: 600;
  margin: 24px 0 10px; letter-spacing: .06em; text-transform: uppercase;
}
.list { display: flex; flex-direction: column; gap: 10px; font-size: var(--text-xs); }
.list .row {
  padding: 12px 15px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--card);
  box-shadow: var(--shadow-subtle);
}
.list .meta { color: var(--muted-foreground); font-size: var(--text-xs); margin-top: 3px; opacity: .9; font-family: var(--font-mono); }
.list .empty { padding: 14px 0; text-align: left; }
.lvl-ok { color: var(--success); font-weight: 600; }
.lvl-warn { color: var(--warning); font-weight: 600; }
.lvl-error { color: var(--destructive); font-weight: 600; }

.sync-box { display: flex; flex-direction: column; gap: 12px; }
.sync-box__stat {
  display: flex; justify-content: space-between;
  font-size: var(--text-xs); color: var(--foreground); font-weight: 500;
}
.sync-box__warn {
  padding: 12px 14px; border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--warning) 16%, var(--card));
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--foreground); font-size: var(--text-xs);
  white-space: pre-wrap; max-height: 170px; overflow: auto;
}
.sync-box__check { display: flex; align-items: center; gap: 10px; font-size: var(--text-xs); color: var(--muted-foreground); cursor: pointer; }
.sync-box__check input { accent-color: var(--primary); }

/* ---------------------------------------------------------------- Toast (iOS 26+ Liquid Glass 流体玻璃胶囊风) */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 520px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--popover) 78%, var(--background));
  color: var(--foreground);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.18), 0 6px 16px -4px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  animation: liquidGlassDropIn 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.toast.toast--leaving {
  opacity: 0;
  transform: translate(-50%, -18px) scale(0.92);
}

.liquid-toast-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.liquid-toast-badge--info {
  background: color-mix(in srgb, var(--primary) 16%, var(--card));
  color: var(--primary);
}
.liquid-toast-badge--success {
  background: color-mix(in srgb, var(--success) 16%, var(--card));
  color: var(--success);
}
.liquid-toast-badge--warning {
  background: color-mix(in srgb, var(--warning) 16%, var(--card));
  color: var(--warning);
}
.liquid-toast-badge--error {
  background: color-mix(in srgb, var(--destructive) 16%, var(--card));
  color: var(--destructive);
}

.liquid-toast-text {
  flex: 1;
  color: var(--foreground);
}

.liquid-toast-close {
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  border: none;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  opacity: 0.65;
  transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.liquid-toast-close:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--muted) 100%, var(--card));
  color: var(--foreground);
  transform: scale(1.1);
}

@keyframes liquidGlassDropIn {
  from { opacity: 0; transform: translate(-50%, -24px) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* 动画定义 (Keyframe Animations) */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes drawerSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastDropIn {
  from { opacity: 0; transform: translate(-50%, -20px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}



/* 顶部状态按钮与队列弹窗网格 */
.btn--status-badge {
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  white-space: nowrap;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
}
.btn--status-badge:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseDotRing 1.8s infinite;
}

@keyframes pulseDotRing {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* 控制台全景双栏弹窗 (qiaomu-design 重构版) */
.modal--console {
  width: 860px;
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--popover) 98%, var(--background));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.3);
  box-shadow: 0 28px 72px -16px rgba(16, 96, 220, 0.22), 0 14px 36px -8px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  animation: modalScaleIn 0.3s var(--ease-spring);
}

.console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--popover) 85%, var(--card));
  flex: 0 0 auto;
}

.console-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.console-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--primary) 14%, var(--card));
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
}

.console-title-wrap h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

.console-sub {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

.console-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.console-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
}

.console-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0;
  height: 480px;
  max-height: calc(85vh - 80px);
  min-height: 320px;
  overflow: hidden;
  flex: 1 1 auto;
}

.console-col {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.console-col--live {
  background: color-mix(in srgb, var(--muted) 40%, var(--popover));
  border-right: 1px solid var(--border);
}

.console-col--history {
  background: var(--card);
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: color-mix(in srgb, var(--muted) 60%, var(--card));
  flex: 0 0 auto;
}

.col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--foreground);
}

.col-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted-foreground) 15%, var(--card));
  color: var(--muted-foreground);
  font-weight: 600;
}

.col-badge--live {
  background: color-mix(in srgb, var(--primary) 15%, var(--card));
  color: var(--primary);
}

.col-content {
  flex: 1 1 0%;
  padding: 16px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: 100%;
}

.pipeline-section {
  margin-bottom: 16px;
}
.pipeline-section:last-child {
  margin-bottom: 0;
}

.section-subhead {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-foreground);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

/* 本地图谱数据重建卡片 */
.status-indicator--rebuild {
  background: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.rebuild-status-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--card));
  color: var(--primary);
  font-weight: 600;
}

.rebuild-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rebuild-card__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
}

.rebuild-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rebuild-meta-label {
  color: var(--muted-foreground);
}

.rebuild-meta-val {
  color: var(--foreground);
  font-weight: 600;
  font-family: var(--font-mono);
}

.rebuild-btn {
  flex: none;
  font-size: 0.75rem;
  gap: 5px;
  padding: 6px 12px;
}

/* Watcher Live Log Feed (后台数据重建动态) */
.status-indicator--watcher {
  background: var(--info);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 20%, transparent);
}

.watcher-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watcher-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.76rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.watcher-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.watcher-tag-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.watcher-region-chip {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  color: var(--primary);
}

.watcher-level--ok {
  color: var(--success);
  font-weight: 600;
}
.watcher-level--warn {
  color: var(--warning);
  font-weight: 600;
}
.watcher-level--error {
  color: var(--destructive);
  font-weight: 600;
}
.watcher-level--info {
  color: var(--primary);
  font-weight: 600;
}

.watcher-time {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  opacity: 0.8;
}

.watcher-card__body {
  color: var(--foreground);
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
}

.history-archive-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 实时队列 Task Cards (qiaomu-design 重构版) */
.task-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: all 0.2s var(--ease-out-smooth);
}
.task-card:last-child {
  margin-bottom: 0;
}
.task-card--running {
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
  box-shadow: 0 4px 12px -2px rgba(16, 96, 220, 0.12);
}
.task-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.task-company {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--foreground);
}
.task-timer {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.task-pos {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--card));
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.task-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
}
.task-mode {
  color: var(--muted-foreground);
  font-weight: normal;
}
.task-stage {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}
.task-status {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.task-progress-line {
  height: 3px;
  width: 100%;
  background: var(--muted);
  border-radius: 999px;
  overflow: hidden;
}
.task-progress-line .progress-bar {
  height: 100%;
  width: 60%;
  background: var(--primary);
  border-radius: 999px;
  animation: shimmer 1.5s infinite linear;
}

/* 队列空状态 (Zero Whitespace Empty Box) */
.queue-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  color: var(--muted-foreground);
  font-size: var(--text-xs);
}
.queue-empty-box .empty-icon {
  opacity: 0.5;
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-indicator--running {
  background: var(--info);
  box-shadow: 0 0 8px var(--info);
}
.status-indicator--queued {
  background: var(--warning);
}

.history-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-close-btn {
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
}

/* 贸易线路同步弹窗 (无滚动条，紧凑优雅) */
.modal--sync {
  width: 540px;
  max-width: 94vw;
  background: color-mix(in srgb, var(--popover) 98%, var(--background));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.2);
  box-shadow: 0 24px 64px -12px rgba(16, 96, 220, 0.18), 0 12px 32px -8px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalScaleIn 0.3s var(--ease-spring);
}

.modal__head--sync {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--popover) 85%, var(--card));
}

.sync-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}

.sync-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

.sync-modal-header .sub {
  margin: 1px 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* 彻底隔离贸易线路同步弹窗，去除基础 .modal__body 继承干扰 */
.sync-modal-body {
  padding: 18px 20px;
  margin: 0 !important;
  max-height: 72vh !important;
  white-space: normal !important;
  color: var(--foreground) !important;
  font-size: var(--text-xs);
  overflow-y: auto !important;
}

.sync-section-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sync-subhead {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-foreground);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.sync-watcher-feed {
  max-height: 180px;
  overflow-y: auto;
}

.sync-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sync-stat-card {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sync-stat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-weight: 600;
}

.stat-title {
  color: var(--muted-foreground);
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.stat-dot--local { background: var(--primary); box-shadow: 0 0 6px var(--primary); }
.stat-dot--remote { background: var(--success); box-shadow: 0 0 6px var(--success); }

.sync-stat-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--foreground);
  font-family: var(--font-mono);
  line-height: 1.4;
}

.sync-alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--warning) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
  color: var(--foreground);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 90px;
  overflow-y: auto;
}

.sync-option-card {
  padding: 12px 14px;
  background: color-mix(in srgb, var(--muted) 50%, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.sync-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.sync-checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.sync-checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sync-checkbox-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--foreground);
}

.sync-checkbox-desc {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.modal__foot--sync {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--muted) 80%, var(--card));
  border-top: 1px solid var(--border);
}

@media (max-width: 1240px) {
  .top-row { flex-wrap: wrap; }
  .right-column, .cy-card { width: 100%; }
}

/* ---------------------------------------------------------------- 下载弹窗转圈圈 (qiaomu-design 动效版) */
.modal--download-loading {
  width: 420px;
  max-width: 90vw;
  background: color-mix(in srgb, var(--popover) 98%, var(--background));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.3);
  box-shadow: 0 24px 64px -12px rgba(16, 96, 220, 0.25), 0 12px 32px -8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalScaleIn 0.3s var(--ease-spring);
}

.download-loading-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 28px 28px;
  text-align: center;
}

.download-spinner-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

.download-spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3.5px solid color-mix(in srgb, var(--primary) 15%, transparent);
  border-top-color: var(--primary);
  border-right-color: color-mix(in srgb, var(--primary) 65%, transparent);
  animation: spinRing 0.85s infinite linear;
  box-shadow: 0 0 16px color-mix(in srgb, var(--primary) 20%, transparent);
}

.download-loading-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.download-loading-sub {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  margin-bottom: 20px;
  line-height: 1.5;
}

.download-progress-bar {
  width: 100%;
  height: 4px;
  background: color-mix(in srgb, var(--muted) 80%, transparent);
  border-radius: 999px;
  overflow: hidden;
}

.download-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: shimmer 1.4s infinite ease-in-out;
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

