/* ========================================
   鸿源检测委托管理系统 - 商用级样式
   Ant Design Pro 风格 | 主色 #1e40af + #06b6d4
   ======================================== */

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --primary-bg: #eff6ff;
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 60px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-100);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   侧边栏
   ======================================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e3a5f 0%, #2d4a6f 100%);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar.icon-mode {
  width: var(--sidebar-collapsed-width);
}

.sidebar-collapse-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  padding: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.sidebar.icon-mode .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar.icon-mode .sidebar-header {
  padding: 20px 9px;
  justify-content: center;
  gap: 0;
}

.sidebar.icon-mode .logo-text {
  display: none;
}

.sidebar.icon-mode .sidebar-collapse-btn {
  right: 50%;
  transform: translate(50%, -50%);
  top: auto;
  bottom: -36px;
  position: absolute;
}

.sidebar-search {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.sidebar-search input::placeholder {
  color: rgba(255,255,255,0.4);
}

.sidebar-search input:focus {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.3);
}

.sidebar-search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

.sidebar.icon-mode .sidebar-search {
  padding: 8px 6px;
}

.sidebar.icon-mode .sidebar-search input {
  padding: 8px 0;
  text-align: center;
  font-size: 0;
  background: rgba(255,255,255,0.08);
}

.sidebar.icon-mode .sidebar-search-icon {
  left: 50%;
  transform: translate(-50%, -50%);
}

.sidebar-header {
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.5px;
  line-height: 1.4;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.nav-group-label {
  padding: 16px 24px 8px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
  user-select: none;
}

.nav-group {
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.3s ease;
}

.nav-group.collapsed {
  max-height: 0;
}

.nav-group-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 10px;
  margin-right: 4px;
}

.nav-group-label.collapsed .nav-group-arrow {
  transform: rotate(-90deg);
}

/* 检测业务流转入口收起（public/app.js 顶部 FLOW_UI_ENABLED=false 时给 body 挂上这个类）。
   必须用 !important：侧边搜索框清空后 filterSidebarNav 会把所有导航组和组标签的
   inline display 一次性恢复成 ''，只靠 JS 置空会被它翻回来，出现一个点开是空的「检测流转」。
   导航项本身已经被权限那段隐藏（permVisible=0），这里连组壳一起收掉。
   开关改回 true 时这个类不再挂上，菜单原样恢复，接口和数据都不受影响。 */
body.flow-ui-off .nav-group[data-group="testflow"],
body.flow-ui-off .nav-group-label[onclick*="'testflow'"] {
  display: none !important;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 0;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
}

.nav-item.active {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* 侧边栏 260px，扣掉图标和左右内边距后文字只有约 11 个汉字宽。
   统一单行省略号，绝不折成两行；完整口径靠悬停提示（data-full）看。 */
.nav-item span {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar.icon-mode .nav-group-label {
  padding: 12px 0 6px;
  text-align: center;
  font-size: 0;
  letter-spacing: 0;
}

.sidebar.icon-mode .nav-group-label .nav-group-arrow {
  display: none;
}

.sidebar.icon-mode .nav-item {
  padding: 10px 0;
  margin: 1px 6px;
  justify-content: center;
  gap: 0;
  position: relative;
}

.sidebar.icon-mode .nav-item span {
  display: none;
}

.sidebar.icon-mode .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-800);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 200;
  box-shadow: var(--shadow-md);
}

.sidebar.icon-mode .nav-item:hover::after {
  opacity: 1;
}

.sidebar.icon-mode .sidebar-footer {
  padding: 8px;
}

.sidebar.icon-mode .btn-import,
.sidebar.icon-mode .btn-export {
  justify-content: center;
  padding: 10px;
  gap: 0;
  position: relative;
}

.sidebar.icon-mode .btn-import span,
.sidebar.icon-mode .btn-export span {
  display: none;
}

.sidebar.icon-mode .btn-import::after,
.sidebar.icon-mode .btn-export::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-800);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 200;
  box-shadow: var(--shadow-md);
}

.sidebar.icon-mode .btn-import:hover::after,
.sidebar.icon-mode .btn-export:hover::after {
  opacity: 1;
}

.sidebar.icon-mode .nav-group-label::before {
  content: '';
  display: block;
  width: 60%;
  margin: 0 auto 4px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-no-results {
  padding: 20px 16px;
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  display: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-import {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(30,64,175,0.06);
  border: 1px solid rgba(30,64,175,0.12);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-import:hover {
  background: rgba(30,64,175,0.12);
  border-color: rgba(30,64,175,0.2);
  color: rgba(255, 255, 255, 0.95);
}

.btn-export {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-export:hover {
  background: rgba(34,197,94,0.18);
  border-color: rgba(34,197,94,0.4);
  color: rgba(255, 255, 255, 0.95);
}

/* ========================================
   主内容区
   ======================================== */
.main-content {
  margin-left: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--gray-100);
}

.sidebar.icon-mode ~ .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

.main-content.expanded {
  margin-left: 0;
}

.top-bar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.menu-toggle:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
}

.page-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}

.top-bar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ========================================
   按钮
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
  transform: translateY(-1px);
}

.btn-outline {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-outline:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--primary-bg);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}

.env-mode-btn.active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}

/* ========================================
   视图
   ======================================== */
.view {
  flex: 1;
  overflow: auto;
  padding: 24px 28px;
}

.view::-webkit-scrollbar {
  width: 6px;
}

.view::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

/* ========================================
   数据总览 - 统计卡片
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.stat-card:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: var(--shadow-md);
  transition: all 0.1s ease;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.1);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ========================================
   Dashboard 区块
   ======================================== */
.dashboard-section {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.dashboard-section-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-section-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-section-header h3::before {
  content: '';
  width: 3px;
  height: 16px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* 工作量图表 */
.workload-chart-container {
  padding: 24px;
  height: 320px;
  position: relative;
}

/* 流转漏斗 */
.flow-funnel {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.funnel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.funnel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}

.funnel-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.funnel-bar {
  position: relative;
  height: 32px;
  background: var(--gray-100);
  border-radius: 6px;
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.funnel-bar-label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
  text-shadow: 0 0 4px rgba(255,255,255,0.8);
}

/* 导入卡片 */
.import-cards {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.import-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  background: white;
}

.import-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.import-card:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-sm);
  transition: all 0.1s ease;
}

