:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --assistant-bg: #f8fafc;
  --user-bg: #2563eb;
  --user-text: #ffffff;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --info-bg: #eef2ff;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(1100px 480px at 50% -8%, #eef4ff 0%, rgba(238, 244, 255, 0) 60%),
    var(--bg);
}

/* 主内容列 */
.main-col {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ---------------- 首页模块入口 ---------------- */
.home-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  position: relative;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(147, 197, 253, 0.35), transparent),
    radial-gradient(ellipse 60% 40% at 85% 20%, rgba(167, 139, 250, 0.2), transparent),
    radial-gradient(ellipse 50% 35% at 50% 100%, rgba(251, 191, 36, 0.15), transparent),
    linear-gradient(165deg, #eff6ff 0%, #f8fafc 45%, #eef2ff 100%);
}

.home-portal-btn {
  position: absolute;
  top: 20px;
  left: 24px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.home-portal-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.14);
}

.home-portal-icon {
  flex-shrink: 0;
  color: #64748b;
}

.bi-back-home-btn {
  position: static;
  cursor: pointer;
  font-family: inherit;
}

.bi-back-home-btn:hover {
  color: #334155;
}

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 56px;
}

.home-hero {
  text-align: center;
  margin-bottom: 36px;
  max-width: 820px;
}

.home-slogan {
  margin: 0 0 14px;
  font-size: clamp(26px, 4.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.home-slogan-emoji {
  -webkit-text-fill-color: initial;
}

.home-slogan-text {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-sub {
  margin: 0 0 8px;
  font-size: clamp(13px, 2vw, 15px);
  color: #475569;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.home-hint {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1200px;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 18px;
  min-height: 200px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.home-card-tone-blue {
  background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 100%);
}

.home-card-tone-green {
  background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
}

.home-card-tone-purple {
  background: linear-gradient(145deg, #f5f3ff 0%, #ede9fe 100%);
}

.home-card-tone-orange {
  background: linear-gradient(145deg, #fff7ed 0%, #ffedd5 100%);
}

.home-card-live:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.2);
}

.home-card-soon:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}

.home-card-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 28px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.home-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.home-card-desc {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.45;
  flex: 1;
}

.home-card-note {
  font-size: 11.5px;
  line-height: 1.45;
  color: #047857;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(16, 185, 129, 0.22);
  margin: 0;
}

.home-card-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  overflow: hidden;
}

.home-stat-total {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}

.home-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: -0.02em;
}

.home-stat-unit {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
}

.home-stat-top5 {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.home-stat-top5 .coverage-label {
  flex-shrink: 0;
  line-height: 1;
}

.home-stat-top5 .coverage-chips {
  gap: 5px;
}

.home-stat-top5 .coverage-chip {
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-stat-top5 .coverage-chip-name {
  max-width: none;
}

.home-stat-top5 .coverage-chip-count {
  font-size: 10px;
}

.coverage-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.coverage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.coverage-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.3;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #334155;
}

.coverage-chip-name {
  font-weight: 600;
  max-width: 4.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coverage-chip-count {
  font-size: 10px;
  font-weight: 700;
  color: #2563eb;
}

.bi-module-coverage .coverage-chip-filter {
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.bi-module-coverage .coverage-chip-filter:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.bi-module-coverage .coverage-chip-filter.is-active {
  border-color: #3b82f6;
  background: #dbeafe;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.bi-module-coverage .coverage-chip-filter.is-active .coverage-chip-name {
  color: #1d4ed8;
}

.coverage-chip-more {
  color: #64748b;
  font-weight: 600;
  background: rgba(241, 245, 249, 0.9);
}

.home-card-action {
  margin-top: auto;
  padding-top: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #2563eb;
}

.home-card-badge {
  margin-top: auto;
  padding-top: 4px;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.7);
  color: #64748b;
}

/* 未上线模块占位页 */
.module-soon {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.module-soon-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

.module-soon-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}

.module-soon-head .home-portal-btn {
  position: static;
}

.module-soon-head .bi-back-home-btn {
  margin: 0;
}

.module-soon-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 16px;
}

.module-soon-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.module-soon-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.bi-head-btn-portal {
  text-decoration: none;
}

@media (max-width: 1099px) {
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 640px;
  }
}

@media (max-width: 720px) {
  .home-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
  }

  .home-main {
    padding: 28px 20px 40px;
  }

  .home-portal-btn {
    top: 16px;
    left: 16px;
  }

  .home-hero {
    margin-bottom: 24px;
  }

  .home-card {
    min-height: 0;
  }
}

/* ---------------- ChatBI 主工作区 ---------------- */
.bi-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(165deg, #eff6ff 0%, #f8fafc 45%, #eef2ff 100%);
}

.bi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  flex-shrink: 0;
  border-bottom: none;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
}

.bi-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.bi-head-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.bi-module-tag {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.bi-head-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 3px 8px;
  background: rgba(241, 245, 249, 0.9);
  border-radius: 6px;
  white-space: nowrap;
}

.cost-product-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: rgba(238, 242, 240, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  flex-shrink: 0;
}

.cost-product-tab {
  border: none;
  background: transparent;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.cost-product-tab:hover:not(.is-active) {
  color: #334155;
  background: rgba(255, 255, 255, 0.55);
}

.cost-product-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.cost-product-tab:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 1px;
}

@media (max-width: 720px) {
  .cost-product-tabs {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .cost-product-tabs::-webkit-scrollbar { display: none; }
  .cost-product-tab { padding: 5px 10px; font-size: 11px; }
}

.bi-module-coverage {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}

.bi-module-coverage .coverage-label {
  flex-shrink: 0;
}

.bi-module-coverage .coverage-chips {
  flex: 1;
  min-width: 0;
}

.bi-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bi-brand-logo {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  object-fit: cover;
  background: #0b1236;
  box-shadow: 0 2px 6px rgba(37, 46, 92, 0.24);
}

.bi-brand-titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
  min-width: 0;
}

.bi-brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--text);
  white-space: nowrap;
}

.bi-brand-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--primary);
  white-space: nowrap;
}

.bi-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.bi-head-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.bi-head-btn svg { flex-shrink: 0; color: var(--muted); }
.bi-head-btn:hover { background: var(--assistant-bg); border-color: #cbd5e1; }
.bi-head-btn:active { transform: translateY(1px); }

.bi-head-btn-home {
  background: #3b3d63;
  border-color: rgba(148, 163, 220, 0.35);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px rgba(30, 32, 60, 0.16);
}

.bi-head-btn-home svg { color: #fff; }
.bi-head-btn-home:hover {
  background: #45477a;
  border-color: rgba(148, 163, 220, 0.55);
}

.bi-canvas {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: transparent;
}

.bi-records-head {
  flex-shrink: 0;
  padding: 0;
  margin: 0 12px;
  border-bottom: none;
}

.bi-records-head .dv-filters-compact {
  margin-top: 4px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.bi-records-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
  margin: 8px 12px 0;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px 12px 0 0;
}

.bi-records-pager {
  flex-shrink: 0;
  padding: 6px 16px;
  margin: 0 12px 12px;
  border-radius: 0 0 12px 12px;
  background: #fafafa;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-top: 1px solid var(--border);
}

/* 紧凑单行筛选 */
.dv-filters-compact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f8fafc;
  flex-wrap: wrap;
}

.dv-filters-label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
}

.dv-filters-compact .dv-combo {
  position: relative;
  flex: 0 0 auto;
}

.dv-combo-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 10px 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  max-width: 100%;
}

.dv-combo-pill:hover {
  border-color: #93c5fd;
}

.dv-combo-pill.is-open {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.dv-combo-pill.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
}

.dv-combo-label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.dv-combo-pill.is-active .dv-combo-label {
  color: #1d4ed8;
}

.dv-combo-pill.is-active .dv-combo-label::after {
  content: "·";
  margin: 0 5px;
  font-weight: 500;
  color: #94a3b8;
}

.dv-combo-value {
  display: none;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  line-height: 1.3;
  padding: 6px 0;
}

/* 已选中且未编辑：span 展示完整值，隐藏 input */
.dv-combo-pill.is-active:not(.is-open):not(.is-editing) .dv-combo-value {
  display: inline;
}

.dv-combo-select .dv-combo-pill.is-active .dv-combo-value {
  display: inline;
}

.dv-combo:not(.dv-combo-select) .dv-combo-pill.is-active:not(.is-open):not(.is-editing) .dv-combo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dv-filters-compact .dv-combo-input {
  flex: 0 1 auto;
  width: auto;
  min-width: 3em;
  max-width: none;
  box-sizing: border-box;
  padding: 6px 0;
  border: none;
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  background: transparent;
  outline: none;
}

.dv-combo-pill.is-open .dv-combo-input,
.dv-combo-pill.is-editing .dv-combo-input {
  max-width: min(320px, 48vw);
}

.dv-filters-compact .dv-combo-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

.dv-combo-select .dv-combo-pill .dv-combo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dv-combo-chevron {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-left: 2px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.dv-combo-pill.is-open .dv-combo-chevron,
.dv-combo-pill.is-active .dv-combo-chevron {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.dv-combo-select .dv-combo-input {
  cursor: pointer;
  caret-color: transparent;
}

.dv-combo-option-clear .dv-combo-option-name {
  font-weight: 500;
  color: #64748b;
}

.dv-combo-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  min-width: 100%;
  width: max-content;
  max-width: min(260px, 72vw);
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 4px;
}

.dv-combo-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.dv-combo-option:hover,
.dv-combo-option:focus-visible {
  background: #eff6ff;
  outline: none;
}

.dv-combo-option-name {
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dv-combo-option-count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
}

.dv-combo-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: #94a3b8;
}

