/**
 * 嘀嗒数据中心 · 报表界面现代化样式体系
 * 严格样式增强，完全兼容现有 DOM 结构与交互逻辑
 */

:root {
  /* 基础色系 */
  --ink: #0f172a;
  --ink-light: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --line-light: #f1f5f9;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  
  /* 侧边栏暗色体系 */
  --sidebar-bg-start: #0a1120;
  --sidebar-bg-end: #0f1a30;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f1f5f9;
  --sidebar-active-bg: linear-gradient(90deg, rgba(37, 99, 235, 0.22) 0%, rgba(59, 130, 246, 0.1) 100%);
  --sidebar-active-border: rgba(56, 189, 248, 0.35);
  --sidebar-active-text: #38bdf8;
  
  /* 品牌与功能色 */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #10b981;
  --accent-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --cyan: #06b6d4;
  --purple: #8b5cf6;
  --indigo: #6366f1;
  
  /* 阴影与圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.07);
}

/* 全局重置与基础字型 */
* {
  box-sizing: border-box;
}

[hidden],
.table-loading-overlay[hidden],
.top-progress-bar[hidden],
.export-modal-backdrop[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. 侧边栏与菜单导航系统 (彻底解决纯白突兀大方块)
   ========================================================================== */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
  border-right: 1px solid var(--sidebar-line);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

/* 品牌区 */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 26px;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  border-bottom: 1px solid var(--sidebar-line);
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
  flex-shrink: 0;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* 侧边栏菜单列表 */
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* 菜单项悬停态 */
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-hover);
  border-color: rgba(255, 255, 255, 0.06);
}

/* 菜单项激活态（修复原版的纯白大方块） */
.sidebar nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
  border-color: var(--sidebar-active-border);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.18);
}

/* 激活项左侧高亮细饰条 */
.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3.5px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #38bdf8 0%, #2563eb 100%);
  box-shadow: 0 0 10px #38bdf8;
}

/* 菜单项指示圆点 (精致精密指示灯) */
.nav-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.2);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar nav a:hover .nav-dot {
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.3);
}

.sidebar nav a.active .nav-dot {
  background: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), 0 0 10px #38bdf8;
}

/* 底部状态提示 */
.db-state {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--sidebar-line);
  color: #cbd5e1;
  font-size: 12.5px;
}

.db-state i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
  animation: pulse-green 2.5s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.db-state small {
  color: #94a3b8;
  font-size: 11px;
}

/* 侧边栏用户身份卡片与退出登录 */
.user-profile-card {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-line);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-link {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.logout-link svg {
  width: 16px;
  height: 16px;
}

.logout-link:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ==========================================================================
   2. 主体内容区与顶部 Header
   ========================================================================== */
main {
  margin-left: 232px;
  min-height: 100vh;
  padding: 28px 36px 56px;
  max-width: 1720px;
}

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.snapshot {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 3.5px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.snapshot span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.snapshot strong {
  color: var(--ink);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ==========================================================================
   3. 筛选控制台 (Filter Surface)
   ========================================================================== */
.filters {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
}

.filter-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-light);
  font-size: 12.5px;
  font-weight: 500;
  flex: 1 1 140px;
  min-width: 135px;
  max-width: 200px;
}

/* 时间输入框宽裕度 */
.filter-grid label:first-child,
.filter-grid label:nth-child(2) {
  flex: 1.2 1 170px;
  min-width: 160px;
  max-width: 215px;
}

/* 控件样式 */
.filter-grid input,
.filter-grid select {
  width: 100%;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  padding: 0 11px;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.18s ease;
  outline: none;
}

.filter-grid select {
  appearance: none;
  -webkit-appearance: none;
  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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.filter-grid input:hover,
.filter-grid select:hover {
  border-color: #94a3b8;
}

.filter-grid input:focus,
.filter-grid select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 按钮组 */
.filter-actions {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
  height: 38px !important;
  white-space: nowrap !important;
  align-self: flex-end !important;
  margin-left: auto;
}

button {
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  line-height: 36px !important;
  box-sizing: border-box !important;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  transition: all 0.18s ease;
}

/* 查询主按钮 */
#query {
  width: 96px !important;
  min-width: 96px !important;
  max-width: 96px !important;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border-color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

#query:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.4);
}

#query:active {
  transform: translateY(1px);
}

#query:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#reset {
  min-width: 60px !important;
}

#export {
  min-width: 94px !important;
}

/* 重置次要按钮 */
button.secondary,
#reset {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}

button.secondary:hover,
#reset:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

/* 导出 Excel 辅助按钮 */
.filter-actions .export,
#export {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  color: #ffffff;
  border-color: #047857;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

.filter-actions .export:hover,
#export:hover {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.4);
}

/* 结果摘要徽标 */
.result-meta {
  width: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
}

/* 错误提示条 */
.error {
  padding: 13px 16px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  background: #fef2f2;
  color: #991b1b;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   4. KPI 核心数据看板卡片
   ========================================================================== */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.kpi:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* 顶部色彩饰条 */
.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: #3b82f6;
}