.import-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.import-card:hover .import-card-icon {
  transform: scale(1.08);
}

.import-card-text {
  flex: 1;
  min-width: 0;
}

.import-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.import-card-desc {
  font-size: 12px;
  color: var(--gray-500);
}

/* ========================================
   卡片
   ======================================== */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-desc {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

.card-body {
  padding: 24px;
}

/* ========================================
   台账视图 - 工具栏
   ======================================== */
.ledger-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  flex: 1;
  min-width: 240px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  background: transparent;
}

/* 资质 / 类别页内标签：侧边栏合并成一条之后，水利·公路·市政·建筑材料这类
   同功能多维度改在这里切换（与盒号查询、管理报表的标签风格一致）。 */
.sheet-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  margin: 4px 0 0;
  border-bottom: 2px solid #e5e7eb;
  flex-wrap: wrap;
}

.sheet-tab {
  padding: 10px 22px;
  border: none;
  background: none;
  font-size: 14px;
  color: #4b5563;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
}

.sheet-tab:hover {
  color: var(--primary-light);
}

.sheet-tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary-light);
  font-weight: 600;
}

/* 标题只保留顶部标题栏一处，工具条只做「筛选 + 动作」。
   必须允许换行：以前 nowrap + 子项可收缩，筛选条件一多，标题会被挤成一列竖排的字，
   动作按钮还会溢出可视区被裁掉，用户要点半天才找得到按钮。 */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 12px 0 16px;
}

.toolbar h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
  flex-shrink: 0;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

/* 有 20 来个老页面把筛选条件和按钮写在同一个 .toolbar-actions 里。
   删掉工具条标题后它成了工具条的唯一子元素，margin-left:auto 会把整条筛选栏推到右端，
   窗口一窄就换成好几行、右边参差不齐。让它占满整行、靠左自然排列，按钮跟在筛选条件后面。 */
.toolbar > .toolbar-actions:only-child {
  margin-left: 0;
  flex: 1 1 100%;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ========================================
   出具人统计卡片
   ======================================== */
#issuerStats > div > div {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: default;
}

#issuerStats > div > div:hover {
  background: white;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* ========================================
   表格
   ======================================== */
.table-container {
  background: white;
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow-x: auto;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: #666;
  border-top: 1px solid #f0f0f0;
}

.table-pagination button {
  min-width: 72px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}

.data-table th {
  padding: 20px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-600);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.data-table td {
  padding: 20px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--gray-800);
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:nth-child(even) {
  background: var(--gray-50);
}

.data-table tbody tr:hover {
  background: var(--primary-bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:active {
  background: var(--primary-light);
  transition: background 0.05s ease;
}

.status-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-testing {
  background: #dbeafe;
  color: #1e40af;
}

.status-done {
  background: #d1fae5;
  color: #065f46;
}

.status-waiting {
  background: #f3f4f6;
  color: #6b7280;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--gray-400);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 14px;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid var(--gray-200);
}

.record-count {
  font-size: 13px;
  color: var(--gray-500);
}

/* ========================================
   状态标签
   ======================================== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge.status-新建 { background: #dbeafe; color: #1e40af; }
.status-badge.status-已接收 { background: #fef3c7; color: #92400e; }
.status-badge.status-检测中 { background: #fde68a; color: #78350f; }
.status-badge.status-已完成 { background: #d1fae5; color: #065f46; }
.status-badge.status-待派发 { background: #ef4444; color: #fff; font-weight: 700; }
.status-badge.status-退回待改 { background: #dc3545; color: #fff; font-weight: 700; animation: pulse-red 2s infinite; }
.status-badge.status-待复检 { background: #fd7e14; color: #fff; font-weight: 700; }
.status-badge.status-待检 { background: #e9ecef; color: #495057; }
.status-badge.status-在检 { background: #fde68a; color: #78350f; }
.status-badge.status-已检 { background: #d1fae5; color: #065f46; }
.status-badge.status-已发送 { background: #e0e7ff; color: #3730a3; }
.status-badge.status-已结算 { background: #fbcfe8; color: #9f1239; }

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(220, 53, 69, 0); }
}

tr.row-pending { background: #fef2f2; }
tr.row-pending td:first-child { border-left: 3px solid #ef4444; }

/* 检测台账工程名称列不换行 */
.data-table .project-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: inline-block;
  vertical-align: middle;
}

/* ========================================
   模态框
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 0.25s ease;
}

@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-lg {
  max-width: 800px;
}

.modal-xl {
  max-width: 1000px;
  width: 90%;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 5px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========================================
   表单
   ======================================== */
.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  padding: 12px 0 8px;
  margin-top: 8px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.required {
  color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[readonly] {
  background: var(--gray-50);
  color: var(--gray-500);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

/* 检测参数标签 */
.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}

.tag-item:hover {
  background: #dbeafe;
}

.tag-remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--primary-light);
  margin-left: 2px;
  transition: var(--transition);
  background: none;
  border: none;
  padding: 0;
}

.tag-remove:hover {
  color: var(--danger);
}

/* 检测参数搜索下拉选项 */
.test-param-option {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
  transition: background 0.15s;
}

.test-param-option:hover {
  background: #f0f7ff;
}

.test-param-option:last-child {
  border-bottom: none;
}

/* 上传区域 */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}

.upload-placeholder {
  color: var(--gray-500);
  font-size: 13px;
}

.upload-placeholder svg {
  width: 32px;
  height: 32px;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.uploaded-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.uploaded-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.uploaded-file-item a {
  flex: 1;
  color: var(--primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploaded-file-item a:hover {
  text-decoration: underline;
}

/* 委托单生成按钮组 */
.delegation-order-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.delegation-order-btns .btn {
  flex: 1;
  min-width: 180px;
  justify-content: center;
  padding: 12px 20px;
  font-size: 14px;
}

/* ========================================
   标签预览
   ======================================== */
.label-preview {
  background: white;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
}

.label-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-800);
}

.label-row {
  display: flex;
  margin-bottom: 8px;
  font-size: 14px;
}

.label-key {
  width: 100px;
  font-weight: 600;
  color: var(--gray-600);
  flex-shrink: 0;
}

.label-value {
  flex: 1;
  color: var(--gray-900);
}

.label-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-300);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-500);
}

