:root {
  /* 现代化配色方案 - 简约高级 */
  --bg-primary: #fafbfc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5f7fa;
  --surface: #ffffff;
  --surface-hover: #f8f9fb;

  /* 边框和分割线 */
  --border-light: #e8ecf0;
  --border-medium: #d4dae0;
  --border-dark: #b8c2cc;

  /* 文字颜色 */
  --text-primary: #1a1f36;
  --text-secondary: #697386;
  --text-tertiary: #9daab6;
  --text-inverse: #ffffff;

  /* 品牌色 - 财务场景的稳重青绿、深蓝和金色 */
  --brand-primary: #1f7a74;
  --brand-secondary: #2f5f98;
  --brand-accent: #d0a24c;
  --brand-gradient: linear-gradient(135deg, #1f7a74 0%, #2f5f98 68%, #d0a24c 100%);

  /* 功能色 */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* 成功色柔和背景 */
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

  /* 阴影系统 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

  /* 字体 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  /* 动画时长 */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 350ms;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 布局容器 */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航栏 - 简约优雅 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  padding: 0 clamp(20px, 4vw, 48px);
  transition: box-shadow var(--duration-base) ease;
}

.topbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 40px;
  height: 72px;
}

/* 品牌区域 */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(31, 122, 116, 0.24);
  transition: transform var(--duration-base) ease;
}

.brand-icon:hover {
  transform: translateY(-2px);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

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

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* 导航标签 */
.nav-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.nav-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) ease;
  position: relative;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.nav-btn.active {
  color: var(--brand-primary);
  background: var(--info-bg);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
}

/* 主内容区域 */
main {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 40px clamp(20px, 4vw, 48px);
}

/* 顶部快捷栏 */
.quick-workbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -12px 0 24px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-xs);
}

.quick-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 13px;
}

.quick-status strong {
  color: var(--text-primary);
  font-size: 14px;
}

.quick-status b {
  color: var(--brand-primary);
  font-size: 15px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.12);
}

.command-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-base) cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(31, 122, 116, 0.28);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(47, 95, 152, 0.34);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

/* 指标卡片 */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.metrics-grid.compact {
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--duration-base) ease;
}

.metrics-grid.compact .metric-card {
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.metric-label {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.metrics-grid.compact .metric-value {
  font-size: 22px;
}

.metric-change {
  font-size: 14px;
  color: var(--text-secondary);
}

.metric-change.positive {
  color: var(--success);
}

.metric-change.negative {
  color: var(--error);
}

/* 视图切换 */
.view {
  display: none;
  animation: fadeIn var(--duration-base) ease;
}

.view.active {
  display: block;
}

/* 区块标题 */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.section-title {
  flex: 1;
}

.section-title h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.section-title p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view[data-view="invoice"] .section-header {
  align-items: center;
  margin-bottom: 14px;
}

.view[data-view="invoice"] .section-title h2 {
  font-size: clamp(22px, 2vw, 28px);
  margin-bottom: 4px;
}

.view[data-view="invoice"] .section-title p {
  font-size: 14px;
}

/* 工作流卡片网格 */
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.flow-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  cursor: pointer;
  transition: all var(--duration-base) cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.flow-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-base) ease;
}

.flow-card:hover::before {
  transform: scaleX(1);
}

.flow-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.flow-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  color: var(--brand-primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}

.flow-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.flow-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.flow-meter {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.flow-meter-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
  transition: width 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* 面板和卡片 */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* 两栏布局 */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* 表单元素 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  transition: all var(--duration-fast) ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.12);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.report-type-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(128px, 1fr));
  gap: 10px;
  padding: 6px;
  border: 1px solid rgba(31, 122, 116, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(31, 122, 116, 0.07), rgba(47, 95, 152, 0.04)),
    var(--bg-tertiary);
}

.report-type {
  position: relative;
  min-height: 76px;
  padding: 13px 14px 12px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition:
    transform var(--duration-base) ease,
    box-shadow var(--duration-base) ease,
    border-color var(--duration-base) ease,
    background var(--duration-base) ease,
    color var(--duration-base) ease;
}

.report-type::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(208, 162, 76, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(31, 122, 116, 0.98), rgba(47, 95, 152, 0.94));
  opacity: 0;
  transition: opacity var(--duration-base) ease;
}

.report-type::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-medium);
  box-shadow: 0 0 0 4px rgba(212, 218, 224, 0.22);
  transition: all var(--duration-base) ease;
}

.report-type:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 122, 116, 0.18);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(26, 31, 54, 0.08);
}

.report-type.active {
  color: var(--text-inverse);
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 14px 32px rgba(31, 122, 116, 0.2);
}

.report-type.active::before {
  opacity: 1;
}

.report-type.active::after {
  background: var(--brand-accent);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.22),
    0 0 18px rgba(208, 162, 76, 0.65);
}

.report-type-main,
.report-type-sub {
  position: relative;
  z-index: 1;
  display: block;
}

.report-type-main {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text-primary);
}

.report-type-sub {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-tertiary);
}

.report-type.active .report-type-main,
.report-type.active .report-type-sub {
  color: var(--text-inverse);
}

@media (max-width: 1180px) {
  .report-type-selector {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 760px) {
  .report-type-selector {
    grid-template-columns: 1fr;
  }

  .report-type {
    min-height: 66px;
  }
}

.invoice-import-panel {
  display: grid;
  grid-template-columns: minmax(440px, 1fr) minmax(260px, 0.45fr) auto;
  gap: 10px;
  align-items: stretch;
  padding: 14px;
  margin-bottom: 14px;
}

/* 文件上传区域 */
.file-drop-zone {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  width: 100%;
  min-height: 86px;
  align-items: center;
  gap: 14px;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all var(--duration-base) ease;
  background: var(--bg-tertiary);
  overflow: visible;
}

.file-drop-zone:hover {
  border-color: var(--brand-primary);
  background: var(--info-bg);
}

.file-drop-zone.drag-over {
  border-color: var(--brand-primary);
  background: var(--info-bg);
  border-style: solid;
}

.file-drop-icon {
  display: block;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin: 0;
  color: var(--text-tertiary);
  overflow: visible;
}

.file-drop-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.file-drop-hint {
  font-size: 13px;
  color: var(--text-tertiary);
}

.upload-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0;
}

.queue-summary {
  display: flex;
  min-height: 86px;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(31, 122, 116, 0.08), rgba(208, 162, 76, 0.08));
  border: 1px solid rgba(31, 122, 116, 0.16);
  color: var(--text-secondary);
  font-size: 13px;
}

.queue-summary strong {
  color: var(--brand-primary);
}

.paste-details {
  align-self: center;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 9px 12px;
  background: var(--surface);
}

.paste-details[open] {
  grid-column: 1 / -1;
  align-self: auto;
  border-top: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px 12px;
}

.paste-details summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

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

.paste-details summary::after {
  content: '+';
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(31, 122, 116, 0.1);
}

.paste-details[open] summary::after {
  content: '-';
}

.paste-details .form-group {
  margin: 12px 0 0;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 0 0 24px;
}

.invoice-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.insight-card {
  min-height: 108px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.invoice-summary-grid .insight-card {
  min-height: 74px;
  padding: 11px 14px;
}

.invoice-summary-grid .insight-card strong {
  font-size: 21px;
}

.insight-card span,
.insight-card small {
  display: block;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 600;
}

.insight-card strong {
  display: block;
  margin: 4px 0 0;
  color: var(--text-primary);
  font-size: 28px;
  line-height: 1.1;
}

.danger-action {
  color: var(--error);
  border-color: var(--error-border);
}

.danger-action:hover {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error-border);
}

.invoice-filter-panel {
  padding: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.invoice-chipbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  margin-bottom: 14px;
}

.quick-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  position: relative;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  transition: all var(--duration-fast) ease;
  overflow: hidden;
}

.filter-chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.filter-chip > * {
  position: relative;
}

.filter-chip:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-1px);
}

.filter-chip.active {
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(31, 122, 116, 0.24);
}

.filter-chip.active::before {
  opacity: 1;
}

.filter-count {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
}

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.filter-toolbar .filter-search {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.filter-toolbar .filter-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.filter-toolbar .filter-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--bg-tertiary);
  transition: all var(--duration-fast) ease;
}

.filter-toolbar .filter-search input:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.1);
}

.filter-toolbar select,
.filter-toolbar .filter-amount-input {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  min-width: 100px;
}

.filter-toolbar select:hover,
.filter-toolbar .filter-amount-input:hover {
  border-color: var(--brand-primary);
  background: var(--surface);
}

.filter-toolbar select:focus,
.filter-toolbar .filter-amount-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.1);
}

.filter-amount-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  font-size: 12px;
  color: var(--text-tertiary);
}

.filter-amount-group input {
  width: 70px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
}

.filter-amount-group input:focus {
  outline: none;
}

.filter-amount-group .separator {
  color: var(--text-tertiary);
  font-size: 12px;
}

.filter-reset-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-reset-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--info-bg);
}

.invoice-analytics {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.analysis-card {
  grid-column: span 3;
  min-height: 208px;
  padding: 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.analysis-card.analysis-wide {
  grid-column: span 4;
}

.analysis-card.analysis-large {
  grid-column: span 6;
}

.analysis-card.insight-panel {
  grid-column: span 6;
}

.analysis-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.analysis-head span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.analysis-head strong {
  color: var(--text-primary);
  font-size: 20px;
}

.status-card {
  display: grid;
  justify-items: center;
}

.status-ring {
  display: grid;
  place-items: center;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: conic-gradient(var(--success) 0deg var(--pass), var(--warning) var(--pass) calc(var(--pass) + var(--review)), var(--border-light) calc(var(--pass) + var(--review)) 360deg);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(31, 122, 116, 0.08);
  animation: ringSpin 900ms cubic-bezier(0.4, 0, 0.2, 1);
}

.status-ring::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.status-ring span {
  position: relative;
  z-index: 1;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.02em;
  animation: fadeInScale 700ms 200ms cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes ringSpin {
  from {
    transform: rotate(-90deg) scale(0.85);
    opacity: 0;
  }
  to {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.analysis-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 13px;
}

.analysis-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
}

.risk-pill-list {
  display: grid;
  gap: 10px;
}

.risk-pill {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.risk-pill span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-pill strong {
  color: var(--text-primary);
  font-size: 15px;
}

.insight-action-list {
  display: grid;
  gap: 12px;
}

.insight-action {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.insight-action i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(31, 122, 116, 0.12);
  color: var(--brand-primary);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.ok-dot {
  background: var(--success);
}

.warn-dot {
  background: var(--warning);
}

.analysis-bars {
  display: grid;
  gap: 12px;
}

.analysis-bar-row {
  display: grid;
  grid-template-columns: minmax(76px, 0.8fr) minmax(80px, 1fr) minmax(72px, auto);
  align-items: center;
  gap: 10px;
}

.analysis-bar-row span {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-bar-row strong {
  color: var(--text-primary);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.analysis-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  position: relative;
}

.analysis-track i {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  position: relative;
  animation: barGrow 800ms cubic-bezier(0.34, 1.28, 0.64, 1) both;
  transform-origin: left center;
}

.analysis-track i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: barShine 2400ms ease-in-out infinite;
}

@keyframes barGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes barShine {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
  100% { transform: translateX(200%); }
}

.spark-bars {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 170px;
  padding-top: 10px;
}

.spark-col {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.spark-col i {
  display: block;
  width: 100%;
  min-height: 10px;
  border-radius: 9px 9px 3px 3px;
  background: linear-gradient(180deg, #2f5f98, #1f7a74);
}

.spark-col span {
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 11px;
  text-align: center;
}

.mini-empty,
.empty-analytics {
  color: var(--text-tertiary);
  grid-column: 1 / -1;
}

/* 发票筛选栏 - 紧凑单行设计 */
.invoice-filter-bar {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.invoice-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.invoice-filter-row .filter-search {
  position: relative;
  flex: 1;
  min-width: 240px;
}

/* 通用搜索框图标：任何 .filter-search 内的 svg 都用同一套定位/尺寸 */
.filter-search {
  position: relative;
}

.filter-search > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  min-width: 15px;
  min-height: 15px;
  flex: none;
  color: var(--text-tertiary);
  pointer-events: none;
  opacity: 0.75;
}

.filter-search:focus-within > svg {
  color: var(--brand-1, var(--brand-primary));
  opacity: 1;
}

.filter-search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  transition: all var(--duration-fast) ease;
}

.filter-search-input::placeholder {
  color: var(--text-tertiary);
}

.filter-search-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.1);
}

.filter-select {
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  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='%239daab6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
  appearance: none;
  min-width: 116px;
  transition: all var(--duration-fast) ease;
}

.filter-select:hover {
  border-color: var(--brand-primary);
  background-color: var(--surface);
}

.filter-select:focus {
  outline: none;
  border-color: var(--brand-primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.1);
}

.filter-amount {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  padding: 0 4px;
  transition: all var(--duration-fast) ease;
}

.filter-amount:focus-within {
  border-color: var(--brand-primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.1);
}

.filter-amount-input {
  width: 96px;
  padding: 9px 8px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--text-primary);
}

.filter-amount-input::placeholder {
  color: var(--text-tertiary);
  font-size: 12.5px;
}

.filter-amount-input:focus {
  outline: none;
}

.filter-amount-sep {
  color: var(--text-tertiary);
  font-size: 12px;
  padding: 0 2px;
}

.filter-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.filter-reset-btn:hover {
  color: var(--brand-primary);
  background: var(--surface);
  border-color: var(--brand-primary);
  transform: rotate(-90deg);
}

.filter-reset-btn svg {
  width: 16px;
  height: 16px;
}

.invoice-chipbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
}

.invoice-chipbar .quick-filter-chips {
  gap: 6px;
}

.invoice-chipbar .filter-chip {
  padding: 5px 12px;
  font-size: 12.5px;
  background: var(--bg-tertiary);
  border-color: transparent;
}

.invoice-chipbar .filter-chip.active {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 3px 10px rgba(31, 122, 116, 0.24);
}

/* 发票结果布局 - 表格占更大空间 */
.invoice-results-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}

/* 发票表格容器 - 固定高度 */
.invoice-table-container {
  display: flex;
  flex-direction: column;
  max-height: 640px;
  overflow: hidden;
}

.invoice-table-container .table-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.table-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.table-header-left h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-header-hint {
  color: var(--text-tertiary);
  font-size: 12px;
}

.table-header-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.btn-icon:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--info-bg);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* 发票表格滚动区 */
.invoice-table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  max-height: 580px;
}