.dv-filter-clear {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.dv-filter-clear:hover {
  border-color: #fca5a5;
  color: #dc2626;
}

.dv-empty-hint {
  padding: 12px 16px;
  font-size: 13px;
}

/* 悬浮问数球 */
.chat-fab {
  position: absolute;
  right: 24px;
  bottom: 68px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.32);
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
}

.chat-fab:hover { background: var(--primary-hover); transform: translateY(-1px); }
.chat-fab:active { transform: translateY(1px); }
.chat-fab.active { background: #1e293b; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28); }
.chat-fab-label { white-space: nowrap; }

/* 问数浮层 */
.chat-panel {
  position: absolute;
  right: 24px;
  bottom: 124px;
  z-index: 70;
  width: 480px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 152px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}

.chat-panel-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.chat-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.chat-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chat-icon-btn:hover {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.chat-history-wrap { position: relative; }

.chat-history-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  width: 260px;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.chat-history-empty {
  padding: 12px 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.chat-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.chat-empty {
  margin: auto 0;
  padding: 8px 4px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

.chat-panel-foot {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.bi-quick-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bi-quick-chips::-webkit-scrollbar { display: none; }

.bi-quick-chip {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bi-quick-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.bi-composer-slot {
  flex-shrink: 0;
}

.composer-bi {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  width: 100%;
}

.composer-bi:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.composer-bi textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  max-height: 100px;
  background: transparent;
  font-family: inherit;
  min-height: 24px;
}

.composer-bi .composer-bar {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.chat-panel-body .msg,
.chat-panel-body .message {
  display: flex;
  width: 100%;
  max-width: 100%;
}

.chat-panel-body .msg.user,
.chat-panel-body .message.user {
  flex-direction: row-reverse;
}

.chat-panel-body .msg.user .bubble,
.chat-panel-body .message.user .bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-color: var(--primary);
  flex: 0 1 auto;
  max-width: 88%;
}

.chat-panel-body .msg.assistant .bubble,
.chat-panel-body .message.assistant .bubble {
  flex: 1;
  max-width: 100%;
}

/* 管理页 */
.dv-admin-body {
  padding: 16px 24px 32px;
  overflow-y: auto;
  flex: 1;
}

.dv-admin-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.dv-admin-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dv-admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.dv-admin-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dv-admin-item-main span {
  font-size: 12px;
  color: var(--muted);
}

.data-view-admin .dv-body { display: none; }

.status-pill {
  font-size: 12px;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}
.status-pill.ok { color: var(--success); border-color: #bbf7d0; background: var(--success-bg); }
.status-pill.warn { color: var(--warning); border-color: #fde68a; background: var(--warning-bg); }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.ghost-btn svg { color: var(--muted); }
.ghost-btn:hover { background: var(--assistant-bg); border-color: #cbd5e1; }
.ghost-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.ghost-btn[hidden] { display: none; }

/* ---------------- 欢迎态 ---------------- */
.welcome {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 32px 24px 48px;
}
.app[data-state="chat"] .welcome { display: none; }
.welcome-inner {
  width: 100%;
  max-width: 760px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.welcome-hero {
  text-align: center;
  margin-bottom: 22px;
}
.welcome-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, #1e3a8a, #2563eb 55%, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

/* 推荐问 3×2 网格 */
.welcome-suggest {
  width: 100%;
  margin-top: 28px;
  text-align: center;
}
.welcome-suggest-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.welcome-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 12px;
  width: 100%;
}
.welcome-chip {
  width: 100%;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.welcome-chip:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.16);
}
.welcome-chip:active {
  transform: translateY(0);
  box-shadow: none;
}

/* 数据摘要条 */
.welcome-meta {
  width: 100%;
  margin-top: 24px;
}
.welcome-meta:empty { display: none; }
.welcome-meta-card {
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.welcome-meta-empty {
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
.welcome-stat {
  flex-shrink: 0;
  text-align: center;
  min-width: 88px;
  padding-right: 28px;
  border-right: 1px solid #e2e8f0;
}
.welcome-stat-num {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.welcome-stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.welcome-types {
  flex: 1;
  min-width: 0;
}
.welcome-types-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 10px;
  text-align: left;
}
.welcome-types-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.welcome-type-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.welcome-type-name {
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.welcome-type-count {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.data-banner {
  margin-top: 14px;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--info-bg);
  border: 1px solid #c7d2fe;
  color: #3730a3;
  font-size: 13px;
}
.data-banner:empty { display: none; }
.data-banner b { font-weight: 700; }

/* ---------------- 数据卡片 ---------------- */
.overview {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 36px;
}
.ov-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ov-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.ov-ico { font-size: 15px; }
.ov-body { display: flex; flex-direction: column; gap: 2px; }
.ov-skeleton { color: var(--muted); font-size: 13px; }
.ov-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}
.ov-item:hover { background: var(--assistant-bg); }
.ov-item .ov-label {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ov-item .ov-sub { color: var(--muted); font-size: 12px; flex-shrink: 0; }
/* 最近记录：来源小徽章（采购价 / 国际站报价） */
.ov-src {
  display: inline-block;
  padding: 0 6px;
  margin-right: 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.ov-src.deal { background: #dbeafe; color: #1d4ed8; }
.ov-src.intl { background: #f3e8ff; color: #7c3aed; }
/* 提问示例：长句允许换行，右侧箭头提示可点击 */
.ov-item.ov-ex { align-items: center; }
.ov-item.ov-ex .ov-label { white-space: normal; overflow: visible; line-height: 1.45; }
.ov-item.ov-ex .ov-sub { color: var(--primary); font-size: 13px; }

/* ---------------- 对话态 ---------------- */
.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.app[data-state="welcome"] .chat { display: none; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.message.user {
  flex-direction: row-reverse;
}

.message.assistant {
  width: 100%;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.message.user .avatar {
  background: var(--primary);
  color: white;
}

.bubble {
  background: var(--assistant-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  line-height: 1.65;
  font-size: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
  flex: 1;
}

.message.user .bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-color: var(--primary);
  flex: 0 1 auto;
}

/* 对话气泡：决策区 → AI 正文 → 引用卡片 */
.decision-slot:empty { display: none; }
.decision-slot .quote-card { margin-bottom: 0; }
.decision-slot:not(:empty) + .answer { margin-top: 10px; }
.answer.answer-streaming {
  min-height: 2.5em;
  color: var(--muted);
}
.results-pending {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px dashed #e2e8f0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* Markdown 渲染样式 */
.md p {
  margin-bottom: 8px;
}
.md p:last-child {
  margin-bottom: 0;
}
.md h1, .md h2, .md h3 {
  font-size: 15px;
  margin: 10px 0 6px;
}
.md ul, .md ol {
  margin: 6px 0 10px;
  padding-left: 22px;
}
.md li {
  margin-bottom: 4px;
}
.md strong {
  font-weight: 700;
}
.md code {
  background: rgba(15, 23, 42, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.md blockquote {
  border-left: 3px solid var(--warning);
  background: var(--warning-bg);
  padding: 6px 12px;
  margin: 8px 0;
  border-radius: 0 6px 6px 0;
  color: #92400e;
  font-size: 13px;
}

/* 国际站维度解读：分层更清晰 */
.md.intl-analysis {
  font-size: 14px;
  line-height: 1.65;
}
.md.intl-analysis h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.md.intl-analysis h3:first-child {
  margin-top: 0;
}
.md.intl-analysis ul {
  margin: 4px 0 12px;
  padding-left: 20px;
}
.md.intl-analysis li {
  margin-bottom: 6px;
}
.md.intl-analysis p {
  margin-bottom: 10px;
}
.md.intl-analysis strong {
  font-weight: 600;
}

.md table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 13px;
}
.md th, .md td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.md th {
  background: var(--assistant-bg);
}
.md .cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--primary);
  color: #fff;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: baseline;
  transform: translateY(-1px);
}

.hint {
  color: var(--muted);
  font-size: 13px;
}
.message.user .hint,
.message.user em {
  color: rgba(255, 255, 255, 0.85);
}
em {
  color: var(--muted);
  font-style: normal;
}

/* 结果区块 */
.results-block {
  margin-top: 14px;
}

/* 报价结论卡：让后端算好的建议报价/毛利一眼可见 */
.quote-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 0;
  padding: 14px 16px;
  border: 1px solid #c7d7fe;
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: linear-gradient(180deg, #f5f8ff 0%, #eef3ff 100%);
}
.quote-card .qc-body {
  min-width: 0;
}
.quote-card .qc-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.quote-card .qc-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.quote-card .qc-fx {
  font-size: 11px;
  color: var(--muted);
}
.quote-card .qc-price {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}
.quote-card .qc-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
/* 历史价格参考卡：每个来源一行（标签 · 区间 · 条数/时效） */
.quote-card .qc-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
}
.quote-card .qc-row-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 76px;
}
.quote-card .qc-row-price {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}
.quote-card .qc-row-meta {
  font-size: 12px;
  color: var(--muted);
}
.quote-card .qc-margin {
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
}
.quote-card .qc-margin.ok { color: #047857; background: #d1fae5; }
.quote-card .qc-margin.warn { color: #b45309; background: #fef3c7; }
.quote-card .qc-margin.neg { color: #b91c1c; background: #fee2e2; }
.quote-card .qc-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: start;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.quote-card .qc-copy:hover { background: var(--primary-hover); }
.quote-card .qc-copy.done { background: #059669; }
.quote-card .qc-note {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
}
@media (max-width: 640px) {
  .quote-card { grid-template-columns: 1fr; }
  .quote-card .qc-copy { justify-self: start; }
}

/* 品类分布卡：全库盘点类问题 */
.overview-card {
  margin-bottom: 0;
  padding: 14px 16px;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #059669;
  border-radius: 12px;
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
}
.overview-card .ovc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.overview-card .ovc-label {
  font-size: 12px;
  font-weight: 600;
  color: #047857;
  letter-spacing: 0.5px;
}
.overview-card .ovc-total {
  font-size: 12px;
  color: var(--muted);
}
.overview-card .ovc-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.overview-card .ovc-col-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.overview-card .ovc-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed #d1fae5;
  font-size: 13px;
}
.overview-card .ovc-row:last-child { border-bottom: none; }
.overview-card .ovc-name {
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}
.overview-card .ovc-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.overview-card .ovc-spec {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.overview-card .ovc-empty,
.overview-card .ovc-more {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}
.overview-card .ovc-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
@media (max-width: 640px) {
  .overview-card .ovc-columns { grid-template-columns: 1fr; }
}
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.results-head h4 {
  font-size: 13px;
  color: var(--muted);
}
.results-actions {
  display: flex;
  gap: 8px;
}
.mini-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.mini-btn:hover {
  background: var(--assistant-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.more-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: var(--panel);
  border: 1px dashed var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.more-btn:hover {
  background: var(--assistant-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.cap-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.board-expand-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--assistant-bg);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.board-expand-btn:hover {
  background: #eff6ff;
  border-color: var(--primary);
}

.results-block.board-collapsed .cards-view .result-card:not(:first-child) {
  display: none !important;
}

.rh-shown { color: var(--muted); font-weight: 400; }

/* 比价表：最低价高亮 */
.compare-table th[data-sort] { cursor: pointer; user-select: none; }
.compare-table tr.cheapest-row { background: var(--success-bg); }
.compare-table .cheap-tag {
  display: inline-block;
  background: var(--success);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 4px;
  margin-right: 4px;
}
.compare-table .c-spec {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

.weak-banner {
  background: var(--warning-bg);
  color: #92400e;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

/* 供应商卡片 */
.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.result-card:hover { border-color: #cbd5e1; }
.result-card.top { border-color: var(--primary); }

/* 紧凑行（默认展示） */
.rc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
}
.rc-row:hover { background: var(--assistant-bg); }
.result-card.top .rc-row { background: linear-gradient(90deg, #f5f8ff, #ffffff); }
.rc-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
/* 卡片正文：两行（标题行 + 关键规格行），占据中间弹性空间 */
.rc-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rc-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rc-facemeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}
.rc-fm { white-space: nowrap; }
.rc-date { white-space: nowrap; }
.rc-date.stale { color: #b45309; }
.rc-kv {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.rc-supplier {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
  flex-shrink: 0;
}
.rc-supplier:hover { color: var(--primary); text-decoration: underline; }
.rc-sales {
  font-weight: 700;
  font-size: 14px;
  color: #7c3aed;
  white-space: nowrap;
  flex-shrink: 0;
}
.rc-buyer {
  color: var(--muted);
  font-size: 13px;
  max-width: 34%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.source-badge.deal { background: #dbeafe; color: #1d4ed8; }
.source-badge.intl { background: #f3e8ff; color: #7c3aed; }
.rc-match {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  cursor: help;
}
.rc-match.mb-high { background: #d1fae5; color: #047857; }
.rc-match.mb-mid { background: #fef3c7; color: #b45309; }
.rc-match.mb-low { background: #f1f5f9; color: #64748b; }
/* 同规格多价合并标记 */
.rc-dup {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  background: #ede9fe;
  color: #6d28d9;
  cursor: help;
}
.trend-series { margin-bottom: 12px; }
.trend-series-head { margin-bottom: 6px; }
.c-src { width: 72px; }
.rc-product {
  color: var(--muted);
  font-size: 13px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge.top,
.badge.rel { background: var(--primary); color: #fff; }
.badge.cheap { background: var(--success); color: #fff; }
.rc-tier {
  background: var(--info-bg);
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
}
.rc-conf-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  color: #fff;
  white-space: nowrap;
}
.rc-conf-badge.high { background: var(--success); }
.rc-conf-badge.medium { background: var(--warning); }
.rc-conf-badge.low { background: #94a3b8; }
.rc-price {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  min-width: 96px;
  justify-content: flex-end;
}
.rc-price .num { font-size: 16px; font-weight: 800; color: var(--text); }
.rc-price .unit { font-size: 11px; color: var(--muted); }
.rc-chevron {
  color: var(--muted);
  display: inline-flex;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.result-card.open .rc-chevron { transform: rotate(180deg); }

/* 展开详情 */
.rc-detail {
  padding: 2px 12px 11px 42px;
  font-size: 12px;
  color: var(--muted);
}
.rc-detail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 8px;
}
.rc-detail-grid b { color: var(--text); font-weight: 700; }
.rc-spec {
  background: var(--assistant-bg);
  border-radius: 8px;
  padding: 7px 10px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 8px;
}
.rc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.spec-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.spec-tag.match {
  background: var(--success-bg);
  color: #166534;
  border-color: #bbf7d0;
}
.spec-tag.diff {
  background: var(--warning-bg);
  color: #92400e;
  border-color: #fde68a;
}
.spec-tag.info {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}
.rc-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 比价表 */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.compare-table th, .compare-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.compare-table th {
  background: var(--assistant-bg);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.compare-table th:hover { color: var(--primary); }
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td.price { font-weight: 700; }
.compare-table .cheapest { color: var(--success); }

/* 列表视图（默认）：以报价为核心，突出单价 / 匹配度 / 新鲜度 */
.list-view { margin-top: 6px; }
.list-table { table-layout: auto; }
.list-table th.c-idx, .list-table td.c-idx { width: 28px; color: var(--muted); }
.list-table .lnk {
  cursor: pointer;
  color: var(--text);
}
.list-table .c-sup .lnk { font-weight: 700; }
.list-table .lnk:hover { color: var(--primary); text-decoration: underline; }
.list-table .c-item { max-width: 240px; }
.list-table .item-name { font-weight: 600; }
.list-table .c-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
/* 单价：视觉主角 */
.list-table td.price { white-space: nowrap; }
.list-table .pnum { font-size: 15px; font-weight: 800; color: var(--text); }
.list-table .punit { font-size: 11px; color: var(--muted); font-weight: 400; }
.list-table .cheapest-row .pnum { color: #166534; }
/* 价格新鲜度 */
.fresh-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  background: #cbd5e1;
  vertical-align: middle;
}
.fresh-dot.f-new { background: var(--success); }
.fresh-dot.f-mid { background: #3b82f6; }
.fresh-dot.f-old { background: #f59e0b; }
.fresh-lb { margin-left: 5px; font-size: 10px; padding: 0 4px; border-radius: 4px; }
.fresh-lb.f-new { background: var(--success-bg); color: #166534; }
.fresh-lb.f-mid { background: #eff6ff; color: #1d4ed8; }
.fresh-lb.f-old { background: var(--warning-bg); color: #92400e; }
/* 匹配度进度条 */
.c-match { white-space: nowrap; }
.c-match .mbar {
  display: inline-block;
  width: 56px;
  height: 6px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}
.c-match .mbar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #94a3b8;
}
.c-match .mbar i.lvl-high { background: var(--success); }
.c-match .mbar i.lvl-medium { background: var(--warning); }
.c-match .mbar i.lvl-low { background: #94a3b8; }
.c-match .mpct { font-size: 11px; color: var(--muted); }

/* 趋势图 */
.trend-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 6px;
}
.trend-wrap svg { display: block; width: 100%; height: auto; }

/* 快捷追问 */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.suggestion-chip {
  background: var(--info-bg);
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.suggestion-chip:hover {
  background: #e0e7ff;
}

/* 补全要素引导卡：品名宽泛时提示按品类补关键规格 */
.refine-card {
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  background: #f7f9ff;
}
.decision-slot .quote-card + .refine-card { margin-top: 8px; }
.refine-head {
  font-size: 12.5px;
  color: #4338ca;
  font-weight: 600;
  margin-bottom: 8px;
}
.refine-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.refine-chip {
  background: #fff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.refine-chip:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
}

/* loading */
.loading-dots::after {
  content: "...";
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
.cursor-blink::after {
  content: "▋";
  animation: blink 1s step-start infinite;
  color: var(--primary);
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------------- 输入器（两态共用） ---------------- */
.composer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px 10px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-mode {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.mode-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mode-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.mode-btn.active {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}
.mode-btn[data-mode="intl"].active {
  background: #f5f3ff;
  border-color: #7c3aed;
  color: #7c3aed;
}
.composer:focus-within {
  border-color: var(--primary);
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.14);
}

/* 结构化查询（欢迎页展开，对话页隐藏） */
.composer-structured {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef2f7;
}
.chat-composer-slot .composer-structured { display: none; }
.chat-composer-slot .struct-free-label { display: none; }
.struct-section { display: flex; flex-direction: column; gap: 8px; }
.struct-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.struct-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.struct-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.3;
}
.struct-tag-required {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.struct-tag-optional {
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.struct-free-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.struct-foot {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
}
.cat-count-hint {
  font-size: 12px;
  color: #2563eb;
  font-weight: 500;
  padding-left: 2px;
}
.cat-top5 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-chip {
  border: 1px solid #93c5fd;
  background: #f8fbff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cat-chip:hover { background: #eff6ff; border-color: #3b82f6; }
.cat-chip.active {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1e40af;
  font-weight: 600;
}
.cat-search-wrap { position: relative; }
.struct-input,
.struct-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}
.struct-input:focus,
.struct-select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.struct-attrs-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.75fr;
  gap: 8px;
}
.struct-input-sm { min-width: 0; }
.composer textarea {
  width: 100%;
  resize: none;
  border: none;
  background: transparent;
  padding: 4px 4px 2px;
  font-size: 15px;
  line-height: 1.5;
  font-family: inherit;
  outline: none;
  color: var(--text);
  max-height: 180px;
}
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 6px;
}
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:hover:not(:disabled) { background: var(--primary-hover); }
.send-btn:active:not(:disabled) { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.stop-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 8px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.stop-btn:hover { background: #f1f5f9; color: #ef4444; }
.stop-btn:active { transform: scale(0.94); }

/* display:flex 会盖掉 hidden 属性，这里显式恢复隐藏语义 */
.send-btn[hidden], .stop-btn[hidden] { display: none; }

.retry-btn {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--info-bg);
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.retry-btn:hover { background: #e0e7ff; }

/* 欢迎态：大输入框居中 */
.welcome-composer-slot {
  width: 100%;
  max-width: 760px;
}
.welcome-composer-slot .composer {
  border-radius: 18px;
  padding: 16px 18px 12px;
  width: 100%;
}
.welcome-composer-slot .composer textarea {
  font-size: 15px;
  min-height: 24px;
}

/* 对话态：输入框置底、居中限宽 */
.chat-composer-slot {
  flex-shrink: 0;
  padding: 8px 24px 22px;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, rgba(244, 246, 249, 0), var(--bg) 40%);
}
.chat-composer-slot .composer {
  width: 100%;
  max-width: 820px;
}

/* 历史对话抽屉 */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 60;
  display: flex;
}
.drawer-overlay[hidden] { display: none; }
.drawer {
  width: min(340px, 86vw);
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 30px rgba(15, 23, 42, 0.18);
  animation: drawerIn 0.2s ease;
}
@keyframes drawerIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-header h3 { font-size: 15px; }
.drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.drawer-close:hover { color: var(--text); }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
.hist-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
}
/* 数据管理（全宽数据页） */
.data-view {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.data-view[hidden] { display: none !important; }

.dv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.dv-head-left { min-width: 0; }
.dv-title-main {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.dv-head-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.dv-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.dv-close svg { flex-shrink: 0; }
.dv-close:hover {
  color: var(--text);
  border-color: #cbd5e1;
  background: var(--assistant-bg);
}

/* 工具栏：卡片 Tab + 上传 */
.dv-toolbar {
  padding: 10px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dv-toolbar .dv-overview-strip {
  margin-bottom: 0;
}
.dv-upload-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dv-category-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dv-cat-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 12px;
  row-gap: 4px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  min-width: 0;
  width: 100%;
  user-select: none;
  outline: none;
}
.dv-cat-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.dv-cat-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.dv-cat-card.deal.active {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%);
  box-shadow: 0 0 0 1px #86efac, 0 4px 14px rgba(5, 150, 105, 0.1);
}
.dv-cat-card.intl.active {
  border-color: #c4b5fd;
  background: linear-gradient(180deg, #f5f3ff 0%, #fff 100%);
  box-shadow: 0 0 0 1px #c4b5fd, 0 4px 14px rgba(124, 58, 237, 0.1);
}
.dv-cat-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-size: 22px;
  line-height: 1;
  margin-top: 2px;
}
.dv-cat-body {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dv-cat-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.dv-cat-desc {
  font-size: 12px;
  color: var(--muted);
}
.dv-cat-stat {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--assistant-bg);
  color: var(--muted);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dv-cat-card.deal.active .dv-cat-stat {
  background: #dcfce7;
  color: #047857;
}
.dv-cat-card.intl.active .dv-cat-stat {
  background: #ede9fe;
  color: #6d28d9;
}

/* 上传：默认折叠 */
.dv-upload-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.dv-upload-wrap.busy { opacity: 0.65; pointer-events: none; }
.dv-upload-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.dv-upload-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.dv-upload-trigger:hover { background: var(--primary-hover); }
.dv-upload-trigger svg { flex-shrink: 0; }
.dv-upload-bar-hint {
  flex: 1;
  min-width: 140px;
  font-size: 12px;
  color: var(--muted);
}
.dv-upload-toggle {
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.dv-upload-toggle:hover { color: var(--text); border-color: #cbd5e1; }
.dv-upload-panel {
  display: none;
  border-top: 1px dashed var(--border);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dv-upload-wrap.expanded .dv-upload-panel { display: block; }
.dv-upload-wrap.expanded .dv-upload-toggle::after { content: ""; }
.dv-upload-wrap.dragover .dv-upload-panel {
  background: var(--info-bg);
  border-top-color: var(--primary);
}
.dv-upload-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--primary);
}
.dv-upload-text { display: flex; flex-direction: column; gap: 2px; }
.dv-upload-title { font-size: 14px; font-weight: 600; color: var(--text); }
.dv-upload-hint { font-size: 12px; color: var(--muted); }
.upload-status {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--assistant-bg);
  color: var(--text);
}
.upload-status[hidden] { display: none; }
.upload-status.ok { background: #dcfce7; color: #166534; }
.upload-status.warn { background: var(--warning-bg); color: var(--warning); }
.upload-status.err { background: #fee2e2; color: var(--danger); }
.up-prog-label { margin-bottom: 6px; }
.up-prog-track {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.up-prog-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.up-prog-fill.indeterminate { animation: up-prog-pulse 1s ease-in-out infinite; }
@keyframes up-prog-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.dv-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 24px 16px;
  overflow: hidden;
}
.dv-batches {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dv-batches-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.dv-batches-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.dv-source-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.dv-source-pill.deal { background: #dbeafe; color: #1d4ed8; }
.dv-source-pill.intl { background: #f3e8ff; color: #7c3aed; }
.batch-total { font-size: 12px; color: var(--muted); font-weight: 400; flex-shrink: 0; }
.batch-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.batch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
}
.batch-item:hover { background: var(--assistant-bg); }
.data-view[data-category="供应商成交价格"] .batch-item.active {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: #059669;
}
.data-view[data-category="国际站历史业务员报价"] .batch-item.active {
  background: #f5f3ff;
  border-color: #ddd6fe;
  border-left-color: #7c3aed;
}
.batch-main { flex: 1; min-width: 0; }
.batch-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.batch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.batch-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.batch-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--assistant-bg);
  color: var(--muted);
}
.batch-badge.success { background: #dcfce7; color: #166534; }
.batch-badge.failed { background: #fee2e2; color: var(--danger); }
.batch-badge.no_new, .batch-badge.duplicate_file { background: var(--warning-bg); color: var(--warning); }
.batch-badge.processing, .batch-badge.pending { background: #dbeafe; color: #1e40af; }
.batch-del {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.batch-item:hover .batch-del { opacity: 1; }
.batch-del:hover { background: #fee2e2; color: var(--danger); border-color: #fecaca; }

.dv-records {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.bi-records-head,
.dv-records-head {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.bi-records-body,
.dv-records-body { flex: 1; overflow: auto; min-height: 200px; }
.dv-load-error { padding: 8px 14px 0; font-size: 13px; }
.bi-records-pager,
.dv-records-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  flex-shrink: 0;
}
.dv-pager-left,
.dv-pager-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dv-pager-left label,
.dv-pager-info {
  font-size: 12px;
  color: var(--muted);
}
.dv-pager-left select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.dv-records-table-wrap {
  overflow: visible;
}

.dv-records-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
  table-layout: fixed;
}

.dv-records-table th,
.dv-records-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

.dv-records-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dv-records-table tbody td {
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12px;
}

.dv-records-table tbody td.col-type {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dv-records-table tbody td.col-num,
.dv-records-table tbody td.col-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dv-records-table tbody td.col-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dv-records-table tbody td.col-spec {
  white-space: normal;
  overflow: visible;
  vertical-align: top;
}

.dv-records-table tbody tr.click-row:hover td {
  background: #f8fafc;
}

.dv-records-table th.col-actions,
.dv-records-table td.col-actions {
  text-align: left;
  white-space: nowrap;
}

.dv-row-quote-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  background: var(--primary, #2563eb);
  color: #fff;
  cursor: pointer;
  line-height: 1.3;
  white-space: nowrap;
}

.dv-row-quote-btn:hover:not(:disabled) {
  background: var(--primary-hover, #1d4ed8);
}

.dv-row-quote-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.dv-records-table tbody tr.click-row:hover .dv-row-quote-btn {
  background: var(--primary-hover, #1d4ed8);
}

.dr-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.dr-quote-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  background: var(--accent, #2563eb);
  color: #fff;
  cursor: pointer;
}

.dr-quote-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.dr-quote-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.dv-spec-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dv-spec-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #334155;
  word-break: break-word;
  white-space: normal;
}

.dv-spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.dv-attr-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
  white-space: normal;
}

.dv-attr-chip-label {
  flex-shrink: 0;
  font-weight: 600;
}

.dv-attr-chip-val {
  font-weight: 400;
}

.dv-attr-chip-material {
  background: #fef3c7;
}
.dv-attr-chip-material .dv-attr-chip-label { color: #b45309; }
.dv-attr-chip-material .dv-attr-chip-val { color: #92400e; }

.dv-attr-chip-size {
  background: #dbeafe;
}
.dv-attr-chip-size .dv-attr-chip-label { color: #1d4ed8; }
.dv-attr-chip-size .dv-attr-chip-val { color: #1e3a8a; }

.dv-attr-chip-color {
  background: #ede9fe;
}
.dv-attr-chip-color .dv-attr-chip-label { color: #6d28d9; }
.dv-attr-chip-color .dv-attr-chip-val { color: #5b21b6; }

.dv-attr-chip-craft {
  background: #dcfce7;
}
.dv-attr-chip-craft .dv-attr-chip-label { color: #15803d; }
.dv-attr-chip-craft .dv-attr-chip-val { color: #166534; }

.dv-records-table .click-row {
  cursor: pointer;
}

.dv-placeholder { padding: 40px 16px; text-align: center; }

/* 固定表格布局：各列按 colgroup 定宽，内容溢出省略，保证一屏不横滚 */
.records-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.records-table col.col-name { width: 15%; }
.records-table col.col-spec { width: 33%; }
.records-table col.col-supplier { width: 20%; }
.records-table col.col-price { width: 10%; }
.records-table col.col-unit { width: 7%; }
.records-table col.col-qty { width: 8%; }
.records-table col.col-date { width: 7%; }
.records-table th,
.records-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.records-table thead th {
  position: sticky;
  top: 0;
  background: var(--assistant-bg);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.records-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
}
.records-table tbody tr { cursor: pointer; transition: background 0.12s; }
.records-table tbody tr:hover { background: var(--info-bg); }
.records-table .c-num { text-align: right; font-variant-numeric: tabular-nums; }
.records-table .c-name { font-weight: 600; }
.records-table .c-spec { color: var(--muted); }
.records-table .c-date, .records-table .c-unit { color: var(--muted); }

/* 记录详情侧滑 */
.record-detail-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  justify-content: flex-end;
  z-index: 5;
}
.record-detail-overlay[hidden] { display: none; }
.record-detail {
  width: min(420px, 92vw);
  height: 100%;
  background: #fff;
  box-shadow: -6px 0 30px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.rd-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
}
.rd-title { font-size: 16px; font-weight: 700; color: var(--text); }
.rd-price { font-size: 20px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.rd-price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.rd-close { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.rd-close:hover { color: var(--text); }
.rd-groups { padding: 8px 20px 24px; }
.rd-group { padding: 14px 0; border-bottom: 1px solid #f1f5f9; }
.rd-group:last-child { border-bottom: none; }
.rd-group h5 { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; text-transform: none; }
.rd-field { display: flex; gap: 12px; padding: 4px 0; font-size: 13.5px; }
.rd-label { flex: 0 0 72px; color: var(--muted); }
.rd-label-wide { flex: 0 0 110px; }
.rd-value { flex: 1; color: var(--text); word-break: break-word; }

@media (max-width: 720px) {
  .dv-body { padding: 8px 12px 12px; }
  .dv-records-pager { flex-direction: column; align-items: stretch; }
  .dv-category-cards { grid-template-columns: 1fr; }
  .dv-cat-card {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .dv-cat-stat {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    margin-top: 4px;
  }
  .dv-cat-body { grid-row: 1; }
  .dv-cat-icon { grid-row: 1; }
  .dv-upload-bar-hint { width: 100%; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 14px;
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
}

@media (max-width: 760px) {
  .welcome { padding: 64px 14px 32px; }
  .welcome-title { font-size: 28px; }
  .welcome-chips { grid-template-columns: repeat(2, 1fr); }
  .welcome-chip { font-size: 13px; padding: 10px 12px; }
  .struct-attrs-row { grid-template-columns: 1fr 1fr; }
  .welcome-meta-card { flex-direction: column; gap: 16px; align-items: stretch; }
  .welcome-stat {
    border-right: none;
    padding-right: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    min-width: 0;
  }
  .welcome-types-grid { grid-template-columns: repeat(3, 1fr); }
  .overview { grid-template-columns: 1fr; }
  .messages { padding: 60px 14px 8px; }
  .bi-head { padding: 8px 12px; gap: 8px; }
  .bi-brand-name { font-size: 14px; }
  .bi-head-btn { padding: 7px 10px; font-size: 12.5px; }
  .dv-filters-compact { padding: 8px 12px; gap: 8px; }
  .dv-combo-pill.is-open .dv-combo-input,
  .dv-combo-pill.is-editing .dv-combo-input { max-width: min(240px, 62vw); }
  .chat-fab { right: 14px; bottom: 76px; padding: 10px 15px; }
  .chat-panel {
    right: 8px;
    left: 8px;
    bottom: 132px;
    width: auto;
    height: auto;
    top: 12px;
    max-height: none;
  }
  .rc-product { display: none; }
  .rc-supplier { max-width: 46%; }
}

/* ===== Phase 1: Evidence + Drawer ===== */

.evidence-block {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ev-conf {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: #f1f5f9;
}
.ev-conf-label { font-weight: 650; }
.conf-high { background: #ecfdf5; color: #065f46; }
.conf-medium { background: #fffbeb; color: #92400e; }
.conf-low, .conf-insufficient { background: #fef2f2; color: #991b1b; }
.ev-conf-reason { color: inherit; opacity: 0.85; }
.ev-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.ev-filters .chip, .ov-types .chip, .chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
}
.ev-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.ev-stats b { font-variant-numeric: tabular-nums; }
.ev-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.ev-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ev-table th, .ev-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.ev-table th { background: #f8fafc; font-weight: 600; color: #475569; }
.ev-table tr:last-child td { border-bottom: none; }
.ev-cites-head { font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.cite-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 8px;
  align-items: start;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cite-row:hover { background: #f8fafc; border-color: #cbd5e1; }
.cite-row.flash { background: #dbeafe; }
.cite-ref { font-weight: 700; color: var(--primary); }
.cite-name { display: block; font-weight: 600; font-size: 13px; }
.cite-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.cite-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.flag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #f1f5f9; }
.flag-ok { background: #d1fae5; color: #047857; }
.flag-conflict { background: #fee2e2; color: #b91c1c; }
.flag-missing { background: #fef3c7; color: #b45309; }
.cite-price { text-align: right; white-space: nowrap; font-size: 13px; }
.cite-price b { font-size: 15px; }
.cite-price small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.cite-jump { color: var(--primary); text-decoration: none; font-weight: 600; }
.thinking { color: var(--muted); font-size: 13px; }
.error { color: #b91c1c; }
.muted { color: var(--muted); }

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}
.drawer-overlay[hidden] { display: none; }
.drawer {
  width: min(420px, 100%);
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h3 { font-size: 16px; margin: 0; }
.drawer-close {
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.dr-title { font-size: 17px; font-weight: 700; }
.dr-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.dr-price { margin: 14px 0; font-size: 22px; }
.dr-price b { font-variant-numeric: tabular-nums; }
.dr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.dr-grid label, .dr-block label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.dr-grid span { font-size: 13px; word-break: break-word; }
.dr-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin-bottom: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.dr-block { margin-bottom: 14px; }
.dr-block p { margin: 0; font-size: 13px; line-height: 1.55; color: #334155; white-space: pre-wrap; }
.dr-nego {
  padding: 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.dv-overview-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
}
.ov-inline-item b { font-weight: 700; }
.ov-inline-sep { color: #cbd5e1; }
.ov-strip-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 120px;
}
.ov-strip-item span { display: block; font-size: 11px; color: var(--muted); }
.ov-strip-item b { font-size: 15px; }
.dv-btn-ghost, .dv-btn-danger {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.dv-btn-danger { color: #b91c1c; border-color: #fecaca; margin-left: 8px; }
.ov-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.ov-types { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.click-row { cursor: pointer; }
.click-row:hover { background: #f8fafc; }
.batch-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.batch-item:hover { background: #f8fafc; }
.batch-name { font-size: 13px; font-weight: 600; }
.batch-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.hist-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-item:hover, .hist-item.active { background: #e2e8f0; color: #0f172a; }

/* ================= 报价单：证据块入口 / 草稿抽屉 / 档案 ================= */

.ev-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.ev-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ev-action-btn:hover:not(:disabled) { background: var(--primary-hover); }
.ev-action-btn:disabled { opacity: 0.6; cursor: default; }
.ev-actions-hint { font-size: 11.5px; color: var(--muted); }

/* ---- 草稿弹窗（宽屏左右分栏） ---- */

.qs-overlay {
  z-index: 70;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.qs-drawer {
  width: min(980px, 96vw);
  height: min(92vh, 920px);
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.qs-head { align-items: center; flex-shrink: 0; gap: 12px; }
.qs-head-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.qs-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.qs-lang-btn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.qs-lang-btn.is-active {
  background: var(--primary);
  color: #fff;
}
.qs-lang-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.qs-head-main h3 { margin: 0; font-size: 15px; }
.qs-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #e2e8f0;
  color: #475569;
}
.qs-status-draft { background: var(--warning-bg); color: var(--warning); }
.qs-status-adopted { background: var(--success-bg); color: var(--success); }
.qs-status-void { background: #f1f5f9; color: var(--muted); }

.qs-body {
  background: var(--bg);
  padding: 16px 18px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.qs-body.is-busy { opacity: 0.6; pointer-events: none; }

.qs-single {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qs-single.is-readonly .qs-pi-inline {
  pointer-events: none;
}
.qs-zh-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px dashed var(--border);
}
.qs-zh-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.82);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.qs-pi-inline {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  width: 100%;
  min-width: 0;
  padding: 0 1px;
  margin: 0;
  border-radius: 2px;
}
.qs-pi-inline:focus {
  outline: none;
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 1px 0 var(--primary);
}
.qs-pi-inline-num { text-align: center; width: 100%; }
.qs-pi-inline-select {
  font-weight: 700;
  cursor: pointer;
}
.qs-pi-inline-block {
  display: block;
  width: 100%;
  margin-bottom: 3px;
}
.qs-pi-desc-fields { display: flex; flex-direction: column; gap: 3px; }
.qs-pi-desc-edit { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.qs-pi-desc-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font-size: 11px;
  line-height: 1.55;
  border: 1px solid transparent;
  border-radius: 4px;
  background: rgba(248, 250, 252, 0.6);
  font-family: inherit;
  padding: 6px 8px;
  box-sizing: border-box;
}
.qs-pi-desc-textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.06);
}
.qs-price-note-inline {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted);
}
.qs-pi-desc-carton {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.qs-pi-desc-carton .qs-pi-inline { flex: 1 1 45%; font-size: 10px; }
.qs-pi-desc-notes {
  width: 100%;
  resize: vertical;
  min-height: 36px;
  font-size: 10.5px;
  line-height: 1.45;
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 2px 1px;
  margin-top: 2px;
}
.qs-pi-desc-notes:focus {
  outline: none;
  background: rgba(59, 130, 246, 0.08);
}
.qs-pi-meta td { vertical-align: top; }

.qs-toolbar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  flex-shrink: 0;
}
.qs-toolbar-disabled { padding: 10px 14px; }
.qs-toolbar-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.qs-toolbar-title {
  font-size: 13px;
  font-weight: 700;
}

.qs-split {
  display: grid;
  grid-template-columns: 1fr min(440px, 42%);
  gap: 16px;
  height: 100%;
  min-height: 0;
}
.qs-split-preview,
.qs-split-edit {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.qs-split-preview .qs-section:last-child,
.qs-split-edit .qs-section:last-child,
.qs-split-preview .qs-warn:last-child {
  margin-bottom: 0;
}
.qs-edit-empty {
  margin: 0;
  padding: 12px 0;
}

.qs-split-edit .qs-grid {
  grid-template-columns: 1fr;
}
.qs-split-edit .qs-grid-4 {
  grid-template-columns: 1fr 1fr;
}

/* 精简编辑区 */
.qs-essentials .qs-section-head-sub {
  margin-top: 14px;
  margin-bottom: 10px;
}
.qs-essential-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qs-essential-grid-2 {
  grid-template-columns: 1fr 1fr;
}
.qs-line-essential + .qs-line-essential {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.qs-preview-section {
  padding: 0;
  border: none;
  background: transparent;
}
.qs-preview-section .qs-pi {
  border-radius: 10px;
}

.qs-ai-panel .qs-chat {
  flex-direction: column;
  align-items: stretch;
}
.qs-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.qs-ai-chip {
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.qs-ai-chip:hover:not(:disabled) {
  background: #e0e7ff;
  border-color: #a5b4fc;
}
.qs-ai-chip:disabled {
  opacity: 0.55;
  cursor: wait;
}
.qs-chat-send {
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
  border: none;
  margin-top: 8px;
}
.qs-ai-disabled {
  padding-top: 12px;
  padding-bottom: 12px;
}

.qs-manual-details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.qs-manual-summary {
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.qs-manual-summary::-webkit-details-marker { display: none; }
.qs-manual-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.qs-manual-section {
  padding-top: 12px;
}
.qs-manual-section + .qs-manual-section {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.qs-grid-manual {
  grid-template-columns: 1fr;
}

.qs-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.qs-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.qs-section-head h4 { margin: 0; font-size: 13px; font-weight: 700; }
.qs-section-hint { font-size: 11.5px; color: var(--muted); }

.qs-warn {
  background: var(--warning-bg);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.qs-warn-title { font-size: 12.5px; font-weight: 700; color: #92400e; }
.qs-warn ul { margin: 6px 0 0; padding-left: 20px; }
.qs-warn li { font-size: 12px; color: #92400e; line-height: 1.7; }
.qs-hint-warn { font-size: 12px; color: var(--warning); margin: 4px 0 8px; }
.qs-muted { color: var(--muted); }
.qs-red { color: #dc2626; }

/* PI 预览：左栏常驻，字号略放大便于核对 */
.qs-pi {
  border: 1px solid #94a3b8;
  background: #fff;
  padding: 14px 16px;
  font-size: 12px;
  color: #0f172a;
}
.qs-pi-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 8px;
}
/* A1–G9 抬头：对齐样本 xls 合并区与对齐方式 */
.qs-pi-header { border: 1px solid #94a3b8; border-bottom: none; }
.qs-pi-row {
  border-bottom: 1px solid #94a3b8;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 8px;
}
.qs-pi-row1 {
  position: relative;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 8px 8px 88px;
}
.qs-pi-logo-img {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 72px;
  object-fit: contain;
}
.qs-pi-company {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  width: 100%;
}
.qs-pi-row-sub { font-size: 12px; font-weight: 400; }
.qs-pi-row-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 8px;
}
.qs-pi-row-date {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 10px;
}
.qs-pi-row-date .qs-pi-inline { text-align: right; width: 7em; }
.qs-pi-logo {
  font-weight: 800;
  color: #dc2626;
  font-size: 13px;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.qs-pi-sub { text-align: center; font-size: 11px; padding: 3px 0; border-bottom: 1px solid #e2e8f0; }
.qs-pi-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 0;
}
.qs-pi-date { text-align: right; font-weight: 700; font-size: 11px; }
.qs-pi-meta, .qs-pi-table { width: 100%; border-collapse: collapse; }
.qs-pi-meta { border: 1px solid #94a3b8; table-layout: fixed; width: 100%; }
.qs-pi-meta-left { width: 42%; }
.qs-pi-meta-right { width: 58%; }
.qs-pi-meta td {
  border: 1px solid #94a3b8;
  padding: 4px 7px;
  font-size: 12px;
  vertical-align: middle;
  overflow: visible;
}
.qs-pi-meta-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  min-width: 0;
}
.qs-pi-meta-label {
  flex: 0 0 auto;
  white-space: nowrap;
}
.qs-pi-meta-input,
.qs-pi-meta-cell .qs-pi-inline {
  flex: 1 1 8rem;
  min-width: 8rem;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}
.qs-pi-meta-cell .qs-pi-meta-value {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}
.qs-pi-table { margin-top: 0; table-layout: auto; border: 1px solid #94a3b8; border-top: none; }
.qs-pi-table th, .qs-pi-table td {
  border: 1px solid #cbd5e1;
  padding: 4px 5px;
  vertical-align: top;
  word-break: break-word;
}
.qs-pi-table th {
  background: #f8fafc;
  font-size: 10px;
  text-align: center;
  font-weight: 700;
}
.qs-pi-table th:nth-child(1) { width: 11%; }
.qs-pi-table th:nth-child(2) { width: 4%; }
.qs-pi-table th:nth-child(3) { width: 20%; min-width: 9em; }
.qs-pi-table th:nth-child(4) { width: 32%; min-width: 12em; }
.qs-pi-table th:nth-child(5) { width: 9%; }
.qs-pi-table th:nth-child(6) { width: 10%; }
.qs-pi-table th:nth-child(7) { width: 10%; }
.qs-pi-pic { background: #fafafa; }
.qs-pi-pic-hint { color: #cbd5e1; font-size: 10px; }
.qs-pi-no, .qs-pi-num { text-align: center; }
.qs-pi-item { text-align: center; font-weight: 700; min-width: 9em; }
.qs-pi-item .qs-pi-inline {
  width: 100%;
  min-width: 0;
  text-align: center;
  overflow: visible;
}
.qs-pi-desc { font-size: 11px; line-height: 1.55; }
.qs-pi-total td {
  background: #fef9c3;
  font-weight: 700;
  text-align: center;
}
.qs-pi-foot > div {
  border: 1px solid #cbd5e1;
  border-top: none;
  padding: 4px 7px;
  font-size: 11px;
}
.qs-pi-payitem { font-weight: 700; }
.qs-pi-note { line-height: 1.5; font-weight: 700; }
.qs-pi-sign { display: flex; gap: 10px; font-weight: 700; }
.qs-pi-sign span { flex: 1; }

/* 表单 */
.qs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.qs-grid-4 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.qs-field { display: flex; flex-direction: column; gap: 4px; }
.qs-field-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.qs-req { color: var(--danger); font-style: normal; margin-left: 2px; }
.qs-input {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.qs-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.qs-textarea { resize: vertical; line-height: 1.5; }

.qs-line { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.qs-line:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.qs-price-note { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }
.qs-subblock {
  background: var(--assistant-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}
.qs-subblock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.qs-tag {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: #e2e8f0;
  color: #475569;
}
.qs-tag-exact { background: var(--success-bg); color: var(--success); }
.qs-tag-near { background: var(--warning-bg); color: var(--warning); }
.qs-tag-from_history { background: var(--info-bg); color: var(--primary); }

/* AI 调整 */
.qs-chat { display: flex; gap: 8px; align-items: flex-start; }
.qs-chat textarea { flex: 1; }
.qs-patch {
  margin-top: 12px;
  background: var(--info-bg);
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 10px 14px;
}
.qs-patch-summary { font-size: 12.5px; font-weight: 600; margin: 0 0 6px; }
.qs-patch-list { margin: 0; padding-left: 20px; }
.qs-patch-list li { font-size: 12px; line-height: 1.8; }
.qs-patch-list code {
  background: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}
.qs-patch-actions { display: flex; gap: 8px; margin-top: 10px; }
.qs-patch-apply { width: auto; padding: 6px 14px; font-size: 12.5px; border-radius: 7px; }

/* 价格来源 */
.qs-src-list { display: flex; flex-direction: column; gap: 4px; }
.qs-src-row {
  display: grid;
  grid-template-columns: 34px 1.1fr 2fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 7px;
  padding: 6px 9px;
  cursor: pointer;
  font-size: 11.5px;
}
.qs-src-row:hover { background: var(--assistant-bg); }
.qs-src-name { font-weight: 600; }
.qs-src-meta { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-src-price { font-weight: 700; color: var(--primary); white-space: nowrap; }

.qs-source-details { padding: 0; overflow: hidden; }
.qs-source-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.qs-source-summary::-webkit-details-marker { display: none; }
.qs-source-summary-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.qs-source-details[open] .qs-source-summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.qs-source-details .qs-src-list {
  padding: 10px 12px 12px;
}

/* 弹窗底栏 */
.qs-foot {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  flex-shrink: 0;
  overflow: visible;
}
.qs-foot-msg { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }
.qs-msg-ok { color: var(--success); }
.qs-msg-err { color: var(--danger); }
.qs-foot-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; max-width: 100%; }
.qs-adopt-btn,
.qs-goto-archive-btn,
.qs-optimize-btn {
  border: none;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s, transform 0.1s;
}
.qs-adopt-btn:active:not(:disabled),
.qs-goto-archive-btn:active:not(:disabled),
.qs-optimize-btn:active:not(:disabled) {
  transform: scale(0.98);
}
.qs-adopt-btn:disabled,
.qs-goto-archive-btn:disabled,
.qs-optimize-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.qs-adopt-btn[hidden],
.qs-goto-archive-btn[hidden],
.qs-optimize-btn[hidden] {
  display: none;
}
.qs-foot-actions .qs-goto-archive-btn,
.qs-foot-actions .qs-adopt-btn,
.qs-foot-actions .qs-optimize-btn {
  width: auto;
  height: auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.qs-adopt-btn {
  background: var(--primary);
}
.qs-adopt-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}
.qs-goto-archive-btn {
  background: #0f766e;
}
.qs-goto-archive-btn:hover:not(:disabled) {
  background: #0d9488;
}
.qs-optimize-btn {
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.qs-foot.is-adopted {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.qs-foot.is-adopted .qs-foot-actions {
  width: 100%;
  justify-content: stretch;
}
.qs-foot.is-adopted .qs-goto-archive-btn {
  width: 100%;
  padding: 12px 18px;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(15, 118, 110, 0.35);
  animation: qsArchiveBtnIn 0.35s ease;
}
@keyframes qsArchiveBtnIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.qs-adopted-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  background: linear-gradient(180deg, #f0fdfa 0%, #ecfeff 100%);
}
.qs-adopted-cta-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #0f766e;
  min-width: 0;
}
.qs-adopted-cta-text strong {
  font-size: 14px;
  color: #115e59;
}
.qs-goto-archive-btn-lg {
  padding: 10px 20px;
  font-size: 14px;
  flex-shrink: 0;
}
.qs-save-zh-btn {
  width: auto;
  padding: 7px 16px;
  font-size: 13px;
  border-radius: 8px;
  background: #0f766e;
}
.qs-save-zh-btn:hover:not(:disabled) { background: #0d9488; }
.qs-save-zh-btn.has-dirty { box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.25); }

/* ---- 档案列表 ---- */

.archive-tabs { display: flex; gap: 4px; }
.archive-tab {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.archive-tab.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--info-bg);
  font-weight: 600;
}
.archive-search {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12.5px;
  min-width: 190px;
  font-family: inherit;
}
.archive-search:focus { outline: none; border-color: var(--primary); }
.archive-body { padding: 4px 0; }

.ar-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
}
.ar-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ar-table th {
  background: var(--assistant-bg);
  text-align: left;
  padding: 9px 12px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.ar-table td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.ar-table tr:last-child td { border-bottom: none; }
.ar-table tbody tr:hover { background: #f8fafc; }
.ar-table tbody tr.ar-row-highlight {
  background: #eff6ff;
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: -2px;
}
.ar-no { font-weight: 600; font-family: ui-monospace, SFMono-Regular, monospace; }
.ar-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ar-num { font-weight: 600; white-space: nowrap; }
.ar-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.ar-ops { white-space: nowrap; }
.ar-op {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11.5px;
  color: #475569;
  cursor: pointer;
  margin-right: 4px;
}
.ar-op:hover { border-color: var(--primary); color: var(--primary); }
.ar-op-primary {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.ar-op-primary:hover { background: rgba(37, 99, 235, 0.06); }
.ar-op-danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---- 成本价核算：结论优先三栏 ---- */
.cost-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f4f7f5;
}

.cost-workspace .cost-canvas {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #f4f7f5;
}

.cost-desk {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(292px, 324px) minmax(0, 1fr) minmax(220px, 260px);
  gap: 0;
  align-items: stretch;
}

.cost-col {
  min-height: 0;
  overflow: auto;
  padding: 16px 14px 24px;
}

/* 左栏本身不滚：标题 / 常驻条 / 分组导航固定，只有分组内容在需要时滚 */
.cost-col-left {
  background: #fff;
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 12px;
}

.cost-col-left .cost-col-head,
.cost-col-left .cost-pinned,
.cost-col-left .cost-steps {
  flex: none;
}

.cost-form-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0 -14px;
  padding: 12px 14px 16px;
}

.cost-form-group { display: none; }
.cost-form-group.is-active { display: block; }

.cost-form-group .cost-block:first-of-type { padding-top: 0; }
.cost-form-group .cost-block:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.cost-group-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 10px;
}

/* 常驻条：订单数量 + 产品主尺寸，切分组也一直可见 */
.cost-pinned {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dcfce7;
  border-radius: 10px;
  background: #f6fefa;
  margin-bottom: 10px;
}

.cost-pin-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cost-pin-field.is-primary .cost-input-wrap input {
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  padding: 7px 9px;
}

.cost-pinned .cost-dims { margin-bottom: 0; }

.cost-pin-chip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: #64748b;
}

.cost-pin-chip strong {
  color: #0f172a;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* 分组导航：一屏放得下，点选切换，不再靠滚动找字段 */
.cost-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  background: #eef2f0;
  padding: 3px;
  border-radius: 9px;
}

.cost-step {
  position: relative;
  border: none;
  background: transparent;
  border-radius: 7px;
  padding: 6px 2px;
  font-size: 12px;
  font-weight: 550;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.cost-step:hover:not(.is-active) { color: #0f172a; }

.cost-step.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.cost-step-dot {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ef4444;
}

/* 图卡选择器：平时只留一张当前款式卡，点「更换」才展开整格图卡 */
.cost-picker { margin-bottom: 10px; }

.cost-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.cost-picker-toggle {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
}

.cost-picker-toggle:hover {
  border-color: var(--brand, #16a34a);
  color: var(--brand, #16a34a);
}

.cost-picker-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdfc;
}

.cost-picker-thumb {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
}

.cost-picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cost-picker-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 11.5px;
  color: #64748b;
}

.cost-picker-meta strong {
  font-size: 12.5px;
  font-weight: 650;
  color: #0f172a;
}

.cost-picker-grid { display: none; }
.cost-picker-grid.is-open {
  display: block;
  margin-top: 8px;
}

.cost-col-right {
  background: #fbfcfb;
  border-left: 1px solid var(--border);
}

.cost-col-center {
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cost-col-center #cost-panel-slot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cost-col-center .cost-result-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cost-col-center .cost-table-wrap {
  flex: 1;
  min-height: 0;
}

.cost-col-head {
  margin-bottom: 14px;
}

.cost-col-head h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.cost-col-head p {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* 基价面板标题栏：标题 + 保存状态在左，保存按钮在右 */
.cost-price-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cost-price-head p.is-dirty {
  color: #b45309;
}

.cost-price-save-btn {
  flex: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cost-price-save-btn:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}

/* 有未保存改动时提升为主操作，提醒业务员这次调价还没落库 */
.cost-price-save-btn.is-dirty {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.cost-price-save-btn.is-dirty:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.cost-price-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cost-block {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f0;
}

.cost-block:last-of-type { border-bottom: none; }

.cost-block-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 10px;
}

.cost-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin-bottom: 8px;
}

.cost-label {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
}

.cost-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cost-input-wrap input,
.cost-input-wrap select,
.cost-dims-row input,
.cost-price-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12.5px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
}

.cost-input-wrap input:focus,
.cost-input-wrap select:focus,
.cost-dims-row input:focus,
.cost-price-row input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.12);
}

.cost-input-wrap select:disabled {
  background: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
}

.cost-unit {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.cost-inline-2,
.cost-inline-3 {
  display: grid;
  gap: 8px;
}

.cost-inline-2 { grid-template-columns: 1fr 1fr; }
.cost-inline-3 { grid-template-columns: 1fr 1fr 1fr; }

.cost-dims { margin-bottom: 8px; }

.cost-dims-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.cost-dims-row input {
  width: 0;
  flex: 1;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.cost-dims-x {
  color: #94a3b8;
  font-size: 12px;
}

.cost-dims-hint {
  margin-top: 3px;
  font-size: 10.5px;
  color: #94a3b8;
}

.cost-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.cost-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
}

.cost-toggle.is-on {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.cost-toggle-track {
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: #e2e8f0;
  position: relative;
  flex-shrink: 0;
}

.cost-toggle.is-on .cost-toggle-track { background: #22c55e; }

.cost-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.cost-toggle.is-on .cost-toggle-thumb { transform: translateX(12px); }

.cost-dep.is-hidden { display: none; }

.cost-more {
  margin-top: 4px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
}

.cost-more summary {
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  list-style: none;
}

.cost-more summary::-webkit-details-marker { display: none; }

.cost-more summary::before {
  content: "▸ ";
  color: #94a3b8;
}

.cost-more[open] summary::before { content: "▾ "; }

.cost-more-body {
  margin-top: 10px;
}

.cost-handle-note {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted, #64748b);
}

.cost-price-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cost-price-row {
  display: grid;
  grid-template-columns: 1fr 72px auto;
  align-items: center;
  gap: 6px;
}

.cost-price-name {
  font-size: 12px;
  color: #475569;
}

.cost-price-row input {
  text-align: right;
  padding: 5px 6px;
}

/* 中间结论区：横向紧凑条 */
.cost-hero {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #dcfce7;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.cost-hero.is-loading { opacity: 0.7; }

.cost-hero-empty {
  min-height: 48px;
  justify-content: center;
  border-style: dashed;
  border-color: #e2e8f0;
  background: #fafafa;
}

.cost-hero-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
}

.cost-hero-term {
  font-size: 12px;
  color: #166534;
  font-weight: 700;
}

.cost-hero-price {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 750;
  color: #14532d;
  letter-spacing: -0.02em;
}

.cost-hero-price small {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  margin-left: 2px;
}

.cost-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 12px;
  color: #64748b;
  min-width: 0;
  flex: 1;
}

.cost-hero-meta span {
  white-space: nowrap;
}

.cost-hero-sep {
  width: 1px;
  height: 12px;
  background: #d1d5db;
  padding: 0 !important;
}

.cost-hero-actions {
  flex-shrink: 0;
  margin-left: auto;
}

.cost-draft-quote-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.cost-draft-quote-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.cost-draft-quote-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.cost-draft-quote-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cost-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
  background: #eef2f0;
  padding: 2px;
  border-radius: 8px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.cost-tabs::-webkit-scrollbar { display: none; }

.cost-tab {
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
}

.cost-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cost-result-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
}

.cost-result-panel > .hint,
.cost-result-panel > .error {
  padding: 24px 16px;
  margin: 0;
}

.cost-table-wrap { overflow: auto; }

.cost-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

/* 表头吸顶：明细行多时滚动仍看得到列名，也就不必再靠加大行高来分辨 */
.cost-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8faf9;
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.cost-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  line-height: 1.35;
}

.cost-table tfoot td {
  position: sticky;
  bottom: 0;
  background: #f4f8f5;
  border-bottom: none;
  border-top: 1px solid var(--border);
  padding-top: 7px;
  padding-bottom: 7px;
}

/* 备注不再单独占一行高度，跟在项目名后面走小字 */
.cost-table td .cost-muted {
  display: block;
  margin-top: 1px;
  line-height: 1.3;
}

.cost-method-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

.cost-table tbody tr:hover { background: #f8fafc; }

.cost-row-active { background: #f0fdf4 !important; }

.cost-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cost-table th.cost-num {
  text-align: right;
}

/* 成本明细：项目 / 计价方式 / 单只成本 / 订单成本。其余页签列数不同，按内容自适应 */
.cost-table--costs thead th:nth-child(1) { width: 44%; }
.cost-table--costs thead th:nth-child(2) { width: 16%; }
.cost-table--costs thead th:nth-child(3) { width: 20%; }
.cost-table--costs thead th:nth-child(4) { width: 20%; }

.cost-table:not(.cost-table--costs) { table-layout: auto; }

.cost-muted { color: #94a3b8; font-size: 11.5px; }

.cost-num-text {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #334155;
}

/* 04_报价与验证：公式核验 */
.cost-tab.is-alert {
  color: #b42318;
}

.cost-tab.is-alert.is-active {
  color: #b42318;
  box-shadow: 0 1px 2px rgba(180, 35, 24, 0.18);
}

.cost-row-alert { background: #fef3f2 !important; }

.cost-check-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.cost-check-badge.is-pass {
  background: #ecfdf3;
  color: #067647;
}

.cost-check-badge.is-fail {
  background: #fef3f2;
  color: #b42318;
}

/* 06_工艺图示：手提结构参考图与计费口径 */
.cost-handle-guide {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfc;
}

.cost-basis-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.cost-basis-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.cost-basis-formula {
  margin: 0;
  padding: 5px 8px;
  border-radius: 7px;
  background: #ecfdf3;
  color: #067647;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.cost-basis {
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cost-basis > div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 6px;
  align-items: baseline;
}

.cost-basis dt {
  font-size: 11px;
  color: #94a3b8;
}

.cost-basis dd {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: #475569;
}

/* 06_工艺图示：七种提手结构的图卡选择器 */
.cost-structure-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.cost-structure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 6px;
}

.cost-structure-grid-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1100px) {
  .cost-structure-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.cost-structure-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cost-structure-card:hover { border-color: #94a3b8; }

.cost-structure-card.is-active {
  border-color: #0f766e;
  background: #f0fdfa;
  box-shadow: 0 0 0 1px #0f766e inset;
}

.cost-structure-media {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f5f9;
  aspect-ratio: 1 / 1;
}

.cost-structure-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cost-structure-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  color: #94a3b8;
}

.cost-structure-name {
  font-size: 10.5px;
  line-height: 1.3;
  color: #334155;
}

.cost-structure-card.is-active .cost-structure-name {
  color: #0f766e;
  font-weight: 600;
}

.cost-structure-cost {
  font-size: 10.5px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.cost-guide-group + .cost-guide-group { margin-top: 10px; }

.cost-result-panel .cost-guide-group-title { margin: 12px 0 6px; }
.cost-result-panel .cost-guide-group-title:first-child { margin-top: 0; }

.cost-guide-group-title {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.cost-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.cost-guide-item {
  margin: 0;
  min-width: 0;
}

.cost-guide-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cost-guide-thumb:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.cost-guide-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.cost-guide-item figcaption {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.35;
  color: #94a3b8;
}

.cost-guide-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(15, 23, 42, 0.78);
  cursor: zoom-out;
}

.cost-guide-lightbox figure {
  margin: 0;
  max-width: min(880px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cost-guide-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 128px);
  border-radius: 12px;
  background: #fff;
}

.cost-guide-lightbox figcaption {
  color: #e2e8f0;
  font-size: 12.5px;
  text-align: center;
}

.cost-guide-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cost-guide-close:hover { background: rgba(255, 255, 255, 0.28); }

@media (max-width: 1100px) {
  .cost-workspace .cost-canvas { overflow: auto; }
  .cost-desk {
    height: auto;
    grid-template-columns: 1fr;
  }
  .cost-col-left,
  .cost-col-right {
    border: none;
    border-bottom: 1px solid var(--border);
  }
  /* 单列时左栏跟着页面滚，分组内容不再自己开滚动条 */
  .cost-col-left { overflow: visible; }
  .cost-form-body {
    overflow: visible;
    min-height: auto;
  }
  .cost-inline-3 { grid-template-columns: 1fr 1fr; }
  .cost-hero { gap: 8px 12px; }
}

@media (max-width: 960px) {
  .qs-overlay { padding: 0; align-items: stretch; }
  .qs-drawer {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  .qs-pi { font-size: 11px; }
  .qs-foot { flex-direction: column; align-items: stretch; }
}

/* ===== V5.1 物流与装箱 ===== */

.cost-block-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #94a3b8;
}

.cost-hero-price.is-blocked {
  color: #b91c1c;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.cost-hero-blocked {
  flex-basis: 100%;
  order: 5;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
}

.cost-packing {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cost-packing-summary {
  border: 1px solid #d3e5da;
  background: #f4faf6;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cost-packing-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  border-radius: 999px;
  padding: 3px 10px;
}

.cost-packing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 12px;
  color: #334155;
}

.cost-packing-note {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
}

.cost-packing-warn {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 12px;
  line-height: 1.5;
}

/* 线路库 / 装箱规则维护表：右栏窄，横向滚动，输入框紧凑 */
.cost-route-note {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #94a3b8;
}

.cost-route-table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

.cost-route-table th,
.cost-route-table td {
  padding: 4px 6px;
  white-space: nowrap;
}

.cost-route-table th small {
  display: block;
  font-weight: 400;
  color: #94a3b8;
}

.cost-route-table input[type="number"] {
  width: 74px;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.cost-route-table input[type="date"] {
  width: 130px;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.cost-route-table select {
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.cost-route-pending td:first-child {
  color: #b45309;
}