.label-status {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-300);
}

.label-status .label-title {
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 0;
  border-bottom: none;
}

.status-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.status-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.status-option:hover {
  background: var(--gray-50);
  border-color: var(--primary);
}

.status-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.status-option input[type="checkbox"]:checked + span {
  color: var(--primary);
  font-weight: 600;
}

.status-option:has(input:checked) {
  background: var(--primary-bg);
  border-color: var(--primary);
}

/* ========================================
   Toast 提示
   ======================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  min-width: 280px;
  animation: toastSlideIn 0.3s ease;
}

.toast-success, .toast.toast-success { border-left-color: var(--success); }
.toast-error, .toast.toast-error { border-left-color: var(--danger); }
.toast-warning, .toast.toast-warning { border-left-color: var(--warning); }

.toast { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.toast-text { flex: 1; word-break: break-all; }
.toast-close { cursor: pointer; opacity: 0.55; font-size: 14px; line-height: 1.2; flex-shrink: 0; margin-left: 8px; user-select: none; }
.toast-close:hover { opacity: 1; }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   结算视图
   ======================================== */
.settlement-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.settlement-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 320px;
}

.settlement-filters .search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.settlement-filters .search-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.settlement-actions {
  display: flex;
  gap: 8px;
}

.settlement-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.settlement-summary .stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  border: 1px solid var(--gray-200);
}

.settlement-summary .stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.settlement-summary .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.settlement-summary .stat-trend {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 4px;
  font-weight: 500;
}

#settlementTable td {
  font-size: 13px;
}

/* ========================================
   分页
   ======================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 0;
  font-size: 14px;
  color: var(--gray-600);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========================================
   角色徽章
   ======================================== */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.role-badge.admin {
  background: var(--warning-light);
  color: #92400e;
}

.role-badge.user {
  background: #dbeafe;
  color: var(--primary);
}

/* ========================================
   全屏登录页面 — 全屏背景 + 右侧卡片
   ======================================== */
#loginPage {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  overflow: hidden;
  background: url('/images/login-bg.png') center/cover no-repeat;
}

/* 全屏渐变遮罩 */
.login-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 58, 138, 0.75) 50%, rgba(15, 52, 96, 0.80) 100%);
  z-index: 1;
}

/* 装饰图形 */
.login-decoration {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.login-decoration::before,
.login-decoration::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.05);
}

.login-decoration::before {
  width: 500px; height: 500px;
  top: -150px; right: -150px;
}

.login-decoration::after {
  width: 350px; height: 350px;
  bottom: -100px; left: -100px;
}

/* 左侧品牌文字 */
.login-brand {
  position: relative;
  z-index: 2;
  flex: 0 0 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 8%;
  padding-top: 2%;
  color: white;
}

.login-company-name {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 8px;
  margin-bottom: 20px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

.login-divider {
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  margin-bottom: 20px;
  border-radius: 2px;
}

.login-system-name {
  font-size: 36px;
  font-weight: 500;
  letter-spacing: 14px;
  opacity: 0.95;
  text-shadow: 0 1px 8px rgba(0,0,0,0.2);
}

/* 右侧登录卡片 */
.login-card {
  position: relative;
  z-index: 2;
  width: 400px;
  margin-right: 8%;
  align-self: center;
  background: rgba(255,255,255,0.97);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.login-card-header {
  text-align: center;
  padding: 40px 36px 20px;
}

.login-card-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px;
}

.login-card-header p {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.login-card-body {
  padding: 0 36px 32px;
}

.login-input-group {
  margin-bottom: 20px;
}

.login-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.login-input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.2s;
  outline: none;
  box-sizing: border-box;
  background: #f8fafc;
}

.login-input-group input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  background: white;
}

.login-error {
  color: #dc2626;
  font-size: 13px;
  padding: 10px 14px;
  background: #fef2f2;
  border-radius: 8px;
  border: 1px solid #fecaca;
  margin-bottom: 16px;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #1e40af, #1e3a8a);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 6px;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.35);
  margin-top: 4px;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.45);
}

.login-btn:active {
  transform: translateY(0);
}

.login-footer {
  text-align: center;
  padding: 16px 36px;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
  color: #94a3b8;
}

/* 登录页底部版权栏 */
.login-page-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  text-align: center;
  padding: 14px 20px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 1px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}

.login-page-footer-sep {
  margin: 0 10px;
  opacity: 0.4;
}

/* ========================================
   详情网格
   ======================================== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item label {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 500;
}

.detail-item span {
  font-size: 14px;
  color: var(--gray-800);
}

/* ========================================
   用户信息
   ======================================== */
.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--gray-700);
}

/* ========================================
   表单步骤
   ======================================== */
.form-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--gray-500);
  transition: var(--transition);
}

.step.active {
  background: var(--primary);
  color: white;
}

.step.completed {
  background: var(--success);
  color: white;
}

.step-num {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
  font-size: 12px;
}

.form-step-content {
  display: none;
}

.form-step-content.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--danger-light);
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
}

/* ==================== Dashboard 仪表盘 ====================
   必须放在下面几个响应式 @media 之前：同特异度的规则写在 @media 之后，
   平板/手机断点里的 .dashboard-grid { grid-template-columns: 1fr } 会被这里的
   1fr 1fr 直接覆盖掉，窄屏永远分不出两列（以前就是这么漏的）。 */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}
/* 列内纵向排布并吃满列高，剩余空间交给该列最后一张卡片：
   待办 6 行、预警 4 行时右列不再露出页面底色的空白带 */
.dash-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.dash-col > .dashboard-card:last-child { flex: 1; }
#dashInstrumentCard { display: flex; flex-direction: column; }
#dashInstrumentAlerts { flex: 1; display: flex; flex-direction: column; }
/* 卡片内部同样纵向填满，空态文案居中，不会变成"顶部一行字 + 下面一片白" */
#dashTodoCard, #dashAlertCard { display: flex; flex-direction: column; }
#dashTodoList, #dashAlertList { flex: 1; display: flex; flex-direction: column; }
.dashboard-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #f0f0f0;
}
.dashboard-card h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   响应式 - 平板端
   ======================================== */