/* 各色系定制 */
.kpi.tone-blue::before { background: #2563eb; }
.kpi.tone-purple::before { background: #8b5cf6; }
.kpi.tone-green::before { background: #10b981; }
.kpi.tone-red::before { background: #ef4444; }
.kpi.tone-indigo::before { background: #6366f1; }
.kpi.tone-teal::before { background: #0d9488; }
.kpi.tone-orange::before { background: #f59e0b; }
.kpi.tone-cyan::before { background: #06b6d4; }

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.kpi-value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 750;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.kpi-note {
  margin-top: 8px;
  color: var(--muted-light);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   5. 数据明细表格面板与 Segmented Tabs
   ========================================================================== */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-panel {
  min-height: 440px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
}

.panel-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* iOS 现代分段选择器 (Segmented Control Tabs) */
.tabs {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  gap: 2px;
}

.tabs .tab {
  height: 32px;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tabs .tab:hover {
  color: var(--ink);
}

.tabs .tab.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

/* 翻页组件 */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

#pageText {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
}

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.icon-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--primary);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* 表格主体 */
.table-wrap {
  overflow: auto;
  max-height: 620px;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-light);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #475467;
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  z-index: 10;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: #f8fafc;
}

/* 表格内元素样式 */
td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #1e40af;
  font-size: 12.5px;
}

.table-wrap .signed {
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

td.positive, .positive {
  color: #059669;
}

td.negative, .negative {
  color: #dc2626;
}

/* 流水类型徽标 */
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #059669;
  font-size: 12px;
  font-weight: 600;
}

.tag.out {
  background: #fef2f2;
  color: #dc2626;
}

/* 状态胶囊 */
.status {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.loading, td.empty {
  width: 100%;
  text-align: center;
  color: var(--muted);
  padding: 56px 20px;
  font-size: 13.5px;
}

/* ==========================================================================
   6. 响应式系统适配
   ========================================================================== */
@media (max-width: 1280px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 16px;
    box-shadow: none;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-line);
  }
  .brand {
    padding-bottom: 14px;
    margin-bottom: 12px;
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar nav a {
    flex: 1;
    justify-content: center;
  }
  .sidebar nav a.active::before {
    display: none;
  }
  .db-state {
    display: none;
  }
  main {
    margin-left: 0;
    padding: 20px;
  }
  .flow-toolbar {
    flex-wrap: wrap;
  }
  .tabs {
    order: 3;
    width: 100%;
  }
  .tabs .tab {
    flex: 1;
    text-align: center;
  }
  .pager {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  .kpis {
    grid-template-columns: 1fr;
  }
  .filter-grid label {
    flex: 1 1 100%;
    min-width: 100% !important;
  }
  .filter-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .snapshot {
    display: none;
  }
  header {
    align-items: flex-start;
  }
}

/* ==========================================================================
   平铺式商户号多选框区域 (Flat Multi-Select Checkboxes)
   ========================================================================== */
.mchid-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.mchid-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mchid-section-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mchid-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mchid-actions .btn-text {
  background: none;
  border: none;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
  height: auto;
  transition: all 0.15s ease;
}

.mchid-actions .btn-text:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

.mchid-actions .sep {
  color: var(--muted-light);
  font-size: 11px;
}

.mchid-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.mchid-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.mchid-chip:hover {
  border-color: #94a3b8;
  background-color: var(--bg);
}

.mchid-chip.checked {
  background-color: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.mchid-chip input[type="checkbox"] {
  display: none;
}

.mchid-check-icon {
  width: 15px;
  height: 15px;
  border: 1.5px solid #94a3b8;
  border-radius: 3px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mchid-chip.checked .mchid-check-icon {
  background: var(--primary);
  border-color: var(--primary);
}

.mchid-chip.checked .mchid-check-icon::after {
  content: "";
  width: 3.5px;
  height: 7px;
  border: solid white;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
}

.mchid-chip-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.mchid-chip.checked .mchid-chip-text {
  color: var(--primary);
}

.mchid-chip-code {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ==========================================================================
   查询加载状态体系 (Query Loading System)
   ========================================================================== */
.top-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, #2563eb, #38bdf8, #2563eb);
  background-size: 200% 100%;
  animation: progressSlide 1.1s linear infinite;
  z-index: 99999;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
}

@keyframes progressSlide {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

button#query.btn-loading {
  cursor: wait;
  background-color: var(--primary-hover);
  opacity: 0.9;
  pointer-events: none;
  padding: 0 14px !important;
  height: 38px !important;
}

.btn-spinner {
  width: 13px;
  height: 13px;
  margin-right: 7px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.75s linear infinite;
  vertical-align: middle;
}

/* 表格主体及遮罩层 */
.table-wrap {
  position: relative;
  min-height: 280px;
  overflow: auto;
}

.table-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  transition: opacity 0.2s ease;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 18px 28px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
  border: 1px solid var(--line);
  animation: loadingPop 0.2s ease-out;
}

@keyframes loadingPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.loading-box .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.loading-box .loading-text {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

/* 卡片区域 */
.kpis {
  min-height: 120px;
  transition: opacity 0.25s ease;
}

/* 卡片区域加载中微弱化 */
.kpis.kpis-loading {
  opacity: 0.5;
  filter: grayscale(15%);
  pointer-events: none;
}

/* ==========================================================================
   7. 导出流水进度条系统 (Export Progress Modal)
   ========================================================================== */
.export-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
}

.export-modal-card {
  background: #ffffff !important;
  opacity: 1 !important;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 440px;
  padding: 26px 28px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.export-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.export-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.export-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.export-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.export-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.export-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.export-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: 999px;
  transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.export-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

#exportProgressPercent {
  font-weight: 600;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}