.invoice-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.invoice-table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.invoice-table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
  border: 2px solid var(--surface);
}

.invoice-table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

.invoice-table-scroll table {
  min-width: 1100px;
}

.invoice-table-scroll thead {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, #f5f7fa 0%, #eef1f5 100%);
  box-shadow: 0 1px 0 var(--border-light);
}

.invoice-table-scroll th {
  position: relative;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  user-select: none;
}

.invoice-table-scroll th.draggable {
  cursor: grab;
}

.invoice-table-scroll th.draggable:hover {
  color: var(--brand-primary);
  background: rgba(31, 122, 116, 0.04);
}

.invoice-table-scroll th.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.invoice-table-scroll th.drag-over {
  box-shadow: inset 3px 0 0 var(--brand-primary);
}

.invoice-table-scroll td {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  height: 44px;
  vertical-align: middle;
}

.invoice-table-scroll tbody tr {
  transition: background var(--duration-fast) ease;
}

.invoice-table-scroll tbody tr:nth-child(even) {
  background: rgba(245, 247, 250, 0.4);
}

.invoice-table-scroll tbody tr:hover {
  background: var(--info-bg);
}

.invoice-table-scroll td .cell-money {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

.invoice-table-scroll td .cell-muted {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* 异常提醒 aside */
.invoice-alerts-panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  max-height: 640px;
  overflow: hidden;
}

.alerts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}

.alerts-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.alerts-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--warning-border);
}

.alerts-count.zero {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.invoice-alerts-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  gap: 8px;
}

.invoice-alerts-scroll::-webkit-scrollbar {
  width: 8px;
}

.invoice-alerts-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.invoice-alerts-scroll::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 8px;
  color: var(--text-tertiary);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-description {
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}

/* 模态框 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 40, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: modalFadeIn var(--duration-base) ease;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn var(--duration-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  border: none;
  background: transparent;
}

.modal-close:hover {
  background: var(--bg-tertiary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-hint {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-tertiary);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* 字段选择列表 */
.column-picker-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.column-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: grab;
  transition: all var(--duration-fast) ease;
}

.column-picker-item:hover {
  border-color: var(--brand-primary);
  background: var(--info-bg);
}

.column-picker-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.column-picker-item.drag-over {
  border-color: var(--brand-primary);
  box-shadow: 0 -2px 0 var(--brand-primary);
}

.column-picker-drag {
  color: var(--text-tertiary);
  display: inline-flex;
}

.column-picker-drag svg {
  width: 14px;
  height: 14px;
}

.column-picker-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.column-picker-label {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
  user-select: none;
  cursor: pointer;
}

.export-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-light);
}

.export-range {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-secondary);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 表格 */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-tertiary);
}

.table-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border-light);
}

th {
  padding: 14px 20px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background var(--duration-fast) ease;
}

tbody tr:hover {
  background: var(--surface-hover);
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.badge-success,
.badge.ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-warning,
.badge.warn {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-error,
.badge.danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.badge-info,
.badge.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

/* 提醒列表 */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.6;
}

.alert-item.success,
.alert-item.ok {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--text-primary);
}

.alert-item.warning,
.alert-item.warn {
  border-color: var(--warning);
  background: var(--warning-bg);
  color: var(--text-primary);
}

.alert-item.error,
.alert-item.danger {
  border-color: var(--error);
  background: var(--error-bg);
  color: var(--text-primary);
}

.alert-item.info {
  border-color: var(--info);
  background: var(--info-bg);
  color: var(--text-primary);
}

/* Toast 通知 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 1000;
  min-width: 320px;
  max-width: 500px;
  padding: 16px 24px;
  background: var(--text-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: 15px;
  font-weight: 500;
  opacity: 0;
  transition: all var(--duration-base) cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-tertiary);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-description {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* 加载状态 */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

/* 动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(20px, -20px) scale(1.05);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .topbar-inner {
    gap: 24px;
  }

  .quick-workbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .command-actions {
    width: 100%;
  }

  .workflow-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .invoice-import-panel {
    grid-template-columns: 1fr;
  }

  .file-drop-zone {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .upload-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .filter-grid,
  .invoice-results-layout {
    grid-template-columns: 1fr 1fr;
  }

  .invoice-analytics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .analysis-card,
  .analysis-card.analysis-wide {
    grid-column: span 3;
  }

  .analysis-card.analysis-large,
  .analysis-card.insight-panel {
    grid-column: span 6;
  }

  .filter-field.wide,
  .filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 16px 0;
  }

  .nav-tabs {
    width: 100%;
    order: 3;
  }

  .quick-workbar {
    padding: 12px;
    margin-bottom: 20px;
  }

  .quick-status {
    gap: 8px 10px;
  }

  main {
    padding: 24px 16px;
  }

  .section-header {
    flex-direction: column;
  }

  .workflow-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid.compact {
    grid-template-columns: repeat(3, 1fr);
  }

  .metrics-grid.compact .metric-card {
    padding: 9px 8px;
  }

  .metrics-grid.compact .metric-value {
    font-size: 20px;
  }

  .filter-grid,
  .invoice-results-layout {
    grid-template-columns: 1fr;
  }

  .invoice-chipbar,
  .filter-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-drop-zone {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .upload-actions {
    justify-content: center;
  }

  .invoice-analytics {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: space-between;
  }

  .analysis-card,
  .analysis-card.analysis-wide,
  .analysis-card.analysis-large,
  .analysis-card.insight-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }
}

/* === Invoice UI v3: larger workspace, complete invoice operations === */
main {
  max-width: 1880px;
  padding: 28px clamp(12px, 1.6vw, 30px) 44px;
}

.view[data-view="invoice"] .section-title h2 {
  font-size: 31px;
}

.view[data-view="invoice"] .section-title p,
.file-drop-text,
.filter-search-input,
.filter-select,
.filter-amount-input {
  font-size: 14px;
}