@media (max-width: 1024px) and (min-width: 769px) {
  :root {
    --sidebar-width: 220px;
  }
  /* 【企业化整改·体验】固定 3 列在窄屏（如 819px 内置浏览器）会截断右侧卡片，改为自适应 */
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  /* 表格容器允许横向滚动，避免列被挤压变形 */
  .table-responsive, .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    min-width: 720px;
  }
}

/* 【企业化整改·体验】统一空状态组件 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
  color: var(--gray-500, #6b7280);
  text-align: center;
}
.empty-state .empty-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
  opacity: .55;
}
.empty-state .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700, #374151);
  margin-bottom: 6px;
}
.empty-state .empty-desc {
  font-size: 13px;
  margin-bottom: 16px;
  max-width: 360px;
}

/* 【企业化整改·体验】骨架屏 */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-row {
  height: 38px;
  margin-bottom: 10px;
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ========================================
   响应式 - 移动端 (≤768px)
   ======================================== */
@media (max-width: 768px) {
  /* === 侧边栏：默认隐藏，滑出覆盖 === */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 500;
  }
  .sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 499;
    animation: fadeIn 0.2s ease;
  }
  .sidebar-overlay.show {
    display: block;
  }
  .sidebar.icon-mode {
    width: 280px;
  }
  .sidebar.icon-mode .nav-item span,
  .sidebar.icon-mode .logo-text,
  .sidebar.icon-mode .nav-group-label {
    display: initial;
  }
  .sidebar.icon-mode .nav-item {
    padding: 10px 24px;
    justify-content: flex-start;
    gap: 12px;
  }
  .sidebar.icon-mode .nav-item::after {
    display: none;
  }
  .sidebar.icon-mode ~ .main-content {
    margin-left: 0;
  }
  .sidebar-collapse-btn {
    display: none;
  }

  /* === 主内容区 === */
  .main-content {
    margin-left: 0;
  }
  .top-bar {
    padding: 0 12px;
    height: 52px;
    gap: 8px;
  }
  .page-title {
    font-size: 16px;
  }
  .menu-toggle {
    width: 40px;
    height: 40px;
  }
  .view {
    padding: 12px;
    padding-bottom: 70px; /* 给底部导航留空间 */
  }

  /* === 统计卡片：2列 === */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px 12px;
    gap: 10px;
  }
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .stat-value {
    font-size: 22px;
  }
  .stat-label {
    font-size: 12px;
  }

  /* === Dashboard 区块 === */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }
  .dash-col {
    gap: 12px;
  }
  .dashboard-card {
    padding: 14px;
  }
  .month-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .month-stat-item {
    padding: 12px 8px;
  }
  .month-stat-value {
    font-size: 22px;
  }

  /* === 表格：横向滚动 + 紧凑 === */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  .data-table {
    font-size: 13px;
    min-width: 600px; /* 确保可以横向滚动 */
  }
  .data-table th,
  .data-table td {
    padding: 10px 8px;
    white-space: nowrap;
  }
  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
  }
  .data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .table-pagination {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .table-pagination button {
    min-width: 60px;
    padding: 6px 10px;
    font-size: 12px;
  }

  /* === 工具栏：堆叠 === */
  .ledger-toolbar {
    flex-direction: column;
    gap: 8px;
  }
  .search-box {
    min-width: unset;
    width: 100%;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 0 12px;
  }
  .toolbar h3 {
    font-size: 15px;
  }
  .toolbar-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .toolbar-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    padding: 8px 10px;
  }
  .filter-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
  }

  /* === 表单：单列 === */
  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 15px;
  }
  .form-group label {
    font-size: 14px;
  }

  /* === 模态框：全屏 === */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    width: 100%;
  }
  .modal-lg, .modal-xl {
    max-width: 100%;
    width: 100%;
  }
  .modal-header {
    padding: 16px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
  }
  .modal-header h2 {
    font-size: 16px;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-footer {
    padding: 12px 16px;
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
  }
  .modal-footer .btn {
    flex: 1;
    padding: 12px;
    font-size: 15px;  }

  /* === 按钮：触摸友好 === */
  .btn {
    min-height: 40px;
    padding: 10px 16px;
    font-size: 14px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 13px;
  }
  .top-bar-actions .btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* === 详情网格：单列 === */
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* === 导入卡片：单列 === */
  .import-cards {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .import-card {
    padding: 16px;
  }

  /* === 流转漏斗：单列 === */
  .flow-funnel {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  /* === 结算视图 === */
  .settlement-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .settlement-filters {
    flex-direction: column;
  }
  .settlement-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .settlement-actions .btn {
    flex: 1;
    min-width: 0;
  }
  .settlement-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  /* === 权限管理 === */
  .perm-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .perm-tab {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
  }
  .perm-matrix {
    font-size: 12px;
  }
  .perm-matrix th, .perm-matrix td {
    padding: 6px 8px;
  }

  /* === 表单步骤 === */
  .form-steps {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }
  .step {
    min-width: 100px;
    padding: 10px;
    font-size: 12px;
  }

  /* === Toast 提示 === */
  .toast-container {
    top: auto;
    bottom: 80px;
    right: 12px;
    left: 12px;
  }
  .toast {
    min-width: unset;
    width: 100%;
  }

  /* === 标签预览 === */
  .label-preview {
    max-width: 100%;
    padding: 16px;
  }

  /* === 上传区域 === */
  .upload-area {
    padding: 16px;
  }

  /* === 委托单按钮组 === */
  .delegation-order-btns {
    flex-direction: column;
  }
  .delegation-order-btns .btn {
    min-width: unset;
    width: 100%;
  }

  /* === 底部 Tab 导航（移动端专用） === */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 400;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--gray-500);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0;
  }
  .mobile-bottom-nav-item.active {
    color: var(--primary);
  }
  .mobile-bottom-nav-item svg {
    width: 22px;
    height: 22px;
  }

  /* === 登录页 === */
  .login-card {
    width: 92%;
    max-width: 360px;
    margin-right: 0;
  }
  .login-card-body {
    padding: 0 24px 24px;
  }
  .login-card-header {
    padding: 28px 24px 16px;
  }
  .login-card-header h2 {
    font-size: 20px;
  }
  .login-btn {
    padding: 14px;
    font-size: 16px;
  }

  /* === 隐藏桌面端元素 === */
  .sidebar-search {
    display: none;
  }
  .sidebar-footer {
    display: none;
  }
  .sidebar-no-results {
    display: none;
  }
}

/* ========================================
   响应式 - 小屏手机 (≤480px)
   ======================================== */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card {
    padding: 12px 10px;
    gap: 8px;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .stat-value {
    font-size: 20px;
  }
  .stat-label {
    font-size: 11px;
  }
  .view {
    padding: 10px;
    padding-bottom: 65px;
  }
  .data-table th,
  .data-table td {
    padding: 8px 6px;
    font-size: 12px;
  }
  .month-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .month-stat-item {
    padding: 10px 6px;
  }
  .month-stat-value {
    font-size: 20px;
  }
  .month-stat-label {
    font-size: 11px;
  }
  .settlement-summary {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ========================================
   PWA 独立模式样式
   ======================================== */
@media (display-mode: standalone) {
  .top-bar {
    padding-top: env(safe-area-inset-top, 0);
    height: calc(52px + env(safe-area-inset-top, 0));
  }
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(60px + env(safe-area-inset-bottom, 0));
  }
  .view {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
  }
}

/* ========================================
   深色模式支持（可选）
   ======================================== */
@media (prefers-color-scheme: dark) {
  /* 暂不启用，保留接口 */
}

/* ========================================
   减少动画（无障碍）
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== 仪器设备台账 ===== */
#equipmentDeptCards::-webkit-scrollbar {
  height: 6px;
}
#equipmentDeptCards::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}
#equipmentDeptCards::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
#equipmentDeptCards::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.equip-dept-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

/* ===== 权限管理 ===== */
.perm-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--gray-200);
}
.perm-tab {
  padding: 10px 24px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.perm-tab:hover {
  color: var(--primary);
}
.perm-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.perm-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.perm-matrix th, .perm-matrix td {
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  text-align: center;
}
.perm-matrix th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
  position: sticky;
  top: 0;
  z-index: 1;
}
.perm-matrix td:first-child {
  text-align: left;
  font-weight: 500;
  background: var(--gray-50);
  min-width: 120px;
}
.perm-matrix th:first-child {
  text-align: left;
}
.perm-matrix input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}
.perm-matrix tr:hover td {
  background: #eff6ff;
}
.perm-matrix .perm-overridden {
  background: #fef9c3 !important;
}
.perm-template-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}
.perm-template-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.perm-template-card .template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.perm-template-card .template-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--gray-800);
}
.perm-template-card .template-desc {
  color: var(--gray-500);
  font-size: 13px;
  margin-bottom: 8px;
}
.perm-template-card .template-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.perm-template-card .module-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 4px;
  font-size: 12px;
}
.perm-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