.invoice-analytics {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.invoice-analytics .analysis-card {
  min-height: 168px;
}

.invoice-analytics .overview-card {
  display: block;
  justify-items: stretch;
}

.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analytics-metric {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #e0ebec;
  border-radius: 14px;
  background: linear-gradient(180deg, #f9fcfc, #f1f7f7);
}

.analytics-metric.primary {
  background: linear-gradient(135deg, rgba(15, 111, 102, 0.12), rgba(200, 148, 50, 0.1));
  border-color: rgba(15, 111, 102, 0.18);
}

.analytics-metric span {
  display: block;
  color: #708094;
  font-size: 12px;
  font-weight: 760;
}

.analytics-metric strong {
  display: block;
  margin-top: 2px;
  color: #162236;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.analysis-bars {
  gap: 10px;
}

.analysis-bar-row {
  display: block;
  padding: 8px 9px;
  border: 1px solid #e4ecee;
  border-radius: 13px;
  background: #f8fbfb;
}

.analysis-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.analysis-bar-head span {
  min-width: 0;
  overflow: hidden;
  color: #536478;
  font-size: 12.5px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-bar-head strong {
  color: #223149;
  font-size: 12.5px;
  font-weight: 880;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.analysis-track {
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eaf1f2, #f3f7f8);
  box-shadow: inset 0 1px 2px rgba(18, 30, 44, 0.06);
}

.analysis-track i {
  background: linear-gradient(90deg, #88bbb5 0%, #0f6f66 66%, #c89432 100%);
  box-shadow: 0 6px 14px rgba(15, 111, 102, 0.16);
}

.spark-bars {
  height: 104px !important;
}

.spark-col i {
  min-height: 16px;
}

.invoice-results-layout {
  grid-template-columns: minmax(0, 1fr) minmax(292px, 330px);
  gap: 14px;
}

.invoice-table-container {
  max-height: 724px;
}

.invoice-alerts-panel {
  height: 724px;
  min-height: 724px;
}

.invoice-table-scroll {
  max-height: 672px;
}

.invoice-alerts-scroll {
  max-height: 672px;
}

.invoice-table-scroll table {
  min-width: 1720px;
  table-layout: auto;
}

.invoice-table-scroll th {
  height: 46px;
  padding: 0 14px;
  font-size: 13px;
}

.invoice-table-scroll td {
  height: 52px;
  padding: 0 14px;
  font-size: 14px;
  line-height: 1.35;
}

.invoice-table-scroll .select-cell {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  padding: 0;
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
}

.invoice-table-scroll thead .select-cell {
  z-index: 5;
  background: #f2f7f7;
}

.invoice-check {
  width: 17px;
  height: 17px;
  accent-color: #0f6f66;
  cursor: pointer;
}

.invoice-table-scroll tbody tr.selected {
  background: linear-gradient(90deg, rgba(15, 111, 102, 0.12), rgba(15, 111, 102, 0.035));
}

.invoice-file-button {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 34px;
  padding: 0 10px 0 6px;
  border: 1px solid #dce7e9;
  border-radius: 11px;
  background: #f8fbfb;
  color: #203047;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.invoice-file-button:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 111, 102, 0.32);
  background: #eef8f6;
}

.file-type-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 7px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f6f66, #6f9fac);
  color: white;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.invoice-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 720;
}

.invoice-note-input {
  width: 100%;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 10px;
  color: #263348;
  background: #f4f8f8;
  font-size: 13px;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.invoice-note-input:focus {
  outline: none;
  border-color: rgba(15, 111, 102, 0.45);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 111, 102, 0.1);
}

.bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 5px 4px 10px;
  border: 1px solid rgba(15, 111, 102, 0.16);
  border-radius: 13px;
  background: #eff8f6;
}

.bulk-actions[hidden] {
  display: none;
}

.bulk-actions span {
  color: #0f6f66;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.bulk-actions .btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12.5px;
}

.invoice-preview-panel {
  width: min(1120px, 96vw);
  max-width: 1120px;
  max-height: 92vh;
}

.invoice-preview-body {
  min-height: 68vh;
  padding: 14px;
  background: #f3f7f8;
}

.invoice-preview-frame {
  display: block;
  width: 100%;
  height: 74vh;
  border: 1px solid #d9e4e6;
  border-radius: 14px;
  background: white;
}

.invoice-preview-image {
  display: block;
  max-width: 100%;
  max-height: 74vh;
  margin: 0 auto;
  border-radius: 14px;
  box-shadow: 0 18px 52px rgba(18, 30, 44, 0.18);
  background: white;
}

.preview-fallback {
  min-height: 52vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #5e6d80;
  text-align: center;
}

.preview-fallback strong {
  color: #172033;
  font-size: 18px;
}

@media (max-width: 1280px) {
  .invoice-results-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  }
}

@media (max-width: 1024px) {
  main {
    padding-inline: 16px;
  }

  .invoice-results-layout {
    grid-template-columns: 1fr;
  }

  .invoice-alerts-panel {
    height: 360px;
    min-height: 360px;
  }

  .invoice-analytics .analysis-card.status-card,
  .invoice-analytics .analysis-card:nth-child(2),
  .invoice-analytics .analysis-card:nth-child(3),
  .invoice-analytics .analysis-card:nth-child(4),
  .invoice-analytics .analysis-card:nth-child(5),
  .invoice-analytics .analysis-card:nth-child(6),
  .invoice-analytics .analysis-card:nth-child(7),
  .invoice-analytics .analysis-card.insight-panel {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .invoice-analytics .analysis-card.status-card,
  .invoice-analytics .analysis-card:nth-child(2),
  .invoice-analytics .analysis-card:nth-child(3),
  .invoice-analytics .analysis-card:nth-child(4),
  .invoice-analytics .analysis-card:nth-child(5),
  .invoice-analytics .analysis-card:nth-child(6),
  .invoice-analytics .analysis-card:nth-child(7),
  .invoice-analytics .analysis-card.insight-panel {
    grid-column: 1 / -1;
  }

  .table-header-left {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .invoice-preview-panel {
    width: 98vw;
  }
}

/* 打印样式 */
@media print {
  .topbar,
  .command-actions,
  .section-actions,
  .btn {
    display: none;
  }

  body {
    background: white;
  }

  .panel,
  .table-container {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* === Invoice UI v2: dense financial workspace === */
.quick-workbar {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

main {
  padding-top: 28px;
}

.view[data-view="invoice"] {
  --invoice-line: #dfe6ed;
  --invoice-soft: #f6f8fa;
  --invoice-ink: #172033;
  --invoice-muted: #6b7688;
}

.view[data-view="invoice"] .section-header {
  margin-bottom: 16px;
  padding: 0 2px;
}

.view[data-view="invoice"] .section-title h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--invoice-ink);
}

.view[data-view="invoice"] .section-title p {
  color: var(--invoice-muted);
  font-size: 14px;
}

.view[data-view="invoice"] .section-actions {
  gap: 8px;
}

.view[data-view="invoice"] .section-actions .btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
}

.invoice-import-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px;
  margin-bottom: 14px;
  border-radius: 14px;
  border-color: var(--invoice-line);
  box-shadow: 0 10px 24px rgba(24, 36, 56, 0.04);
}

.invoice-import-panel .file-drop-zone {
  min-height: 66px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 10px 12px;
  border-width: 1px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfcfd 0%, #f6f8fb 100%);
}

.invoice-import-panel .file-drop-zone:hover,
.invoice-import-panel .file-drop-zone.drag-over {
  background: #f2faf8;
  border-color: rgba(31, 122, 116, 0.45);
  box-shadow: inset 0 0 0 1px rgba(31, 122, 116, 0.08);
}

.file-drop-icon {
  width: 30px;
  height: 30px;
  color: #8da0b3;
}

.file-drop-copy {
  min-width: 0;
}

.file-drop-text {
  font-size: 14px;
  line-height: 1.25;
}

.file-drop-hint {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
}

.upload-actions .btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12.5px;
}

.queue-summary {
  grid-column: 1 / -1;
  min-height: unset;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.paste-details {
  height: 34px;
  display: inline-flex;
  align-items: center;
  align-self: center;
  padding: 0 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.paste-details[open] {
  display: block;
  height: auto;
  grid-column: 1 / -1;
}

.paste-details summary {
  font-size: 12.5px;
}

.invoice-analytics {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.analysis-card {
  min-height: 172px;
  padding: 14px;
  border-radius: 14px;
  border-color: var(--invoice-line);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
  box-shadow: 0 10px 26px rgba(24, 36, 56, 0.045);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.analysis-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 122, 116, 0.22);
  box-shadow: 0 16px 34px rgba(24, 36, 56, 0.08);
}

.analysis-card.status-card,
.analysis-card:nth-child(2) {
  grid-column: span 3;
}

.analysis-card.analysis-wide {
  grid-column: span 3;
}

.analysis-card.insight-panel {
  grid-column: span 6;
}

.analysis-head {
  margin-bottom: 12px;
}

.analysis-head span {
  color: #66758a;
  font-size: 12px;
}

.analysis-head strong {
  font-size: 18px;
  color: var(--invoice-ink);
  font-variant-numeric: tabular-nums;
}

.status-ring {
  width: 112px;
  height: 112px;
  background: conic-gradient(#12b981 0deg var(--pass), #e9b949 var(--pass) calc(var(--pass) + var(--review)), #e5eaf0 calc(var(--pass) + var(--review)) 360deg);
  animation: ringSpin 760ms cubic-bezier(0.16, 1, 0.3, 1);
}

.status-ring::after {
  inset: 13px;
}

.status-ring span {
  font-size: 18px;
}

.analysis-legend {
  margin-top: 12px;
  font-size: 12px;
}

.risk-pill-list,
.insight-action-list,
.analysis-bars {
  gap: 8px;
}

.risk-pill {
  min-height: 34px;
  padding: 8px 10px;
  background: #f6f8fa;
  border: 1px solid transparent;
}

.risk-pill strong {
  font-size: 14px;
}

.analysis-bar-row {
  grid-template-columns: minmax(72px, 0.85fr) minmax(90px, 1fr) minmax(68px, auto);
  gap: 9px;
}

.analysis-bar-row span,
.analysis-bar-row strong {
  font-size: 12px;
}

.analysis-track {
  height: 7px;
  background: #edf1f5;
}

.analysis-track i {
  transform-origin: left center;
  animation: barGrow 680ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.spark-bars {
  height: 122px;
  gap: 7px;
}

.spark-col i {
  background: linear-gradient(180deg, #1f7a74 0%, #2f5f98 100%);
  animation: sparkRise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-origin: bottom center;
}

.spark-col span {
  font-size: 10.5px;
}

.insight-action {
  font-size: 13px;
  line-height: 1.45;
}

.insight-action i {
  width: 20px;
  height: 20px;
}

.invoice-filter-bar {
  position: sticky;
  top: 73px;
  z-index: 40;
  padding: 9px 10px;
  margin-bottom: 12px;
  border-color: var(--invoice-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px) saturate(170%);
  box-shadow: 0 10px 28px rgba(24, 36, 56, 0.06);
}

.invoice-filter-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 112px 112px 112px 184px 132px 38px;
  gap: 7px;
  align-items: center;
}

.filter-search-input,
.filter-select,
.filter-amount,
.filter-reset-btn {
  height: 36px;
  border-color: #dfe6ed;
  background: #f8fafc;
  border-radius: 10px;
}

.filter-search-input {
  padding-top: 0;
  padding-bottom: 0;
  font-size: 13px;
}

.filter-select {
  min-width: 0;
  width: 100%;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 12.5px;
}

.filter-amount {
  width: 100%;
}

.filter-amount-input {
  width: 72px;
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 12.5px;
}

.filter-reset-btn {
  width: 38px;
  padding: 0;
}

.invoice-chipbar {
  margin-top: 8px;
  padding-top: 8px;
}

.filter-chip {
  isolation: isolate;
  height: 28px;
  padding: 0 11px !important;
  font-size: 12px !important;
  border-radius: 999px;
}

.filter-chip::before {
  z-index: -1;
}

.filter-count {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  font-size: 12px;
}

.invoice-results-layout {
  grid-template-columns: minmax(0, 4.2fr) minmax(260px, 300px);
  gap: 12px;
}

.invoice-table-container,
.invoice-alerts-panel {
  border-color: var(--invoice-line);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(24, 36, 56, 0.05);
}

.invoice-table-container {
  max-height: 620px;
}

.invoice-table-container .table-header,
.alerts-header {
  height: 48px;
  padding: 0 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.table-header-left h3,
.alerts-header h3 {
  font-size: 14px;
}

.table-header-hint {
  font-size: 11.5px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.invoice-table-scroll {
  max-height: 572px;
}

.invoice-table-scroll table {
  min-width: 1040px;
  border-collapse: separate;
  border-spacing: 0;
}

.invoice-table-scroll thead {
  background: #f4f7fa;
}

.invoice-table-scroll th {
  height: 38px;
  padding: 0 12px;
  font-size: 11.5px;
  border-bottom: 1px solid var(--invoice-line);
}

.invoice-table-scroll td {
  height: 40px;
  padding: 0 12px;
  font-size: 12.5px;
  border-bottom: 1px solid #eef2f5;
}

.invoice-table-scroll tbody tr:nth-child(even) {
  background: #fbfcfd;
}

.invoice-table-scroll tbody tr:hover {
  background: #eef8f6;
}

.invoice-table-scroll th.draggable::after {
  content: '⋮⋮';
  margin-left: 7px;
  color: #b7c1cd;
  font-weight: 400;
  letter-spacing: -3px;
}

.invoice-alerts-panel {
  max-height: 620px;
}

.invoice-alerts-scroll {
  max-height: 572px;
  padding: 10px;
}

.invoice-alerts-scroll .alert-item {
  padding: 10px 12px;
  border-left-width: 3px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.45;
}

.alerts-count {
  min-width: 22px;
  height: 20px;
  font-size: 11.5px;
}

.modal-panel {
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(12, 23, 38, 0.24);
}

.column-picker-item {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
}

.column-picker-label {
  font-size: 13px;
}

@keyframes barGrow {
  from { transform: scaleX(0); opacity: 0.35; }
  to { transform: scaleX(1); opacity: 1; }
}

@keyframes sparkRise {
  from { transform: scaleY(0.08); opacity: 0.35; }
  to { transform: scaleY(1); opacity: 1; }
}

@media (max-width: 1280px) {
  .invoice-filter-row {
    grid-template-columns: minmax(260px, 1fr) repeat(3, 112px) 184px 38px;
  }
  .invoice-filter-row #invoiceSort {
    grid-column: 2 / 3;
  }
  .invoice-results-layout {
    grid-template-columns: minmax(0, 3fr) minmax(240px, 280px);
  }
}

@media (max-width: 1024px) {
  .invoice-filter-row {
    grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(110px, 1fr));
  }
  .filter-amount,
  .filter-reset-btn {
    width: 100%;
  }
  .invoice-results-layout {
    grid-template-columns: 1fr;
  }
  .invoice-alerts-panel {
    max-height: 360px;
  }
}

@media (max-width: 768px) {
  .view[data-view="invoice"] .section-header {
    align-items: stretch;
  }
  .invoice-import-panel {
    grid-template-columns: 1fr;
  }
  .invoice-import-panel .file-drop-zone {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .invoice-filter-bar {
    position: static;
  }
  .invoice-filter-row {
    grid-template-columns: 1fr;
  }
  .invoice-chipbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .analysis-card,
  .analysis-card.status-card,
  .analysis-card:nth-child(2),
  .analysis-card.analysis-wide,
  .analysis-card.insight-panel {
    grid-column: 1 / -1;
  }
}

/* Invoice UI v2 follow-up: chart containment and stable alert rail */
.analysis-card {
  overflow: hidden;
}

.spark-bars {
  display: grid !important;
  grid-auto-flow: column;
  grid-auto-columns: minmax(34px, 1fr);
  align-items: end;
  gap: 10px;
  height: 116px !important;
  padding: 4px 2px 0;
  overflow: hidden;
}

.spark-col {
  display: flex !important;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  overflow: hidden;
}

.spark-col i {
  flex: 0 0 auto;
  width: 100%;
  max-height: 92px;
}

.spark-col span {
  flex: 0 0 auto;
  height: 18px;
  margin-top: 6px !important;
  line-height: 18px;
}

.invoice-alerts-panel {
  height: 620px;
  min-height: 620px;
}

.invoice-alerts-scroll {
  min-height: 0;
}

.invoice-alerts-scroll .empty-state,
.invoice-alerts-scroll .alert-item.ok {
  min-height: 120px;
}

@media (max-width: 1024px) {
  .invoice-alerts-panel {
    height: 360px;
    min-height: 360px;
  }
}

/* Invoice UI v2c: first-screen operational priority */
.invoice-analytics {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  max-height: 382px;
  overflow: hidden;
}

.analysis-card {
  min-height: 148px;
}

.analysis-card.status-card,
.analysis-card:nth-child(2),
.analysis-card.analysis-wide {
  grid-column: span 3;
}

.analysis-card.insight-panel {
  grid-column: span 6;
  min-height: 132px;
}

.status-ring {
  width: 92px;
  height: 92px;
}

.status-ring::after {
  inset: 11px;
}

.status-ring span {
  font-size: 16px;
}

.analysis-legend {
  margin-top: 8px;
}

.spark-bars {
  height: 84px !important;
}

.spark-col i {
  max-height: 62px;
}

.risk-pill-list,
.analysis-bars,
.insight-action-list {
  max-height: 94px;
  overflow: hidden;
}

.invoice-filter-bar {
  position: sticky;
  top: 72px;
}

@media (max-width: 1024px) {
  .invoice-analytics {
    max-height: none;
  }
}

/* === Design skill pass: premium finance workspace === */
:root {
  --bg-primary: #f4f7f8;
  --bg-tertiary: #eef3f4;
  --surface: #ffffff;
  --surface-hover: #f7fbfa;
  --border-light: #dfe7e8;
  --border-medium: #c9d6d8;
  --text-primary: #17202f;
  --text-secondary: #4e5d70;
  --text-tertiary: #8290a3;
  --brand-primary: #0f6f66;
  --brand-secondary: #274a72;
  --brand-accent: #c89432;
  --brand-gradient: linear-gradient(135deg, #0f6f66 0%, #274a72 64%, #c89432 100%);
  --shadow-sm: 0 8px 22px rgba(24, 38, 56, 0.07);
  --shadow-md: 0 14px 34px rgba(24, 38, 56, 0.1);
  --shadow-lg: 0 24px 60px rgba(24, 38, 56, 0.14);
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(15, 111, 102, 0.11), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(200, 148, 50, 0.1), transparent 26%),
    linear-gradient(180deg, #f8faf9 0%, #eef4f3 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 32, 47, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 47, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 62%);
}

.topbar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(201, 214, 216, 0.8);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.brand-icon {
  border-radius: 13px;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.44), transparent 34%),
    var(--brand-gradient);
  box-shadow: 0 13px 28px rgba(15, 111, 102, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.brand-name {
  color: #142033;
  letter-spacing: 0;
}

.brand-subtitle {
  color: #7a8798;
}

.nav-tabs {
  gap: 8px;
}

.nav-btn {
  height: 38px;
  padding: 0 17px;
  border-radius: 999px;
  color: #536176;
  font-weight: 650;
}

.nav-btn:hover {
  background: rgba(15, 111, 102, 0.07);
  color: #173143;
}

.nav-btn.active {
  color: #0f6f66;
  background: linear-gradient(180deg, rgba(15, 111, 102, 0.13), rgba(15, 111, 102, 0.06));
  box-shadow: inset 0 0 0 1px rgba(15, 111, 102, 0.08);
}

.nav-btn.active::after {
  bottom: 1px;
  height: 2px;
  width: 24px;
  background: #0f6f66;
}

main {
  padding-top: 30px;
}

.view.active {
  animation: premiumPageIn 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes premiumPageIn {
  from { opacity: 0; transform: translateY(12px); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.view[data-view="invoice"] {
  --invoice-line: #d7e1e3;
  --invoice-soft: #f2f7f7;
  --invoice-ink: #142033;
  --invoice-muted: #64748b;
  --invoice-panel-shadow: 0 18px 44px rgba(24, 38, 56, 0.09);
}

.view[data-view="invoice"] .section-header {
  align-items: flex-end;
  margin-bottom: 17px;
}

.view[data-view="invoice"] .section-title h2 {
  color: var(--invoice-ink);
  font-size: 29px;
  font-weight: 850;
  letter-spacing: 0;
}

.view[data-view="invoice"] .section-title p {
  color: #66758a;
  font-size: 14px;
}

.view[data-view="invoice"] .section-actions {
  padding: 5px;
  border: 1px solid rgba(215, 225, 227, 0.88);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 26px rgba(24, 38, 56, 0.06);
}

.view[data-view="invoice"] .section-actions .btn {
  height: 36px;
  min-width: 66px;
  border-radius: 12px;
  border-color: transparent;
  color: #526278;
  background: transparent;
}

.view[data-view="invoice"] .section-actions .btn:hover {
  transform: translateY(-1px);
  background: #f3f8f8;
  color: var(--invoice-ink);
}

.view[data-view="invoice"] .section-actions .btn-primary {
  color: white;
  background: linear-gradient(135deg, #0f6f66, #6f9fac);
  box-shadow: 0 12px 24px rgba(15, 111, 102, 0.24);
}

.view[data-view="invoice"] .section-actions .danger-action {
  color: #b94b4b;
}

.invoice-import-panel {
  margin-bottom: 14px;
  padding: 9px;
  border: 1px solid rgba(215, 225, 227, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 36px rgba(24, 38, 56, 0.07);
  backdrop-filter: blur(16px) saturate(150%);
}

.invoice-import-panel .file-drop-zone {
  min-height: 62px;
  border: 1px dashed #bdd0d2;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(15, 111, 102, 0.06), transparent 40%),
    #fbfdfd;
}

.invoice-import-panel .file-drop-zone:hover,
.invoice-import-panel .file-drop-zone.drag-over {
  background:
    linear-gradient(90deg, rgba(15, 111, 102, 0.12), rgba(200, 148, 50, 0.08)),
    #ffffff;
  border-color: #73aaa4;
  transform: translateY(-1px);
}

.file-drop-icon {
  color: #7994a2;
}

.file-drop-text {
  color: #243247;
  font-weight: 750;
}

.file-drop-hint {
  color: #7d8a9b;
}

.queue-summary {
  border-color: rgba(15, 111, 102, 0.18);
  background: linear-gradient(135deg, rgba(15, 111, 102, 0.08), rgba(200, 148, 50, 0.08));
}

.paste-details {
  border-color: #d8e2e3;
  background: #fbfdfd;
}

.invoice-analytics {
  gap: 13px;
  margin-bottom: 13px;
  max-height: none;
}

.invoice-analytics .analysis-card.status-card,
.invoice-analytics .analysis-card:nth-child(2),
.invoice-analytics .analysis-card:nth-child(3),
.invoice-analytics .analysis-card:nth-child(4) {
  grid-column: span 3;
}

.invoice-analytics .analysis-card:nth-child(5),
.invoice-analytics .analysis-card:nth-child(6),
.invoice-analytics .analysis-card:nth-child(7) {
  grid-column: span 4;
}

.invoice-analytics .analysis-card.insight-panel {
  grid-column: span 12;
  min-height: 118px;
}

.analysis-card {
  position: relative;
  min-height: 154px;
  overflow: hidden;
  border: 1px solid rgba(215, 225, 227, 0.95);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 251, 0.96)),
    #ffffff;
  box-shadow: var(--invoice-panel-shadow);
  animation: premiumCardIn 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.analysis-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #0f6f66, #86b7b1, #c89432);
  opacity: 0;
  transform: translateX(-22%);
  transition: opacity 180ms ease, transform 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

.analysis-card:hover::before {
  opacity: 1;
  transform: translateX(0);
}

.analysis-card:hover {
  transform: translateY(-3px);
  border-color: rgba(15, 111, 102, 0.25);
  box-shadow: 0 24px 56px rgba(24, 38, 56, 0.13);
}

.analysis-card:nth-child(2) { animation-delay: 35ms; }
.analysis-card:nth-child(3) { animation-delay: 70ms; }
.analysis-card:nth-child(4) { animation-delay: 105ms; }
.analysis-card:nth-child(5) { animation-delay: 140ms; }
.analysis-card:nth-child(6) { animation-delay: 175ms; }
.analysis-card:nth-child(7) { animation-delay: 210ms; }
.analysis-card:nth-child(8) { animation-delay: 245ms; }

@keyframes premiumCardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.analysis-head span {
  color: #66758a;
  font-weight: 750;
}

.analysis-head strong {
  color: #243247;
  font-size: 19px;
  font-weight: 850;
}

.status-ring {
  width: 98px;
  height: 98px;
  background: conic-gradient(#13b58f 0deg var(--pass), #d99a2b var(--pass) calc(var(--pass) + var(--review)), #e2eaec calc(var(--pass) + var(--review)) 360deg);
  box-shadow: inset 0 0 0 1px rgba(15, 111, 102, 0.08), 0 12px 28px rgba(15, 111, 102, 0.14);
}

.status-ring::after {
  background: linear-gradient(180deg, #ffffff, #f4faf9);
}

.status-ring span {
  color: #142033;
  font-size: 17px;
}

.analysis-legend {
  color: #657589;
  font-weight: 650;
}

.risk-pill {
  background: #f4f8f8;
  border: 1px solid #e4ecee;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.risk-pill:hover {
  transform: translateX(3px);
  border-color: rgba(15, 111, 102, 0.22);
  background: #f0faf8;
}

.risk-pill span,
.analysis-bar-row span {
  color: #5f6f82;
}

.risk-pill strong,
.analysis-bar-row strong {
  color: #29364a;
  font-weight: 800;
}

.analysis-track {
  height: 8px;
  background: #edf3f4;
}

.analysis-track i {
  background: linear-gradient(90deg, #dce9ea 0%, #78aaa5 44%, #0f6f66 100%);
}

.spark-bars {
  height: 90px !important;
  gap: 9px;
}

.spark-col i {
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #8fc5be 0%, #0f6f66 100%);
  box-shadow: 0 10px 22px rgba(15, 111, 102, 0.16);
}

.spark-col:nth-child(even) i {
  background: linear-gradient(180deg, #b8cde5 0%, #274a72 100%);
}

.spark-col span {
  color: #8a98aa;
  font-weight: 700;
}

.insight-action-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.insight-action {
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #e2ebec;
  border-radius: 12px;
  background: #f7fbfb;
  color: #4f6074;
}

.insight-action i {
  background: linear-gradient(135deg, rgba(15, 111, 102, 0.16), rgba(200, 148, 50, 0.14));
  color: #0f6f66;
}

.invoice-filter-bar {
  top: 72px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid rgba(215, 225, 227, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 42px rgba(24, 38, 56, 0.09);
  backdrop-filter: blur(18px) saturate(170%);
  animation: filterDockIn 500ms 120ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.invoice-filter-row {
  grid-template-columns: minmax(320px, 1.35fr) minmax(108px, 0.36fr) minmax(108px, 0.36fr) minmax(108px, 0.36fr) minmax(180px, 0.58fr) minmax(126px, 0.42fr) 38px;
  gap: 8px;
}

.filter-search-input,
.filter-select,
.filter-amount,
.filter-reset-btn {
  height: 38px;
  border-color: #d8e2e3;
  background: #f7fbfb;
  color: #263348;
}

.filter-search-input,
.filter-select,
.filter-amount-input {
  font-weight: 620;
}

.filter-search-input:focus,
.filter-select:focus,
.filter-amount:focus-within {
  border-color: rgba(15, 111, 102, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 111, 102, 0.11);
}

.filter-search-input::placeholder,
.filter-amount-input::placeholder {
  color: #98a5b5;
}

.filter-reset-btn:hover {
  color: #0f6f66;
  background: #eef8f6;
  border-color: rgba(15, 111, 102, 0.32);
  transform: rotate(-80deg) scale(1.03);
}

.invoice-chipbar {
  border-top-color: #e3ebed;
}

.invoice-chipbar .quick-filter-chips {
  gap: 7px;
}

.filter-chip {
  border: 1px solid transparent;
  background: #f2f7f7;
  color: #5f6d80;
  font-weight: 750;
}

.filter-chip:hover {
  border-color: rgba(15, 111, 102, 0.2);
  background: #ecf7f5;
  color: #0f6f66;
}

.filter-chip.active {
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 111, 102, 0.22);
}

.filter-chip.active::before {
  background: linear-gradient(135deg, #0f6f66, #6d9ea9);
}

.filter-count {
  background: #f2f7f7;
  color: #617184;
  font-weight: 760;
}

.invoice-results-layout {
  grid-template-columns: minmax(0, 4.65fr) minmax(248px, 286px);
  gap: 13px;
}

.invoice-table-container,
.invoice-alerts-panel {
  border: 1px solid rgba(215, 225, 227, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--invoice-panel-shadow);
}

.invoice-table-container {
  max-height: 662px;
}

.invoice-table-container .table-header,
.alerts-header {
  height: 50px;
  border-bottom-color: #e2eaec;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9fa 100%);
}

.table-header-left h3,
.alerts-header h3 {
  color: #253348;
  font-size: 14.5px;
  font-weight: 850;
}

.table-header-hint {
  color: #8b98a8;
  font-weight: 650;
}

.btn-icon {
  color: #64748b;
  background: #f7fbfb;
  border-color: #dce6e8;
}

.btn-icon:hover {
  color: #0f6f66;
  background: #edf8f6;
  border-color: rgba(15, 111, 102, 0.28);
  transform: translateY(-1px);
}

.invoice-table-scroll {
  max-height: 612px;
}

.invoice-table-scroll table {
  min-width: 1180px;
  table-layout: fixed;
}

.invoice-table-scroll thead {
  background: #f2f7f7;
}

.invoice-table-scroll th {
  height: 42px;
  padding: 0 13px;
  color: #607083;
  border-bottom: 1px solid #dfe8ea;
  font-size: 11.5px;
  font-weight: 850;
}

.invoice-table-scroll td {
  height: 44px;
  padding: 0 13px;
  color: #354259;
  border-bottom: 1px solid #edf2f3;
  font-size: 12.75px;
  font-weight: 560;
}

.invoice-table-scroll tbody tr {
  background: #ffffff;
}

.invoice-table-scroll tbody tr:nth-child(even) {
  background: #fbfdfd;
}

.invoice-table-scroll tbody tr:hover {
  background: linear-gradient(90deg, rgba(15, 111, 102, 0.075), rgba(15, 111, 102, 0.025));
}

.invoice-table-scroll tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 #0f6f66;
}

.invoice-table-scroll td .cell-money {
  color: #172033;
  font-weight: 820;
}

.invoice-table-scroll td .cell-muted {
  color: #68778a;
}

.invoice-table-scroll .badge {
  height: 23px;
  padding: 0 9px;
  font-weight: 800;
}

.invoice-alerts-panel {
  height: 662px;
  min-height: 662px;
}

.alerts-count {
  min-width: 24px;
  color: #b87514;
  background: #fff7e6;
  border-color: #f3d49b;
  font-weight: 850;
}

.alerts-count.zero {
  color: #0f8f72;
  background: #e9faf4;
  border-color: #b7ead8;
}

.invoice-alerts-scroll {
  max-height: 612px;
  padding: 12px;
}

.invoice-alerts-scroll .alert-item {
  position: relative;
  padding: 12px 13px 12px 14px;
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: 13px;
  box-shadow: 0 10px 20px rgba(24, 38, 56, 0.035);
}

.invoice-alerts-scroll .alert-item.ok {
  min-height: 132px;
  border-color: #bde8db;
  background:
    radial-gradient(circle at 80% 20%, rgba(19, 181, 143, 0.12), transparent 40%),
    #effaf6;
  color: #21463f;
}

.invoice-alerts-scroll .alert-item.warn {
  border-color: #f1dbac;
  background: #fff9ed;
}

.invoice-alerts-scroll .alert-item.danger {
  border-color: #efc3c3;
  background: #fff4f4;
}

.empty-state-title {
  color: #59687b;
}

.empty-state-description,
.mini-empty,
.empty-analytics {
  color: #8694a6;
}

@media (max-width: 1280px) {
  .invoice-filter-row {
    grid-template-columns: minmax(270px, 1fr) repeat(3, minmax(105px, 0.34fr)) minmax(170px, 0.5fr) 38px;
  }

  .invoice-filter-row #invoiceSort {
    grid-column: auto;
  }

  .invoice-results-layout {
    grid-template-columns: minmax(0, 3.6fr) minmax(238px, 270px);
  }
}

@media (max-width: 1024px) {
  .view[data-view="invoice"] .section-header {
    align-items: flex-start;
  }

  .view[data-view="invoice"] .section-actions {
    width: 100%;
  }

  .invoice-filter-row {
    grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(112px, 1fr));
  }

  .invoice-results-layout {
    grid-template-columns: 1fr;
  }

  .invoice-analytics .analysis-card.status-card,
  .invoice-analytics .analysis-card:nth-child(2),
  .invoice-analytics .analysis-card:nth-child(3),
  .invoice-analytics .analysis-card:nth-child(4),
  .invoice-analytics .analysis-card:nth-child(5),
  .invoice-analytics .analysis-card:nth-child(6),
  .invoice-analytics .analysis-card:nth-child(7),
  .invoice-analytics .analysis-card.insight-panel {
    grid-column: span 6;
  }

  .insight-action-list {
    grid-template-columns: 1fr;
  }

  .invoice-alerts-panel {
    height: 360px;
    min-height: 360px;
  }
}

@media (max-width: 768px) {
  main {
    padding-top: 22px;
  }

  .view[data-view="invoice"] .section-actions {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .invoice-filter-row {
    grid-template-columns: 1fr;
  }

  .invoice-analytics .analysis-card.status-card,
  .invoice-analytics .analysis-card:nth-child(2),
  .invoice-analytics .analysis-card:nth-child(3),
  .invoice-analytics .analysis-card:nth-child(4),
  .invoice-analytics .analysis-card:nth-child(5),
  .invoice-analytics .analysis-card:nth-child(6),
  .invoice-analytics .analysis-card:nth-child(7),
  .invoice-analytics .analysis-card.insight-panel {
    grid-column: 1 / -1;
  }

  .invoice-chipbar {
    align-items: stretch;
  }

  .invoice-chipbar .quick-filter-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .filter-count {
    width: fit-content;
  }
}


/* PDF.js canvas invoice preview */
.pdf-preview-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 68vh;
}

.pdf-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #dce7e9;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 22px rgba(18, 30, 44, 0.05);
}

.pdf-preview-toolbar .btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12.5px;
}

.pdf-status {
  min-width: 148px;
  color: #35465c;
  font-size: 13px;
  font-weight: 820;
  text-align: center;
}

.pdf-canvas-wrap {
  min-height: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid #d9e4e6;
  border-radius: 14px;
  background:
    linear-gradient(45deg, #eef3f4 25%, transparent 25%),
    linear-gradient(-45deg, #eef3f4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f4 75%),
    linear-gradient(-45deg, transparent 75%, #eef3f4 75%),
    #f8fbfb;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.pdf-preview-canvas {
  display: block;
  max-width: none;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 18px 54px rgba(18, 30, 44, 0.2);
}

@media (max-width: 768px) {
  .pdf-preview-toolbar {
    flex-wrap: wrap;
  }

  .pdf-status {
    order: -1;
    width: 100%;
  }
}

/* ============================================================
   UI Upgrade v2 — 最终覆盖层
   目的：修复字号偏小、按钮混淆、表格列压缩、缺乏图表可视化
   规则：只加、不改；用较高选择器和 !important 覆盖历史遗留
   ============================================================ */

:root {
  --brand-1: #1f7a74;
  --brand-2: #2f5f98;
  --brand-3: #d0a24c;
  --brand-1-strong: #175f5a;
  --brand-1-soft: #e8f4f2;
  --ease-out-quart: cubic-bezier(0.25, 1, 0.32, 1);
  --shadow-brand: 0 8px 24px -6px rgba(31, 122, 116, 0.35), 0 2px 6px -2px rgba(31, 122, 116, 0.25);
  --shadow-brand-hover: 0 14px 34px -8px rgba(31, 122, 116, 0.45), 0 4px 10px -2px rgba(31, 122, 116, 0.28);
}

/* ---------- 全局字号基线拉大 ---------- */
body { font-size: 15px; line-height: 1.6; letter-spacing: 0.005em; color: var(--text-primary); }
h1 { font-size: 30px; letter-spacing: -0.01em; }
h2 { font-size: 24px; letter-spacing: -0.01em; }
h3 { font-size: 18px; }
.section-title h2 { font-size: 26px !important; font-weight: 700 !important; letter-spacing: -0.015em; }
.section-title p { font-size: 15px !important; color: var(--text-secondary); margin-top: 6px; }

/* ---------- 按钮体系重塑：主/次/幽灵一眼可辨 ---------- */
.btn { font-size: 15px !important; font-weight: 600 !important; letter-spacing: 0.01em; padding: 11px 22px !important; border-radius: 12px !important; transition: transform var(--duration-base) var(--ease-out-quart), box-shadow var(--duration-base) var(--ease-out-quart), background var(--duration-fast) ease, color var(--duration-fast) ease, border-color var(--duration-fast) ease !important; }
.btn-sm { font-size: 14px !important; padding: 8px 16px !important; border-radius: 10px !important; }
.btn-lg { font-size: 16px !important; padding: 14px 28px !important; }

.btn-primary { background: linear-gradient(135deg, #1f7a74 0%, #2f5f98 100%) !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.14) !important; box-shadow: var(--shadow-brand) !important; text-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.btn-primary::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,0.14), transparent 55%); pointer-events: none; }
.btn-primary { position: relative; overflow: hidden; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-brand-hover) !important; filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0) scale(0.98); box-shadow: 0 4px 12px -4px rgba(31,122,116,0.4) !important; }
.btn-primary:focus-visible { outline: 3px solid rgba(47,95,152,0.45); outline-offset: 2px; }

.btn-secondary { background: #ffffff !important; color: var(--brand-1-strong) !important; border: 1.5px solid var(--brand-1) !important; box-shadow: 0 1px 2px rgba(31,122,116,0.08) !important; }
.btn-secondary:hover { background: var(--brand-1-soft) !important; border-color: var(--brand-1-strong) !important; color: var(--brand-1-strong) !important; transform: translateY(-1px); box-shadow: 0 4px 10px -2px rgba(31,122,116,0.15) !important; }
.btn-secondary:active { transform: translateY(0); }

.btn-ghost { background: transparent !important; color: var(--text-secondary) !important; border: 1px solid var(--border-light) !important; box-shadow: none !important; }
.btn-ghost:hover { background: var(--surface-hover) !important; color: var(--text-primary) !important; border-color: var(--border-medium) !important; }
.btn-ghost.danger-action { color: #b91c1c !important; border-color: #fecaca !important; }
.btn-ghost.danger-action:hover { background: #fef2f2 !important; border-color: #ef4444 !important; }

/* 上传区的选择文件/文件夹按钮：给主按钮以真实"可点击"的凸起感 */
.upload-actions { gap: 12px !important; }
.upload-actions .btn-primary { padding: 12px 24px !important; font-size: 15px !important; }
.upload-actions .btn-secondary { padding: 12px 24px !important; font-size: 15px !important; }

/* section-actions 里的主按钮再强调一下 */
.section-actions { display: flex !important; gap: 10px !important; align-items: center !important; flex-wrap: wrap !important; }
.section-actions .btn-primary { box-shadow: var(--shadow-brand) !important; }

/* 顶部凭证管理"生成凭证"按钮之类：确保主 CTA 出彩 */
.section-actions .btn-primary::after { content: "→"; margin-left: 4px; opacity: 0.8; transition: transform var(--duration-fast); }
.section-actions .btn-primary:hover::after { transform: translateX(3px); }

/* ---------- 表格：字段宽度 + 中文横排 + 可排序表头 ---------- */
.table-container, .table-wrap, .table-wrapper { overflow-x: auto !important; }
table.data-table, .table-wrapper table { width: 100% !important; border-collapse: separate !important; border-spacing: 0 !important; min-width: max-content; }
table.data-table thead, .table-wrapper thead { background: linear-gradient(180deg, #f7f9fb, #eef2f6) !important; border-bottom: 1px solid var(--border-medium) !important; }
table.data-table th, .table-wrapper th { padding: 14px 18px !important; font-size: 13.5px !important; font-weight: 600 !important; color: var(--text-secondary) !important; text-transform: none !important; letter-spacing: 0.02em !important; white-space: nowrap !important; text-align: left !important; position: sticky; top: 0; background: inherit; z-index: 2; }
table.data-table td, .table-wrapper td { padding: 14px 18px !important; font-size: 14px !important; color: var(--text-primary) !important; border-bottom: 1px solid var(--border-light) !important; vertical-align: middle !important; }

/* 关键：破除中文一个字一行的竖排问题 */
table.data-table td, .table-wrapper td { word-break: normal !important; overflow-wrap: normal !important; }
table.data-table td.col-nowrap, .table-wrapper td.col-nowrap { white-space: nowrap !important; }
table.data-table th.col-nowrap, .table-wrapper th.col-nowrap { white-space: nowrap !important; }
table.data-table td.col-num, .table-wrapper td.col-num { text-align: right !important; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
table.data-table th.col-num, .table-wrapper th.col-num { text-align: right !important; }

/* 表格斑马纹 + 行悬浮反馈 */
table.data-table tbody tr:nth-child(even) { background: #fbfcfd; }
table.data-table tbody tr:hover, .table-wrapper tbody tr:hover { background: var(--brand-1-soft) !important; }

/* ---------- 可排序表头按钮 ---------- */
th.th-sortable { padding: 0 !important; }
th.th-sortable .th-sort-btn { display: inline-flex; align-items: center; gap: 8px; width: 100%; padding: 14px 18px; background: transparent; border: 0; cursor: pointer; font: inherit; color: inherit; text-align: inherit; transition: background var(--duration-fast) ease, color var(--duration-fast) ease; }
th.th-sortable .th-sort-btn:hover { background: rgba(31,122,116,0.08); color: var(--brand-1-strong); }
th.th-sortable .th-sort-btn:focus-visible { outline: 2px solid var(--brand-1); outline-offset: -2px; }
th.th-sortable .th-sort-ico { flex: none; opacity: 0.5; transition: opacity var(--duration-fast); }
th.th-sortable .th-sort-ico path { fill: currentColor; opacity: 0.35; transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease; }
th.th-sortable:hover .th-sort-ico { opacity: 0.8; }
th.th-sortable.sort-asc .th-sort-ico .ico-up,
th.th-sortable.sort-desc .th-sort-ico .ico-down { opacity: 1; }
th.th-sortable.sort-asc, th.th-sortable.sort-desc { color: var(--brand-1-strong) !important; background: rgba(31,122,116,0.06) !important; }
th.th-sortable.col-num .th-sort-btn { justify-content: flex-end; flex-direction: row-reverse; }

/* ---------- 卡片 & 面板：更柔的阴影，悬停轻微上浮 ---------- */
.panel, .flow-card, .table-container, .analysis-card, .invoice-import-panel { border-radius: 16px !important; border: 1px solid var(--border-light) !important; background: #fff !important; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04), 0 4px 20px -6px rgba(16, 24, 40, 0.05) !important; transition: transform var(--duration-base) var(--ease-out-quart), box-shadow var(--duration-base) var(--ease-out-quart), border-color var(--duration-fast) ease !important; }
.flow-card:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(16,24,40,0.06), 0 20px 40px -12px rgba(31,122,116,0.18) !important; border-color: rgba(31,122,116,0.35) !important; }

.panel-title, .table-header h3, .alerts-header h3 { font-size: 16px !important; font-weight: 700 !important; color: var(--text-primary) !important; letter-spacing: -0.005em; }
.table-header { padding: 16px 20px !important; border-bottom: 1px solid var(--border-light); }
.table-header-hint { font-size: 13px !important; color: var(--text-tertiary); }

/* ---------- 图表：水平条 + 折线区域 ---------- */
.chart-hbar { list-style: none; margin: 0; padding: 4px 0; display: flex; flex-direction: column; gap: 14px; }
.chart-hbar-row { display: flex; flex-direction: column; gap: 6px; animation: chartFadeUp 0.5s var(--ease-out-quart) both; animation-delay: calc(var(--i, 0) * 40ms); }
.chart-hbar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.chart-hbar-name { font-size: 13.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.chart-hbar-value { font-size: 13.5px; font-weight: 700; color: var(--brand-1-strong); font-variant-numeric: tabular-nums; }
.chart-hbar-track { height: 10px; background: #eef2f6; border-radius: 999px; overflow: hidden; position: relative; }
.chart-hbar-fill { display: block; height: 100%; background: linear-gradient(90deg, #1f7a74 0%, #2f5f98 65%, #d0a24c 100%); border-radius: inherit; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35); transform-origin: left center; animation: chartGrowX 0.7s var(--ease-out-quart) both; }
@keyframes chartGrowX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes chartFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.chart-spark { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 2px; }
.chart-spark svg { width: 100%; height: 160px; display: block; }
.chart-spark .spark-node circle { transition: r 150ms ease; }
.chart-spark .spark-node:hover circle { r: 6; }
.chart-spark-labels { display: flex; justify-content: space-between; padding: 0 8px; font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.chart-spark-labels span { text-align: center; }

.mini-empty { padding: 24px 16px; text-align: center; color: var(--text-tertiary); font-size: 13px; border: 1px dashed var(--border-light); border-radius: 12px; background: #fafbfc; }

/* ---------- badge 微调（保留原样） ---------- */
.badge { font-size: 12.5px !important; font-weight: 600 !important; padding: 4px 10px !important; letter-spacing: 0.01em; }

/* ---------- 差异提示条：警戒左侧色带更强 ---------- */
.alert-item { padding: 14px 18px !important; border-radius: 12px !important; border-left-width: 4px !important; background: #fff !important; box-shadow: 0 1px 2px rgba(16,24,40,0.04); font-size: 14px !important; line-height: 1.5; }
.alert-item.danger { border-left-color: #ef4444 !important; background: linear-gradient(90deg, #fff5f5, #ffffff 40%) !important; }
.alert-item.warn { border-left-color: #f59e0b !important; background: linear-gradient(90deg, #fffbeb, #ffffff 40%) !important; }
.alert-item.ok { border-left-color: #10b981 !important; background: linear-gradient(90deg, #ecfdf5, #ffffff 40%) !important; }
.alert-item.info { border-left-color: #3b82f6 !important; background: linear-gradient(90deg, #eff6ff, #ffffff 40%) !important; }

/* ---------- 工作台流程卡：更明确的可点击感 ---------- */
.flow-card { padding: 22px 22px 20px !important; cursor: pointer; }
.flow-card h3 { font-size: 17px !important; font-weight: 700 !important; letter-spacing: -0.005em; }
.flow-card p { font-size: 14px !important; color: var(--text-secondary); line-height: 1.55; margin-top: 6px; }
.flow-index { font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; font-weight: 700; color: var(--brand-3); letter-spacing: 0.08em; }

/* ---------- 顶部导航：更清晰 ---------- */
.nav-tabs .nav-btn { font-size: 14.5px !important; padding: 8px 16px !important; border-radius: 10px !important; transition: all var(--duration-fast) ease; }
.nav-tabs .nav-btn.active { background: linear-gradient(135deg, #1f7a74, #2f5f98) !important; color: #fff !important; box-shadow: 0 3px 10px -2px rgba(31,122,116,0.35); }
.nav-tabs .nav-btn:not(.active):hover { background: var(--brand-1-soft) !important; color: var(--brand-1-strong) !important; }

/* ---------- 输入框 + 文本域字号 ---------- */
.form-input, .form-textarea, .filter-select, .filter-search-input, .filter-amount-input { font-size: 14.5px !important; padding: 10px 14px !important; border-radius: 10px !important; border: 1px solid var(--border-medium) !important; transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.form-input:focus, .form-textarea:focus, .filter-select:focus, .filter-search-input:focus, .filter-amount-input:focus { border-color: var(--brand-1) !important; box-shadow: 0 0 0 3px rgba(31,122,116,0.14) !important; outline: none !important; }
.form-textarea { min-height: 96px !important; line-height: 1.55; }
.form-label { font-size: 13.5px !important; font-weight: 600 !important; color: var(--text-secondary) !important; margin-bottom: 8px !important; display: block; }

/* ---------- 文件拖入区：真正像可交互区 ---------- */
.file-drop-zone { border: 2px dashed var(--border-medium) !important; border-radius: 16px !important; padding: 28px 24px !important; background: linear-gradient(180deg, #fbfcfd 0%, #f7f9fb 100%) !important; transition: all var(--duration-base) var(--ease-out-quart) !important; }
.file-drop-zone:hover { border-color: var(--brand-1) !important; background: linear-gradient(180deg, #f0f9f7 0%, #ffffff 100%) !important; box-shadow: 0 6px 20px -8px rgba(31,122,116,0.28); }
.file-drop-text { font-size: 15px !important; font-weight: 600 !important; color: var(--text-primary) !important; }
.file-drop-hint { font-size: 13px !important; color: var(--text-tertiary) !important; }
.file-drop-icon { color: var(--brand-1); }

/* ---------- 筛选栏：呼吸感更强 ---------- */
.invoice-filter-bar { gap: 12px !important; padding: 16px !important; border-radius: 14px !important; }
.filter-chip { font-size: 13.5px !important; padding: 7px 14px !important; border-radius: 999px !important; transition: all var(--duration-fast) ease; }
.filter-chip.active { background: linear-gradient(135deg, #1f7a74, #2f5f98) !important; color: #fff !important; border-color: transparent !important; box-shadow: 0 2px 8px -1px rgba(31,122,116,0.35); }

/* ---------- 状态列徽章更醒目 ---------- */
.badge.ok, .badge-success { color: #047857 !important; background: #d1fae5 !important; border-color: #a7f3d0 !important; }
.badge.warn, .badge-warning { color: #b45309 !important; background: #fef3c7 !important; border-color: #fde68a !important; }
.badge.danger, .badge-error { color: #b91c1c !important; background: #fee2e2 !important; border-color: #fca5a5 !important; }

/* ---------- 凭证管理这类被压扁的表：给出最小列宽 ---------- */
#voucherTable table th, #voucherTable table td { min-width: 96px; }
#voucherTable table td[data-col="摘要"], #voucherTable table th[data-col="摘要"] { min-width: 220px; white-space: normal; }
#voucherTable table td[data-col="借方科目"], #voucherTable table th[data-col="借方科目"],
#voucherTable table td[data-col="贷方科目"], #voucherTable table th[data-col="贷方科目"] { min-width: 140px; white-space: nowrap; }
#voucherTable table td[data-col="附件"], #voucherTable table th[data-col="附件"] { min-width: 220px; }

#reconcileTable table th, #reconcileTable table td { min-width: 96px; }
#reconcileTable table td[data-col="对方户名"], #reconcileTable table th[data-col="对方户名"] { min-width: 180px; }
#reconcileTable table td[data-col="状态"], #reconcileTable table th[data-col="状态"] { min-width: 110px; }

#invoiceTable table th, #invoiceTable table td { min-width: 96px; }
#invoiceTable table td[data-col="购买方"], #invoiceTable table th[data-col="购买方"],
#invoiceTable table td[data-col="销售方"], #invoiceTable table th[data-col="销售方"] { min-width: 160px; white-space: normal; }
#invoiceTable table td[data-col="发票号码"], #invoiceTable table th[data-col="发票号码"] { min-width: 180px; }
#invoiceTable table td[data-col="项目名称"], #invoiceTable table th[data-col="项目名称"] { min-width: 140px; }
#invoiceTable table td[data-col="备注"], #invoiceTable table th[data-col="备注"] { min-width: 180px; }

/* ---------- 智能复核建议：轻量提示卡 ---------- */
.insight-panel .insight-item, .analysis-card ol, .analysis-card ol li { font-size: 13.5px !important; line-height: 1.55; }

/* ---------- 台账概览指标卡：数字醒目 ---------- */
.analytics-metric strong { font-size: 22px !important; font-weight: 700 !important; letter-spacing: -0.02em; }
.analytics-metric span { font-size: 12.5px !important; color: var(--text-tertiary); }
.analytics-metric.primary strong { color: var(--brand-1-strong); background: linear-gradient(135deg, #1f7a74, #2f5f98); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* 台账概览的顶部大金额 */
.analysis-head strong { font-size: 18px !important; font-weight: 700 !important; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.analysis-head span { font-size: 14px !important; font-weight: 600 !important; color: var(--text-primary) !important; }

/* ---------- 空态更柔和 ---------- */
.empty-state { padding: 32px 20px !important; }
.empty-state-title { font-size: 15px !important; }
.empty-state-description { font-size: 13.5px !important; color: var(--text-tertiary) !important; }

/* ---------- 过渡: view 切换轻淡入 ---------- */
.view { transition: opacity 260ms var(--ease-out-quart), transform 260ms var(--ease-out-quart); }
.view:not(.active) { opacity: 0; transform: translateY(6px); pointer-events: none; position: absolute; }
.view.active { opacity: 1; transform: none; position: relative; }

/* ---------- 微观动效：按钮和链接的可交互性 ---------- */
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- 差异清单：金额差异用等宽数字 ---------- */
.alert-item { font-variant-numeric: tabular-nums; }

/* ============================================================
   Invoice 页 v3 · 布局收紧 & 交互增强
   ============================================================ */

/* 隐藏右侧异常提醒 panel，让发票清单占满 */
.invoice-alerts-panel { display: none !important; }
.invoice-results-layout {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 16px !important;
}

/* 粘贴表格 summary 按钮：不再被撑成整行 */
.paste-details { border: 1px solid var(--border-light, #e8ecf0) !important; border-radius: 12px !important; overflow: hidden; }
.paste-details summary {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 14px !important;
  font-size: 13px !important;
  color: var(--text-secondary, #4b5b74) !important;
  cursor: pointer;
  background: transparent !important;
  border: none !important;
  list-style: none;
  width: auto !important;
  border-radius: 12px;
}
.paste-details summary::after { content: none !important; }
.paste-details summary::marker { content: ""; }
.paste-details summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--brand-1-soft, #e8f4f2);
  color: var(--brand-1-strong, #175f5a);
  font-size: 14px;
  line-height: 1;
  transition: transform 160ms ease;
}
.paste-details[open] summary::before { content: "−"; }
.paste-details[open] { padding: 8px 14px 14px; }
.paste-details[open] summary { padding-left: 0 !important; }
.paste-details .form-textarea { margin-top: 8px; width: 100%; }
.paste-details .paste-import-btn { margin-top: 10px; }

/* 表头排序：图标紧贴文字（不是绝对定位靠边） */
.invoice-data-table th.th-sortable {
  cursor: pointer;
  user-select: none;
}
.invoice-data-table th.th-sortable > .th-label { pointer-events: none; margin-right: 4px; }
.invoice-data-table th.th-sortable .th-sort-ico {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 10px;
  height: 14px;
  vertical-align: middle;
  pointer-events: none;
}
.invoice-data-table th.th-sortable .th-sort-ico .ico-up,
.invoice-data-table th.th-sortable .th-sort-ico .ico-down {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.32;
  transition: opacity 160ms ease, border-color 160ms ease;
}
.invoice-data-table th.th-sortable .th-sort-ico .ico-up { border-bottom: 5px solid currentColor; }
.invoice-data-table th.th-sortable .th-sort-ico .ico-down { border-top: 5px solid currentColor; }
.invoice-data-table th.th-sortable:hover .th-sort-ico .ico-up,
.invoice-data-table th.th-sortable:hover .th-sort-ico .ico-down { opacity: 0.55; }
.invoice-data-table th.th-sortable.sort-asc .th-sort-ico .ico-up,
.invoice-data-table th.th-sortable.sort-desc .th-sort-ico .ico-down { opacity: 1; color: var(--brand-1, #1f7a74); }
.invoice-data-table th.th-sortable.sort-asc,
.invoice-data-table th.th-sortable.sort-desc { color: var(--brand-1-strong, #175f5a) !important; }

/* 表格行：整行可点击 + 高亮 */
.invoice-data-table tbody tr { cursor: pointer; transition: background 160ms ease; }
.invoice-data-table tbody tr:hover { background: rgba(31, 122, 116, 0.04); }
.invoice-data-table tbody tr.selected { background: rgba(47, 95, 152, 0.06); }
.invoice-data-table tbody tr.row-warn { background: rgba(245, 158, 11, 0.06); }
.invoice-data-table tbody tr.row-warn:hover { background: rgba(245, 158, 11, 0.12); }
.invoice-data-table tbody tr.row-danger { background: rgba(239, 68, 68, 0.08); }
.invoice-data-table tbody tr.row-danger:hover { background: rgba(239, 68, 68, 0.14); }

/* 勾选列：只放 checkbox，宽度收紧 */
.invoice-data-table th.select-cell,
.invoice-data-table td.select-cell {
  padding: 0 10px !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  text-align: center;
}
.invoice-data-table td.select-cell::before,
.invoice-data-table td.select-cell::after { content: none !important; }
.invoice-data-table .invoice-check { margin: 0; }

/* 末尾风险标记列 */
.invoice-data-table th.flag-cell,
.invoice-data-table td.flag-cell {
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  padding: 0 8px !important;
  text-align: center;
}
.invoice-data-table .row-danger-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
  animation: pulseWarn 1.6s ease-in-out infinite;
}
@keyframes pulseWarn {
  0%, 100% { box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 2px 10px rgba(239, 68, 68, 0.55); }
}

/* 金额筛选：把两个输入框加宽，占位文本能完整显示 */
.invoice-filter-row .filter-amount {
  min-width: 260px;
}
.invoice-filter-row .filter-amount-input {
  width: 120px !important;
  min-width: 100px !important;
  padding: 9px 10px !important;
  font-size: 13.5px !important;
}
.invoice-filter-row .filter-amount-input::placeholder {
  font-size: 13px !important;
  color: #94a3b8;
}
.invoice-filter-row .filter-amount-sep { padding: 0 4px !important; }

/* 粘贴表格数据：折叠态是 chip，不撑整行 */
.invoice-import-panel .paste-details {
  display: inline-block !important;
  width: auto !important;
  max-width: 100%;
  margin-top: 8px;
}
.invoice-import-panel .paste-details:not([open]) {
  border-color: transparent !important;
  background: transparent !important;
}
.invoice-import-panel .paste-details:not([open]) summary {
  padding: 6px 12px !important;
  background: #f4f6f9 !important;
  border-radius: 999px !important;
  border: 1px solid var(--border-light, #e6ecf1) !important;
  font-size: 12.5px !important;
}
.invoice-import-panel .paste-details:not([open]) summary:hover {
  background: var(--brand-1-soft, #e8f4f2) !important;
  color: var(--brand-1-strong, #175f5a) !important;
  border-color: var(--brand-1, #1f7a74) !important;
}
.invoice-import-panel .paste-details[open] {
  display: block !important;
  width: 100% !important;
  padding: 12px 14px 14px;
}

/* 关键列：完整显示不截断，但不允许溢出到下一列 */
.invoice-data-table td[data-col="发票号码"],
.invoice-data-table th[data-col="发票号码"] {
  min-width: 210px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-variant-numeric: tabular-nums;
}
.invoice-data-table td[data-col="开票日期"],
.invoice-data-table th[data-col="开票日期"] {
  min-width: 118px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  padding-left: 14px !important;
}
.invoice-data-table td[data-col="导入日期"],
.invoice-data-table th[data-col="导入日期"] {
  min-width: 110px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ============================================================
   发票详情弹窗
   ============================================================ */
#invoicePreviewModal .modal-panel {
  max-width: 1080px !important;
  width: min(96vw, 1080px);
}
#invoicePreviewModal .modal-header {
  background: linear-gradient(135deg, #1f7a74 0%, #2f5f98 100%);
  color: #fff;
  padding: 18px 24px !important;
  border-bottom: none !important;
}
#invoicePreviewModal .modal-header h3 { color: #fff !important; font-size: 18px !important; }
#invoicePreviewModal .modal-subtitle { color: rgba(255,255,255,0.85) !important; font-size: 13px !important; margin-top: 4px; }
#invoicePreviewModal .modal-header .btn-icon,
#invoicePreviewModal .modal-header .btn-ghost {
  color: #fff !important;
  border-color: rgba(255,255,255,0.3) !important;
  background: rgba(255,255,255,0.1) !important;
}
#invoicePreviewModal .modal-header .btn-icon:hover,
#invoicePreviewModal .modal-header .btn-ghost:hover {
  background: rgba(255,255,255,0.2) !important;
}

.preview-title-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 10px;
  vertical-align: middle;
}
.preview-title-tag-ok { background: rgba(255,255,255,0.25); color: #fff; }
.preview-title-tag-warn { background: rgba(255, 200, 80, 0.9); color: #6b3f00; }
.preview-title-tag-danger { background: rgba(255, 130, 130, 0.95); color: #7a0f0f; }

.invoice-detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.1fr);
  gap: 22px;
  padding: 22px 24px;
  max-height: 74vh;
  overflow-y: auto;
}

.detail-file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--brand-1-soft, #e8f4f2);
  border-radius: 10px;
  margin-bottom: 16px;
  max-width: 100%;
}
.detail-file-chip {
  background: var(--brand-1, #1f7a74);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.detail-file-name {
  font-size: 13.5px;
  color: var(--text-primary, #1a1f36);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.detail-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 20px;
}
.detail-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-light, #eef0f4);
}
.detail-key { font-size: 12px; color: var(--text-tertiary, #94a3b8); }
.detail-value { font-size: 14px; color: var(--text-primary, #1a1f36); font-weight: 500; word-break: break-all; }

.detail-issues {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.detail-issues-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 6px;
}
.detail-issues-title svg { flex: none; }
.detail-issues ul { margin: 6px 0 0; padding-left: 18px; color: #7f1d1d; font-size: 13px; line-height: 1.6; }
.detail-issues ul li { margin-bottom: 2px; }
.detail-issues-warn {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.28);
}
.detail-issues-warn .detail-issues-title { color: #b45309; }
.detail-issues-warn ul { color: #7c2d12; }
.detail-issues-ok {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.22);
}
.detail-issues-ok .detail-issues-title { color: #047857; margin-bottom: 0; }

.detail-note {
  margin-top: 14px;
}
.detail-note label {
  display: block;
  font-size: 12.5px;
  color: var(--text-tertiary, #94a3b8);
  margin-bottom: 6px;
}
.detail-note textarea {
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--border-light, #e8ecf0);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.detail-note textarea:focus {
  outline: none;
  border-color: var(--brand-1, #1f7a74);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.14);
}

.detail-preview {
  background: var(--bg-tertiary, #f5f7fa);
  border-radius: 12px;
  padding: 14px;
  overflow: hidden;
  min-height: 380px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.detail-preview .invoice-preview-image { max-width: 100%; max-height: 62vh; border-radius: 8px; }
.detail-preview .pdf-preview-shell { width: 100%; }

@media (max-width: 900px) {
  .invoice-detail-grid { grid-template-columns: 1fr; }
  .detail-fields { grid-template-columns: 1fr; }
}

/* 让下方的 invoice-import-panel 内 upload buttons 更协调 */
.invoice-import-panel .upload-actions { flex-wrap: nowrap; gap: 10px; }

/* ============================================================
   UI Upgrade v2 END
   ============================================================ */

/* ============================================================
   凭证管理页 · 过滤栏 & 分屏布局 精修
   ============================================================ */
.voucher-filter-bar {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) minmax(140px, 0.7fr) minmax(140px, 0.7fr) auto;
  gap: 10px;
  align-items: center;
  margin: 14px 0 18px;
  padding: 12px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--border-light, #e6ecf1);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.voucher-filter-bar .filter-search {
  position: relative;
  min-width: 0;
}

.voucher-filter-bar .filter-search-input,
.voucher-filter-bar .filter-select {
  height: 38px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  font-size: 13.5px !important;
  border-radius: 10px !important;
  background: #f7fafb !important;
  border: 1px solid #dfe6ed !important;
  width: 100%;
}

.voucher-filter-bar .filter-search-input {
  padding-left: 36px !important;
  padding-right: 14px !important;
}

.voucher-filter-bar .filter-select {
  padding-left: 12px !important;
  padding-right: 30px !important;
}

.voucher-filter-bar .quick-filter-chips {
  display: inline-flex;
  gap: 6px;
  padding: 3px;
  background: #f0f4f6;
  border-radius: 10px;
  flex-wrap: nowrap;
}

.voucher-filter-bar .quick-filter-chips .filter-chip {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #5b6774);
  border-radius: 8px;
  cursor: pointer;
  transition: all 160ms var(--ease-out-quart, ease);
  white-space: nowrap;
}

.voucher-filter-bar .quick-filter-chips .filter-chip:hover {
  color: var(--text-primary, #1f2937);
  background: rgba(255, 255, 255, 0.6);
}

.voucher-filter-bar .quick-filter-chips .filter-chip.active {
  background: var(--brand-1, #1f7a74);
  color: #fff;
  box-shadow: 0 1px 3px rgba(31, 122, 116, 0.25);
}

/* 分屏：凭证清单 3 / 检查结果 2 */
.view[data-view="voucher"] .split-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr);
  gap: 18px;
  align-items: start;
}

.view[data-view="voucher"] .table-container,
.view[data-view="voucher"] .side-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--border-light, #e6ecf1);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.view[data-view="voucher"] .table-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light, #eef2f5);
}

.view[data-view="voucher"] .table-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  letter-spacing: -0.01em;
}

.view[data-view="voucher"] .table-header-hint {
  font-size: 12.5px;
  color: var(--text-tertiary, #94a3b8);
}

.view[data-view="voucher"] .side-panel h3 {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light, #eef2f5);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.view[data-view="voucher"] .empty-state {
  padding: 40px 20px !important;
  color: var(--text-tertiary, #94a3b8);
}

@media (max-width: 1180px) {
  .voucher-filter-bar {
    grid-template-columns: minmax(240px, 1fr) minmax(120px, 0.6fr) minmax(120px, 0.6fr);
  }
  .voucher-filter-bar .quick-filter-chips {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .voucher-filter-bar {
    grid-template-columns: 1fr 1fr;
  }
  .voucher-filter-bar .filter-search {
    grid-column: 1 / -1;
  }
  .view[data-view="voucher"] .split-layout {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Critical UI fixes v3 — sample download / donut / kpi / drop
   ============================================================ */

/* 下载示例按钮：紧凑的链接式按钮 */
.btn-sample-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--divider, #e6e9ee);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary, #4b5b74);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 160ms, color 160ms, background 160ms;
  line-height: 1;
  white-space: nowrap;
}
.btn-sample-download:hover {
  border-color: var(--brand-1, #1f7a74);
  color: var(--brand-1-strong, #175f5a);
  background: #f3faf9;
}
.btn-sample-download svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
  display: inline-block;
}
.btn-sample-download span {
  font-size: 12.5px;
  line-height: 1;
}

/* upload-panel-head 布局 */
.upload-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.upload-panel-head .panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #1a2434);
  margin: 0;
}

/* 拖拽区域 */
.file-drop-zone {
  border: 1.5px dashed var(--divider, #e6e9ee);
  border-radius: 10px;
  padding: 20px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fafbfc;
  transition: border-color 160ms, background 160ms;
  cursor: pointer;
}
.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--brand-1, #1f7a74);
  background: #f3faf9;
}
.file-drop-zone .drop-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--brand-1, #1f7a74);
}
.file-drop-zone .drop-icon svg {
  width: 32px;
  height: 32px;
  display: block;
}
.file-drop-zone .drop-body {
  flex: 1;
  min-width: 0;
}
.file-drop-zone .drop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1a2434);
  margin-bottom: 2px;
}
.file-drop-zone .drop-hint {
  font-size: 12.5px;
  color: var(--text-tertiary, #6b7a91);
  line-height: 1.5;
}
.file-drop-zone .drop-button {
  padding: 8px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-1, #1f7a74), var(--brand-1-strong, #175f5a));
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}
.file-drop-zone .drop-button:hover { filter: brightness(1.05); }

/* KPI 卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--divider, #e6e9ee);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 200ms, box-shadow 200ms;
}
.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(20, 30, 50, 0.06);
}
.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-tertiary, #6b7a91);
}
.kpi-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary, #1a2434);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-tertiary, #6b7a91);
  display: block;
  margin-top: 4px;
}
.kpi-extra {
  flex-shrink: 0;
}
.kpi-extra .donut-svg {
  width: 60px;
  height: 60px;
}

/* 语义色 */
.kpi-ok .kpi-value { color: #0f7a56; }
.kpi-warn .kpi-value { color: #b7791f; }
.kpi-danger .kpi-value { color: #b23434; }
.kpi-info .kpi-value { color: var(--text-primary, #1a2434); }

/* 环形图：严格约束尺寸 */
.donut-svg {
  display: block;
  max-width: 100%;
  height: auto;
}
svg.donut-svg {
  width: 68px;
  height: 68px;
}

/* Legend */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto 100px auto;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-1, #1f7a74);
}
.legend-ok .legend-dot { background: #22a373; }
.legend-warn .legend-dot { background: #d19e3b; }
.legend-danger .legend-dot { background: #d15252; }
.legend-info .legend-dot { background: #4a7fbf; }
.legend-key {
  color: var(--text-secondary, #4b5b74);
  font-weight: 500;
}
.legend-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #1a2434);
  font-weight: 600;
}
.legend-bar {
  background: var(--divider, #e6e9ee);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.legend-fill {
  height: 100%;
  background: currentColor;
  border-radius: 4px;
}
.legend-ok .legend-fill { background: #22a373; }
.legend-warn .legend-fill { background: #d19e3b; }
.legend-danger .legend-fill { background: #d15252; }
.legend-info .legend-fill { background: #4a7fbf; }
.legend-pct {
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--text-tertiary, #6b7a91);
}

/* 迷你条形图 */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 140px) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.bar-label {
  color: var(--text-secondary, #4b5b74);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  background: var(--divider, #e6e9ee);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-1, #1f7a74), var(--brand-1-strong, #175f5a));
  border-radius: 4px;
  transition: width 300ms ease-out;
}
.bar-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #1a2434);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mini-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-tertiary, #6b7a91);
  font-size: 12.5px;
}

/* 堆叠条 */
.stacked-bar {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--divider, #e6e9ee);
}
.stacked-seg { height: 100%; transition: width 300ms ease-out; }
.stacked-ok { background: #22a373; }
.stacked-warn { background: #d19e3b; }
.stacked-danger { background: #d15252; }
.stacked-info { background: #4a7fbf; }

/* 发票表：让关键列更宽以避免省略号 */
#invoiceTable table td[data-col="发票文件"],
#invoiceTable table th[data-col="发票文件"] { min-width: 220px; max-width: 320px; }
#invoiceTable table td[data-col="发票号码"],
#invoiceTable table th[data-col="发票号码"] { min-width: 140px; }
#invoiceTable table td[data-col="开票日期"],
#invoiceTable table th[data-col="开票日期"],
#invoiceTable table td[data-col="导入日期"],
#invoiceTable table th[data-col="导入日期"] { min-width: 110px; }
#invoiceTable table td[data-col="购买方"],
#invoiceTable table th[data-col="购买方"],
#invoiceTable table td[data-col="销售方"],
#invoiceTable table th[data-col="销售方"] { min-width: 120px; max-width: 180px; }
#invoiceTable table td[data-col="项目名称"],
#invoiceTable table th[data-col="项目名称"] { min-width: 100px; }
#invoiceTable table td[data-col="备注"],
#invoiceTable table th[data-col="备注"] { min-width: 160px; }

/* 表格：让所有单元格内容不再竖排堆字 */
.data-table th,
.data-table td {
  word-break: normal;
  overflow-wrap: normal;
}
.data-table td.col-nowrap,
.data-table th.col-nowrap {
  white-space: nowrap;
}

/* analysis-card 内的图表容器 */
.analysis-card > svg,
.analysis-card .chart svg {
  max-width: 100%;
  height: auto;
}

/* 保险丝：SVG 图标默认尺寸约束，避免撑满 */
.btn svg,
.btn-link svg,
button svg:not([width]):not([height]) {
  width: 16px;
  height: 16px;
}

/* 报告 view 顶部按钮组间距 */
.page-header .toolbar { gap: 8px; }


/* ============================================================
   Bugfix v3 —— 修复图标/圆环/表格列崩溃、补齐新增组件样式
   ============================================================ */

/* ---------- SVG 全局兜底：图标必须限定尺寸 ---------- */
button svg,
.btn-link svg,
.kpi-card svg,
.analysis-card svg:not(.chart-svg):not(.spark-svg) {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* 示例下载按钮：链接样式，图标 + 文本紧凑排列 */
.btn-sample-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-1, #e2e8f0);
  background: rgba(255, 255, 255, 0.85);
  color: var(--brand-1-strong, #16665f);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
}

.btn-sample-download:hover {
  background: var(--brand-1-soft, #e6f4f2);
  border-color: var(--brand-1, #1f7a74);
  transform: translateY(-1px);
}

.btn-sample-download svg {
  width: 14px !important;
  height: 14px !important;
  stroke-width: 2;
}

.upload-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.upload-panel-head .panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* ---------- 环形图 SVG：强制尺寸约束 ---------- */
.donut-svg,
svg.donut-svg,
.kpi-card .donut-svg,
.analysis-card .donut-svg {
  width: 72px !important;
  height: 72px !important;
  max-width: 72px;
  max-height: 72px;
  flex-shrink: 0;
  display: block;
}

.donut-svg.donut-lg {
  width: 120px !important;
  height: 120px !important;
  max-width: 120px;
  max-height: 120px;
}

/* KPI 卡片内的环形图作为副视觉，尺寸更小 */
.kpi-card .donut-svg {
  width: 56px !important;
  height: 56px !important;
  max-width: 56px;
  max-height: 56px;
}

/* ---------- KPI 卡片布局 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-1, #e2e8f0);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.kpi-card .kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-card .kpi-label {
  font-size: 12.5px;
  color: var(--text-tertiary, #64748b);
  font-weight: 500;
  margin-bottom: 4px;
}

.kpi-card .kpi-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #0f172a);
  line-height: 1.2;
}

.kpi-card.kpi-ok .kpi-value { color: #059669; }
.kpi-card.kpi-warn .kpi-value { color: #d97706; }
.kpi-card.kpi-danger .kpi-value { color: #dc2626; }
.kpi-card.kpi-info .kpi-value { color: var(--brand-1-strong, #16665f); }

.kpi-card .kpi-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-tertiary, #64748b);
  margin-top: 3px;
  font-weight: 500;
}

.kpi-card .kpi-aside {
  flex-shrink: 0;
}

/* ---------- 环形图例：色块 + 名称 + 数量 ---------- */
.donut-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 4px 4px;
  flex-wrap: wrap;
}

.donut-legend-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.donut-legend-swatch .swatch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.donut-legend-swatch .swatch-dot.tone-ok { background: #10b981; }
.donut-legend-swatch .swatch-dot.tone-warn { background: #f59e0b; }
.donut-legend-swatch .swatch-dot.tone-danger { background: #ef4444; }
.donut-legend-swatch .swatch-dot.tone-info { background: #3b82f6; }
.donut-legend-swatch .swatch-dot.tone-neutral { background: #94a3b8; }

.donut-legend-swatch .swatch-value {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- 银行流水/订单模块：面板增强 ---------- */
.reconcile-upload-panel,
.excel-upload-panel {
  padding: 20px;
}

.reconcile-upload-panel .file-drop-zone,
.excel-upload-panel .file-drop-zone {
  margin-top: 4px;
}

/* ---------- 拖拽上传区块（在数据核对/数据处理里） ---------- */
.file-drop-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1.5px dashed var(--border-1, #cbd5e1);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.6);
  transition: all 200ms ease;
  cursor: pointer;
}

.file-drop-zone:hover {
  border-color: var(--brand-1, #1f7a74);
  background: var(--brand-1-soft, #e6f4f2);
}

.file-drop-zone.drag-over {
  border-color: var(--brand-1, #1f7a74);
  background: rgba(31, 122, 116, 0.08);
  transform: scale(1.005);
}

.file-drop-zone .drop-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(31, 122, 116, 0.12);
  color: var(--brand-1-strong, #16665f);
}

.file-drop-zone .drop-icon svg {
  width: 20px !important;
  height: 20px !important;
}

.file-drop-zone .drop-body {
  flex: 1;
  min-width: 0;
}

.file-drop-zone .drop-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.file-drop-zone .drop-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.file-drop-zone .drop-action {
  flex-shrink: 0;
}

/* ---------- 发票表格列宽修正：给关键列留出足够宽度 ---------- */
#invoiceTable table {
  min-width: 1400px;
}

#invoiceTable table td[data-col="发票文件"],
#invoiceTable table th[data-col="发票文件"] {
  min-width: 160px;
  max-width: 220px;
}

#invoiceTable table td[data-col="发票号码"],
#invoiceTable table th[data-col="发票号码"] {
  min-width: 140px;
}

#invoiceTable table td[data-col="开票日期"],
#invoiceTable table th[data-col="开票日期"],
#invoiceTable table td[data-col="导入日期"],
#invoiceTable table th[data-col="导入日期"] {
  min-width: 110px;
}

#invoiceTable table td[data-col="购买方"],
#invoiceTable table th[data-col="购买方"],
#invoiceTable table td[data-col="销售方"],
#invoiceTable table th[data-col="销售方"] {
  min-width: 130px;
  max-width: 220px;
}

#invoiceTable table td[data-col="项目名称"],
#invoiceTable table th[data-col="项目名称"] {
  min-width: 120px;
  max-width: 200px;
}

#invoiceTable table td[data-col="金额"],
#invoiceTable table th[data-col="金额"],
#invoiceTable table td[data-col="税额"],
#invoiceTable table th[data-col="税额"],
#invoiceTable table td[data-col="价税合计"],
#invoiceTable table th[data-col="价税合计"] {
  min-width: 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#invoiceTable table td[data-col="分类"],
#invoiceTable table th[data-col="分类"] {
  min-width: 100px;
}

#invoiceTable table td[data-col="风险摘要"],
#invoiceTable table th[data-col="风险摘要"] {
  min-width: 120px;
  max-width: 260px;
}

#invoiceTable table td[data-col="备注"],
#invoiceTable table th[data-col="备注"] {
  min-width: 160px;
  max-width: 240px;
}

#invoiceTable table td[data-col="状态"],
#invoiceTable table th[data-col="状态"] {
  min-width: 90px;
}

/* 表格文本溢出策略：超出时截断，鼠标悬停显示 title */
#invoiceTable table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 表头保持完整可读 */
#invoiceTable table th {
  white-space: nowrap;
  overflow: visible;
}

/* ---------- 分析卡：常规 grid 布局 ---------- */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.analytics-grid .analysis-card {
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-1, #e2e8f0);
}

/* ---------- 兜底：所有面板下的 SVG 若无明确尺寸就限高 ---------- */
.panel svg:not([width]):not([height]):not(.chart-svg):not(.spark-svg) {
  max-width: 120px;
  max-height: 120px;
}

/* ============================================================
   Bugfix v3 END
   ============================================================ */

/* ============================================================
   Invoice v4 · 历史导入、宽屏阅读和表格可读性
   ============================================================ */

.topbar {
  padding-inline: clamp(14px, 1.6vw, 28px) !important;
}

.topbar-inner,
main {
  max-width: 1880px !important;
}

main {
  padding: 24px clamp(14px, 1.6vw, 28px) 36px !important;
}

.view[data-view="invoice"] .section-header {
  margin-bottom: 14px !important;
}

.invoice-history-panel {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(212, 226, 229, 0.96);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 251, 250, 0.9)),
    #fff;
  box-shadow: 0 14px 34px rgba(24, 38, 56, 0.07);
}

.invoice-history-panel:empty {
  display: none;
}

.history-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-right: 1px solid #e5edef;
}

.history-head h3 {
  margin: 0 0 2px;
  color: #182438;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
}

.history-head p {
  color: #7b889a;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.45;
}

.history-clear {
  width: fit-content;
  height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(15, 111, 102, 0.22);
  border-radius: 999px;
  background: #eef8f6;
  color: #0f6f66;
  font-size: 12px;
  font-weight: 800;
}

.history-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(214px, 244px);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
}

.history-batch {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 88px;
  padding: 12px 13px;
  border: 1px solid #e1eaed;
  border-radius: 15px;
  background: #fbfdfd;
  color: #27364c;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.history-batch:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 111, 102, 0.26);
  background: #f4fbf9;
  box-shadow: 0 14px 26px rgba(24, 38, 56, 0.08);
}

.history-batch.active {
  border-color: rgba(15, 111, 102, 0.48);
  background: linear-gradient(135deg, rgba(15, 111, 102, 0.11), rgba(47, 95, 152, 0.08));
  box-shadow: inset 0 0 0 1px rgba(15, 111, 102, 0.12), 0 14px 28px rgba(15, 111, 102, 0.12);
}

.history-batch-top,
.history-batch-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-batch-top b {
  overflow: hidden;
  color: #172237;
  font-size: 13.5px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-batch-top i {
  flex: none;
  color: #8a98aa;
  font-size: 11.5px;
  font-style: normal;
  font-weight: 650;
}

.history-batch-meta {
  color: #617085;
  font-size: 12.5px;
  font-weight: 720;
}

.history-batch-meta strong {
  color: #0f6f66;
  font-size: 19px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.history-batch-meta em {
  color: #26364b;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.history-batch-meta mark {
  flex: none;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff5e6;
  color: #a76207;
  font-size: 11.5px;
  font-weight: 850;
}

.history-batch-meta mark.ok {
  background: #eafaf3;
  color: #087a61;
}

.invoice-filter-bar {
  margin-bottom: 12px !important;
}

.invoice-table-container {
  max-height: calc(100vh - 390px) !important;
  min-height: 430px;
}

.invoice-table-scroll {
  max-height: calc(100vh - 442px) !important;
}

#invoiceTable table {
  min-width: 1560px !important;
}

.invoice-table-scroll th {
  height: 46px !important;
  padding: 0 14px !important;
  font-size: 12.8px !important;
  letter-spacing: 0 !important;
}

.invoice-table-scroll td {
  height: 52px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
}

#invoiceTable table td[data-col="发票文件"],
#invoiceTable table th[data-col="发票文件"] {
  min-width: 210px !important;
  max-width: 290px !important;
}

#invoiceTable table td[data-col="发票号码"],
#invoiceTable table th[data-col="发票号码"] {
  min-width: 158px !important;
}

#invoiceTable table td[data-col="购买方"],
#invoiceTable table th[data-col="购买方"],
#invoiceTable table td[data-col="销售方"],
#invoiceTable table th[data-col="销售方"] {
  min-width: 180px !important;
  max-width: 260px !important;
  white-space: normal !important;
}

.invoice-file-button {
  max-width: 100%;
}

.invoice-file-name {
  font-size: 13px;
}

.invoice-data-table tbody tr.row-warn {
  background: rgba(245, 158, 11, 0.045) !important;
}

.invoice-data-table tbody tr.row-danger {
  background: rgba(239, 68, 68, 0.06) !important;
}

.invoice-data-table tbody tr.row-warn:hover {
  background: rgba(245, 158, 11, 0.1) !important;
}

.invoice-data-table tbody tr.row-danger:hover {
  background: rgba(239, 68, 68, 0.11) !important;
}

.detail-value,
.detail-key {
  font-size: 13.5px !important;
}

@media (max-width: 980px) {
  .invoice-history-panel {
    grid-template-columns: 1fr;
  }

  .history-head {
    border-right: 0;
    border-bottom: 1px solid #e5edef;
  }
}

/* Invoice v4.1 · 表格列宽微调 */
#invoiceTable table {
  min-width: 1740px !important;
  table-layout: auto !important;
  width: max-content !important;
}

#invoiceTable table td[data-col="发票号码"],
#invoiceTable table th[data-col="发票号码"] {
  min-width: 176px !important;
}

#invoiceTable table td[data-col="开票日期"],
#invoiceTable table th[data-col="开票日期"],
#invoiceTable table td[data-col="导入日期"],
#invoiceTable table th[data-col="导入日期"] {
  min-width: 128px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

#invoiceTable table td[data-col="购买方"],
#invoiceTable table th[data-col="购买方"] {
  min-width: 210px !important;
  max-width: 280px !important;
}

#invoiceTable table td[data-col="销售方"],
#invoiceTable table th[data-col="销售方"] {
  min-width: 250px !important;
  max-width: 320px !important;
}


/* Invoice v4.2 · 历史卡片压缩和清单去文件列 */
.history-strip {
  grid-auto-columns: minmax(188px, 216px) !important;
  gap: 8px !important;
}

.history-batch {
  position: relative !important;
  min-height: 74px !important;
  padding: 10px 38px 10px 12px !important;
  gap: 8px !important;
}

.history-batch-top {
  align-items: flex-start !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.history-batch-top b {
  max-width: 100% !important;
  font-size: 13px !important;
  line-height: 1.15 !important;
}

.history-batch-top i {
  color: #7c8a9b !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
}

.history-batch-meta {
  justify-content: flex-start !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

.history-batch-meta strong {
  color: #0f6f66 !important;
  font-size: 15px !important;
  line-height: 1 !important;
}

.history-batch-meta em {
  color: #2f3c51 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.history-batch-status {
  display: flex;
  align-items: center;
  min-height: 20px;
}

.history-batch-status mark {
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff5e6;
  color: #a76207;
  font-size: 11px;
  font-weight: 850;
}

.history-batch-status mark.ok {
  background: #eafaf3;
  color: #087a61;
}

.history-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #8a98aa;
  opacity: .62;
  transition: opacity 160ms ease, color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.history-delete svg {
  width: 14px !important;
  height: 14px !important;
}

.history-batch:hover .history-delete,
.history-batch:focus-within .history-delete,
.history-batch.active .history-delete {
  opacity: 1;
}

.history-delete:hover {
  color: #dc2626;
  background: #fff1f2;
  border-color: #fecdd3;
  transform: translateY(-1px);
}

#invoiceTable table {
  min-width: 1840px !important;
}

#invoiceTable table td[data-col="发票文件"],
#invoiceTable table th[data-col="发票文件"] {
  display: none !important;
}

/* Invoice v4.3 · 当前批次和历史重复过滤 */
.history-batch.current .history-batch-top b::after {
  content: "最新";
  display: inline-flex;
  align-items: center;
  height: 17px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(15, 111, 102, 0.1);
  color: #0f6f66;
  font-size: 10px;
  font-weight: 900;
  vertical-align: 1px;
}

.history-duplicate-toggle {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px 6px 8px;
  border: 1px solid rgba(15, 111, 102, 0.16);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 248, 247, 0.94));
  color: #244155;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, transform 160ms ease;
}

.invoice-filter-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.invoice-chipbar .quick-filter-chips {
  flex: 1 1 auto;
}

.invoice-filter-status .filter-count {
  height: 34px;
  display: inline-flex;
  align-items: center;
}

.history-duplicate-toggle:hover {
  border-color: rgba(15, 111, 102, 0.32);
  background: #f5fbfa;
  box-shadow: 0 8px 20px rgba(24, 38, 56, 0.08);
  transform: translateY(-1px);
}

.history-duplicate-toggle input {
  appearance: none;
  position: relative;
  width: 32px;
  height: 18px;
  border: 1px solid #cdd8df;
  border-radius: 999px;
  background: #eef3f5;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.history-duplicate-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(24, 38, 56, 0.24);
  transition: transform 160ms ease;
}

.history-duplicate-toggle input:checked {
  border-color: rgba(15, 111, 102, 0.78);
  background: linear-gradient(135deg, #0f6f66, #2f5f98);
}

.history-duplicate-toggle input:checked::after {
  transform: translateX(14px);
}

.history-duplicate-toggle input:focus-visible {
  outline: 3px solid rgba(15, 111, 102, 0.18);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .invoice-filter-status {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .history-duplicate-toggle {
    width: auto;
    justify-content: space-between;
  }
}

/* Invoice v4.4 · 发票清单鼠标滚轮滚动修复 */
#invoiceTable.invoice-table-scroll {
  overflow-x: auto !important;
  overflow-y: auto !important;
  min-height: 360px !important;
  max-height: clamp(360px, calc(100vh - 360px), 612px) !important;
  overscroll-behavior: auto;
  scrollbar-gutter: stable both-edges;
  -webkit-overflow-scrolling: touch;
}

.invoice-table-container {
  overflow: hidden !important;
}

#invoiceTable.invoice-table-scroll table {
  margin: 0;
}

/* Invoice v4.5 · folder import progress */
.file-drop-zone.processing {
  border-color: rgba(31, 122, 116, 0.72) !important;
  background:
    linear-gradient(90deg, rgba(31, 122, 116, 0.10), rgba(47, 95, 152, 0.08), rgba(31, 122, 116, 0.10)),
    #f7fcfb !important;
  background-size: 220% 100%, auto !important;
  box-shadow: 0 12px 30px rgba(31, 122, 116, 0.16) !important;
  animation: importSurfaceSweep 1.25s ease-in-out infinite;
}

.file-drop-zone.processing .file-drop-icon {
  color: var(--brand-primary) !important;
  animation: importIconPulse 860ms ease-in-out infinite alternate;
}

.queue-summary.processing {
  display: flex !important;
  border-color: rgba(31, 122, 116, 0.34) !important;
  background:
    linear-gradient(135deg, rgba(31, 122, 116, 0.12), rgba(47, 95, 152, 0.08)),
    #ffffff !important;
  color: #26364d !important;
  box-shadow: inset 3px 0 0 rgba(31, 122, 116, 0.58), 0 10px 24px rgba(24, 38, 56, 0.06) !important;
}

.queue-summary.processing span:first-child::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--brand-primary);
  box-shadow: 0 0 0 5px rgba(31, 122, 116, 0.12);
  animation: importDotPulse 760ms ease-in-out infinite alternate;
}

@keyframes importSurfaceSweep {
  from { background-position: 0% 50%, 0 0; }
  to { background-position: 100% 50%, 0 0; }
}

@keyframes importIconPulse {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-1px) scale(1.06); }
}

@keyframes importDotPulse {
  from { opacity: 0.55; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}

/* Data processing v2 · multi-sheet YoY/MoM analytics */
.excel-analytics {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.excel-analytics .excel-kpi-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.excel-analytics .analysis-card {
  grid-column: span 4;
  min-height: 220px;
  padding: 18px;
}

.excel-analytics .analysis-card.analysis-wide {
  grid-column: span 6;
}

.excel-cluster-chart,
.excel-compare-chart,
.excel-profit-chart,
.excel-pie-wrap {
  width: 100%;
}

.excel-cluster-groups {
  display: flex;
  align-items: end;
  gap: 14px;
  min-height: 188px;
  padding: 10px 6px 0;
  border-bottom: 1px solid var(--border-light, #e5e9ee);
}

.excel-cluster-group {
  flex: 1;
  min-width: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.excel-cluster-bars {
  height: 148px;
  width: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
}

.excel-cluster-bar {
  width: 14px;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: #4f7fc4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.36);
}

.excel-cluster-bar.color-1 { background: #f27f3d; }
.excel-cluster-bar.color-2 { background: #9b9b9b; }
.excel-cluster-label {
  font-size: 12px;
  color: var(--text-tertiary, #6b7a91);
  white-space: nowrap;
}

.excel-chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary, #4b5b74);
}

.excel-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.excel-chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #4f7fc4;
}

.excel-chart-legend i.color-1,
.excel-chart-legend i.previous { background: #f27f3d; }
.excel-chart-legend i.color-2 { background: #9b9b9b; }
.excel-chart-legend i.current { background: #1f7a74; }

.excel-compare-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.excel-compare-row {
  display: grid;
  grid-template-columns: minmax(74px, 120px) 1fr 58px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.excel-compare-name {
  color: var(--text-primary, #1a2434);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-compare-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.excel-compare-bar {
  display: block;
  height: 8px;
  min-width: 2px;
  border-radius: 999px;
}

.excel-compare-bar.previous { background: #9c8cf1; }
.excel-compare-bar.current { background: #20bfda; }
.excel-compare-row strong {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--brand-1-strong, #175f5a);
}

.excel-pie-wrap {
  display: grid;
  grid-template-columns: 190px 1fr;
  align-items: center;
  gap: 18px;
}

.excel-pie {
  width: 178px;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.82), 0 10px 30px rgba(120, 40, 56, 0.12);
}

.excel-pie-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}

.excel-pie-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary, #4b5b74);
}

.excel-pie-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.excel-profit-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.excel-profit-row {
  display: grid;
  grid-template-columns: minmax(76px, 120px) 1fr 92px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.excel-profit-row > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-profit-track {
  height: 12px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}

.excel-profit-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.excel-profit-track i.positive { background: linear-gradient(90deg, #1f7a74, #2f9f8f); }
.excel-profit-track i.negative { background: linear-gradient(90deg, #d95c61, #8d6cff); }
.excel-profit-row strong {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-primary, #1a2434);
}

#excelChart {
  margin: 10px 0 16px;
}

#excelTable table td[data-col="项目"],
#excelTable table th[data-col="项目"] {
  min-width: 110px;
}

#excelTable table td[data-col="来源文件"],
#excelTable table th[data-col="来源文件"] {
  min-width: 190px;
  max-width: 260px;
}

@media (max-width: 1080px) {
  .excel-analytics .excel-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .excel-analytics .analysis-card,
  .excel-analytics .analysis-card.analysis-wide { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .excel-analytics .excel-kpi-grid { grid-template-columns: 1fr; }
  .excel-pie-wrap { grid-template-columns: 1fr; justify-items: center; }
}