/* 仪器使用台账 - 左侧树形面板 */
.iu-dept-header {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #f0f0f0;
  user-select: none;
  color: var(--gray-700);
}
.iu-dept-header:hover { background: #f0f4ff; }
.iu-dept-header .arrow { transition: transform 0.2s; font-size: 10px; color: #999; }

.iu-instrument-list { display: none; }
.iu-instrument-list.show { display: block; }

.iu-instrument-item {
  padding: 8px 14px 8px 28px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f8f8f8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gray-600);
}
.iu-instrument-item:hover { background: #f0f4ff; }
.iu-instrument-item.active { background: #e8f0fe; color: #1a56db; font-weight: 500; }
.iu-instrument-item .inst-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iu-instrument-item .inst-no { color: #999; font-size: 11px; margin-left: 8px; flex-shrink: 0; }
.iu-instrument-item .inst-count { color: #999; font-size: 11px; background: #f0f0f0; padding: 1px 6px; border-radius: 10px; margin-left: 6px; flex-shrink: 0; }
.iu-instrument-item.active .inst-no,
.iu-instrument-item.active .inst-count { color: #1a56db; background: #d4e2fc; }

.iu-all-btn {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  border-top: 1px solid #e5e7eb;
  font-weight: 500;
  color: #1a56db;
}
.iu-all-btn:hover { background: #f0f4ff; }
.iu-all-btn.active { background: #e8f0fe; }

.iu-instrument-item.no-record .inst-name { color: #bbb; }
.iu-instrument-item.no-record .inst-count { background: #f5f5f5; color: #ccc; }
.iu-instrument-item.no-record .inst-no { color: #ccc; }

#iuTable th:nth-child(1) { width: 50px; }
#iuTable th:nth-child(2) { width: 110px; white-space: nowrap; }
#iuTable th:nth-child(3) { min-width: 200px; }
#iuTable th:nth-child(4) { width: 160px; }
#iuTable th:nth-child(5) { width: 120px; }
#iuTable th:nth-child(6) { width: 100px; }
#iuTable th:nth-child(7) { width: 80px; }
#iuTable th:nth-child(8),
#iuTable th:nth-child(9),
#iuTable th:nth-child(10),
#iuTable th:nth-child(11) { width: 70px; }
#iuTable th:nth-child(12) { width: 80px; }
#iuTable th:nth-child(13) { width: 120px; white-space: nowrap; }

/* ==================== Dashboard 仪表盘：卡片外观（基础规则见响应式区块之前） ==================== */
.reminder-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 240px;
  overflow-y: auto;
}
.reminder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 13px;
}
.reminder-item:last-child { border-bottom: none; }
.reminder-item small { font-size: 11px; }
.reminder-urgent { color: #ef4444; font-weight: 500; white-space: nowrap; }
.reminder-warning { color: #f59e0b; font-weight: 500; white-space: nowrap; }
.reminder-normal { color: #10b981; white-space: nowrap; }
.badge-count {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 400;
}
.month-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.month-stat-item {
  text-align: center;
  padding: 16px 8px;
  background: #f9fafb;
  border-radius: 8px;
}
.month-stat-value {
  font-size: 28px;
  font-weight: 700;
}
.month-stat-label {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}
.recent-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.recent-table th {
  text-align: left;
  padding: 8px;
  background: #f9fafb;
  font-weight: 500;
  color: #666;
  border-bottom: 1px solid #e5e7eb;
}
.recent-table td {
  padding: 8px;
  border-bottom: 1px solid #f5f5f5;
}
.recent-table tr:last-child td { border-bottom: none; }

/* 打印样式 - 隐藏导航栏和工具栏 */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 10mm;
  }
  body * {
    visibility: hidden;
  }
  #viewInstrumentUsagePreview,
  #viewInstrumentUsagePreview *,
  #viewSampleRegistrationPreview,
  #viewSampleRegistrationPreview *,
  #viewReportArchivePreview,
  #viewReportArchivePreview *,
  #viewDistributionPrint,
  #viewDistributionPrint *,
  #viewPsSummaryPreview,
  #viewPsSummaryPreview *,
  #viewPsDetailPreview,
  #viewPsDetailPreview * {
    visibility: visible;
  }
  #viewInstrumentUsagePreview,
  #viewSampleRegistrationPreview,
  #viewReportArchivePreview,
  #viewDistributionPrint,
  #viewPsSummaryPreview,
  #viewPsDetailPreview {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
  }
  #iuPreviewToolbar,
  #srPreviewToolbar,
  #raPreviewToolbar,
  #rdPrintToolbar,
  .toolbar {
    display: none !important;
  }
  #iuPreviewContent,
  #srPreviewContent,
  #raPreviewContent,
  #rdPrintContent,
  #psSummaryPreviewContent,
  #psDetailPreviewContent {
    padding: 0 !important;
  }
  #iuPreviewContent .iu-data-table thead,
  #srPreviewContent thead,
  #raPreviewContent thead,
  #rdPrintContent thead,
  #psSummaryPreviewContent table thead,
  #psDetailPreviewContent table thead {
    display: table-header-group;
  }
  #iuPreviewContent tr,
  #srPreviewContent tr,
  #raPreviewContent tr,
  #rdPrintContent tr,
  #psSummaryPreviewContent table tr,
  #psDetailPreviewContent table tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  #iuPreviewContent th,
  #srPreviewContent th,
  #raPreviewContent th,
  #rdPrintContent th,
  #psSummaryPreviewContent table th,
  #psDetailPreviewContent table th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #f5f5f5 !important;
  }
}

/* 合作单位计价规则弹窗：表单小标签 */
.pm-lab {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 3px;
}
#pcPricingModal input[type="text"],
#pcPricingModal input[type="number"],
#pcPricingModal select {
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

/* ==================== 体系文件在线阅读（水印 + 禁复制/打印）==================== */
/* 只渲染成 canvas 位图，页面里选不出文字；容器自己滚动，配合 JS 拦 Ctrl+S/P/右键。 */
.tixi-reader {
  height: calc(100vh - 190px);
  min-height: 420px;
  margin: 12px 20px 20px;
  padding: 18px;
  overflow: auto;
  background: #525659;
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

.tixi-reader-pagewrap {
  position: relative;
  margin: 0 auto 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.tixi-reader-page {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* 水印层：canvas 画好的平铺图，盖在页面位图之上但不吃鼠标事件 */
.tixi-reader-wm {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-repeat: repeat;
  pointer-events: none;
}

/* 阅读期间即使有人按浏览器打印，也只留一片空白，防止整本手册被打印带走 */
@media print {
  .tixi-reader,
  .tixi-reader * {
    display: none !important;
  }
}

/* ============================================================
   企业级界面重设计（第一步）2026-11-26
   深色顶栏 + 全局搜索 + 我的工作台抬头 + 数据健康
   只作用于本页新增元素与 .top-bar 内部，不影响业务页面样式。
   ============================================================ */
.top-bar {
  background: #12213a;
  border-bottom: 1px solid #1d3558;
  box-shadow: none;
}
.top-bar .page-title { color: #f2f6ff; }
.top-bar .menu-toggle svg { stroke: #dce8fa; }
.top-bar .btn-outline { color: #dbe8fb; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.05); }
.top-bar .user-info { color: #e8f0fd; }
.top-bar .user-info svg { stroke: #e8f0fd; }
.top-bar .user-info span { color: #e8f0fd; }
.top-bar .connection-status .status-text { color: #b9cde8; }
.top-bar .notification-bell svg { stroke: #e8f0fd; }

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 660px;
  height: 36px;
  margin-left: 10px;
  padding: 0 12px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  color: #9fb6d4;
}
.global-search:focus-within { border-color: #5b9cff; background: rgba(255,255,255,.14); }
.global-search > svg { width: 16px; height: 16px; flex-shrink: 0; }
.global-search input {
  flex: 1; min-width: 0; border: 0; outline: 0;
  background: transparent; color: #fff; font-size: 13px;
}
.global-search input::placeholder { color: #91a8c6; }
.global-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }
.global-search-panel {
  position: absolute; top: 42px; left: 0; width: 100%;
  max-height: 440px; overflow: auto;
  background: #fff; color: #303133;
  border-radius: 8px; box-shadow: 0 10px 34px rgba(0,0,0,.22);
  z-index: 2000; padding: 6px 0;
}
.gs-group-title {
  padding: 8px 14px 4px; font-size: 11px; font-weight: 600;
  color: #909399; background: #fafbfc; letter-spacing: .5px;
}
.gs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid #f2f4f7;
}
.gs-item:hover { background: #f0f6ff; }
.gs-item .gs-val { flex: 1; color: #1f2d3d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item .gs-sub { color: #909399; font-size: 12px; }
.gs-item .gs-n { color: #409eff; font-size: 12px; background: #ecf5ff; padding: 1px 7px; border-radius: 9px; }
.gs-empty { padding: 18px; text-align: center; color: #909399; font-size: 13px; }

.wb-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; margin-bottom: 18px;
  background: linear-gradient(120deg, #f4f8ff 0%, #ffffff 62%);
  border: 1px solid #dce8f8; border-left: 4px solid #2563eb; border-radius: 8px;
}
.wb-hello b { display: block; font-size: 18px; color: #1f2d3d; }
.wb-hello span { display: block; margin-top: 4px; font-size: 12px; color: #7c8ca3; }
.wb-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.wb-quick button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 12px; color: #2c5282;
  background: #fff; border: 1px solid #cbdcf2; border-radius: 6px; cursor: pointer;
}
.wb-quick button:hover { background: #eaf3ff; border-color: #7fb0ee; }
.wb-quick button b { font-size: 15px; line-height: 1; color: #2563eb; }

.dash-health-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; font-size: 12px; border-bottom: 1px dashed #edf0f4;
}
.dash-health-row:last-child { border-bottom: 0; }
.dash-health-row .dh-label { color: #606266; }
.dash-health-row .dh-value { font-weight: 600; }
.dh-ok { color: #16a34a; }
.dh-warn { color: #d97706; }
.dh-bad { color: #dc2626; }

/* 8 域导航分组 */
.nav-domain-label {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 16px 7px; font-size: 12px; font-weight: 600;
  color: #9fb6d2; letter-spacing: .5px;
  user-select: none; cursor: pointer; border-top: 1px solid rgba(255,255,255,.07);
  transition: color .15s, background .15s;
}
.nav-domain-label:hover { color: #cfe2f7; background: rgba(255,255,255,.03); }
.nav-domain-label:first-child { border-top: 0; }
.nav-domain-label::before {
  content: ''; width: 0; height: 0; flex: none;
  border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transform: rotate(90deg); transition: transform .18s ease; opacity: .75;
}
.nav-domain-label.collapsed::before { transform: rotate(0deg); }
.nav-domain-name { flex: 1; min-width: 0; }
.nav-domain-count {
  font-style: normal; font-size: 10px; font-weight: 500; line-height: 1;
  padding: 2px 6px; border-radius: 9px; color: #8aa4c2; background: rgba(255,255,255,.07);
}
.nav-domain-label.collapsed .nav-domain-count { opacity: .65; }
.nav-domain-group { overflow: hidden; max-height: 1600px; transition: max-height .22s ease; }
.nav-domain-group.collapsed { max-height: 0; }
.nav-domains-host { padding-bottom: 18px; }

/* 旧分组彻底让位：11 域重组把 nav-item 都搬进了 .nav-domains-host，剩下的
   .nav-group-label / .nav-group 都是空壳。之前靠 JS 逐个 style.display='none'，
   但折叠状态恢复(localStorage)、权限重算、定时器都会把它们再设回 block，
   于是侧栏就出现「上面一套新域、下面一套旧标题」的两套菜单。这里按结构封死。 */
.sidebar-nav > .nav-group-label,
.sidebar-nav > .nav-group:empty { display: none !important; }

/* 化学药品汇总清单：15 列挤在 1000px 里，容器会把「分析纯 AR」「剧毒物质」
   逐字折成一竖排，看着像乱码。给表格一个下限宽度让容器横向滚动，
   短字段一律不换行；名称/厂家/存放地点允许折行，但给足最小宽度。
   类别紧跟名称——它是最常用的筛选维度，原来放在倒数第二列，横向滚动时永远看不见。 */
#chemicalTable { min-width: 1300px; }
#chemicalTable th, #chemicalTable td { padding: 9px 10px; font-size: 13px; white-space: nowrap; }
#chemicalTable td:nth-child(2),
#chemicalTable td:nth-child(6),
#chemicalTable td:nth-child(12) { white-space: normal; }
#chemicalTable th:nth-child(1) { width: 88px; }
#chemicalTable th:nth-child(2) { width: 120px; }
#chemicalTable th:nth-child(3) { width: 100px; }
#chemicalTable th:nth-child(4) { width: 100px; }
#chemicalTable th:nth-child(5) { width: 84px; }
#chemicalTable th:nth-child(6) { width: 146px; }
#chemicalTable th:nth-child(7),
#chemicalTable th:nth-child(8) { width: 96px; }
#chemicalTable th:nth-child(9) { width: 92px; }
#chemicalTable th:nth-child(10) { width: 56px; }
#chemicalTable th:nth-child(11) { width: 108px; }
#chemicalTable th:nth-child(12) { width: 104px; }
#chemicalTable th:nth-child(13) { width: 144px; }
/* 操作列钉在右边：表格要横向滚动时，按钮不会跟着滚出屏幕，否则每改一条都得先拖到底 */
#chemicalTable th:last-child,
#chemicalTable td:last-child {
  position: sticky; right: 0; background: #fff; z-index: 2;
  box-shadow: -6px 0 8px -6px rgba(0, 0, 0, .18);
}
#chemicalTable thead th:last-child { background: var(--gray-50); }

/* 工作台 KPI（按重设计稿四联卡） */
.wb-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.wb-kpi { background: #fff; border: 1px solid #e4e9f0; border-radius: 8px; padding: 11px 13px; cursor: pointer; }
.wb-kpi:hover { border-color: #93b4e0; box-shadow: 0 2px 10px rgba(31,95,168,.08); }
.wb-kpi i { display: block; font-style: normal; font-size: 11px; color: #8a95a5; }
.wb-kpi b { display: block; font-size: 20px; line-height: 1.5; color: #1f5fa8; }
.wb-kpi em { font-style: normal; font-size: 10px; color: #0f8a4b; }
.wb-kpi em.warn { color: #b26a00; }
.wb-kpi em.bad { color: #c0392b; }

@media (max-width: 900px) {
  .global-search { max-width: none; }
  .wb-hero { flex-direction: column; align-items: flex-start; }
  .wb-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 财务单据（结算明细 / 结算确认）：追求可核对，不用花哨配色 ===== */
.fin-doc { color: #1f2937; font-size: 13px; }
.fin-doc-head { text-align: center; padding-bottom: 10px; border-bottom: 2px solid #1f2937; margin-bottom: 14px; }
.fin-doc-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: 3px; }
.fin-doc-head .sub { margin-top: 6px; font-size: 11.5px; color: #6b7280; letter-spacing: 1px; }
.fin-doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 28px; margin-bottom: 14px; font-size: 12.5px; color: #374151; }
.fin-doc-meta div { display: flex; gap: 6px; min-width: 0; }
.fin-doc-meta b { font-weight: 400; color: #6b7280; flex: none; }
.fin-doc-meta span { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-sums { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #d1d5db; margin-bottom: 16px; }
.fin-sum { padding: 10px 14px; border-left: 1px solid #e5e7eb; }
.fin-sum:first-child { border-left: 0; }
.fin-sum span { display: block; font-size: 11.5px; color: #6b7280; margin-bottom: 3px; }
.fin-sum b { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.fin-sum b.due { color: #b91c1c; }
.fin-sum b.done { color: #15803d; }
.fin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fin-table th { background: #f3f4f6; border: 1px solid #d1d5db; padding: 7px 8px; font-weight: 600; color: #374151; text-align: center; white-space: nowrap; }
.fin-table td { border: 1px solid #e5e7eb; padding: 6px 8px; }
.fin-table td.ctr { text-align: center; }
.fin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fin-table tbody tr:hover { background: #fafbfc; }
.fin-table tfoot td { background: #f9fafb; font-weight: 600; border-top: 2px solid #9ca3af; }
.fin-table .st { display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: 11px; border: 1px solid; }
.fin-table .st.no { color: #b91c1c; border-color: #fca5a5; background: #fef2f2; }
.fin-table .st.yes { color: #15803d; border-color: #86efac; background: #f0fdf4; }
.fin-table .st.part { color: #b45309; border-color: #fcd34d; background: #fffbeb; }
.fin-scroll { max-height: 46vh; overflow: auto; border: 1px solid #d1d5db; }
.fin-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid #e5e7eb; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.fin-note { margin-top: 12px; font-size: 11.5px; color: #6b7280; line-height: 1.7; }
.modal-content.fin-wide { max-width: 1080px !important; width: 92vw; }

/* ===== 结算页工具栏：两行分区，避免十几个控件挤成一条 ===== */
.settle-toolbar { background: #fff; border-bottom: 1px solid #e5e7eb; padding: 12px 20px 0; }
.st-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-row.st-sub {
  margin: 10px -20px 0; padding: 9px 20px; background: #f8fafc; border-top: 1px solid #eef2f7;
}
.st-spacer { flex: 1; }
.st-label { font-size: 12px; color: #6b7280; flex: none; }
.st-sep { width: 1px; height: 18px; background: #dbe3ec; margin: 0 6px; }
.st-tilde { color: #94a3b8; font-size: 12px; }
.st-hint { font-size: 11.5px; color: #9aa5b1; margin-left: 6px; }

/* ===== 今日经营动态（管理报表驾驶舱顶部） ===== */
.pulse-wrap { background:#fff; border:1px solid #e5e7eb; border-radius:8px; padding:16px 18px; margin-bottom:20px; }
.pulse-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.pulse-head b { font-size:15px; color:#111827; }
.pulse-date { margin-left:10px; font-size:12px; color:#9aa5b1; }
.pulse-kpis { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:1px; background:#eef2f7; border:1px solid #eef2f7; border-radius:6px; overflow:hidden; margin-bottom:14px; }
.pulse-kpi { background:#fff; padding:11px 14px; }
.pulse-kpi span { display:block; font-size:12px; color:#6b7280; margin-bottom:4px; }
.pulse-kpi b { font-size:22px; font-weight:600; color:#111827; font-variant-numeric:tabular-nums; }
.pulse-kpi em { font-style:normal; font-size:11px; color:#9aa5b1; margin-left:5px; display:block; margin-top:2px; }
.pulse-kpi.bad b { color:#b91c1c; }
.pulse-kpi.warn b { color:#b45309; }
.pulse-cols { display:grid; grid-template-columns:repeat(3,1fr); gap:22px; }
.pulse-col h5 { margin:0 0 8px; font-size:12.5px; font-weight:600; color:#374151; }
.pulse-col h5 i { font-style:normal; font-weight:400; font-size:11px; color:#9aa5b1; margin-left:6px; }
.pulse-line { display:flex; align-items:center; gap:8px; padding:4px 0; font-size:12.5px; }
.pl-rank { width:16px; color:#9aa5b1; font-size:11px; flex:none; }
.pl-rank.bad { color:#b91c1c; }
.pl-name { width:62px; flex:none; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#374151; }
.pl-bar { flex:1; height:6px; background:#f1f5f9; border-radius:3px; overflow:hidden; }
.pl-bar i { display:block; height:100%; background:#93b4e0; border-radius:3px; }
.pl-bar i.bad { background:#f0a3a3; }
.pl-num { width:56px; text-align:right; flex:none; color:#374151; font-variant-numeric:tabular-nums; }
.pulse-empty { font-size:12px; color:#9aa5b1; padding:6px 0; }
.pulse-loading { font-size:12.5px; color:#9aa5b1; padding:8px 0; }
@media (max-width: 1200px) {
  .pulse-kpis { grid-template-columns:repeat(3,1fr); }
  .pulse-cols { grid-template-columns:1fr; gap:14px; }
}
/* 结算表「资质分类」标签：一行放得下，不再竖排成瀑布 */
.dom-badge { display:inline-block; padding:1px 7px; margin:1px 3px 1px 0; border-radius:2px; font-size:11px; line-height:17px; white-space:nowrap; }
#settlementTableBody td, #settlementTable { vertical-align: middle; }
#settlementTableBody td:nth-child(4) { white-space: nowrap; }
.fin-table .st { white-space: nowrap; }
.fin-actions .btn { white-space: nowrap; }
.fin-actions .btn-success { background:#15803d; border-color:#15803d; }
.fin-actions .btn-primary { background:#1e40af; border-color:#1e40af; }
/* 结算汇总清单：屏幕上一行一条，工程名可换行，金额不折行 */
.summary-toolbar { display:flex; align-items:center; gap:8px; padding:10px 16px; border-bottom:1px solid #e5e7eb; background:#f8fafc; }
#summaryContent table th, #summaryContent table td { white-space: nowrap; }
#summaryContent table td:nth-child(2) { white-space: normal; min-width: 230px; line-height: 1.5; }
#summaryContent table td:nth-child(3) { white-space: normal; min-width: 130px; line-height: 1.5; }
@media print { .no-print { display: none !important; } }
/* 驾驶舱六张卡：金额长、标签长，不加约束会把「本月自营营收」竖排成四行 */
#execDashboardView .stat-card { min-width: 0; overflow: hidden; }
#execDashboardView .stat-card > div:first-child {
  font-size: 12.5px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#execDashboardView .stat-card > div:nth-child(2) {
  font-size: 21px !important; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.exec-card-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(185px,1fr)); gap:14px; margin-bottom:22px; }
