/* ===== 病媒生物防制ERP系统 - 样式表 ===== */

/* ===== 重置 & 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
*:focus { outline: none; }

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #14b8a6;
  --primary-bg: #f0fdfa;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #0d9488;

  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-white: #f8fafc;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition: all 0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s ease;
  z-index: 100;
}

.sidebar.collapsed { width: 64px; }

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-light);
}

.sidebar.collapsed .logo-text { display: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-group {
  margin-bottom: 4px;
}

.nav-group-title {
  font-size: 11px;
  color: var(--text-light);
  padding: 12px 12px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar.collapsed .nav-group-title { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 500;
}

.nav-item svg { flex-shrink: 0; }

.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-detail {
  display: flex;
  flex-direction: column;
}

.user-name { font-size: 13px; font-weight: 500; color: #fff; }
.user-role { font-size: 11px; color: var(--text-light); }

.sidebar.collapsed .user-detail { display: none; }

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 顶部栏 ===== */
.topbar {
  height: 60px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
}

.menu-toggle:hover { color: var(--text); }

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-search svg {
  position: absolute;
  left: 10px;
  color: var(--text-light);
}

.topbar-search input {
  width: 240px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
}

.topbar-search input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  position: relative;
  transition: var(--transition);
}

.icon-btn:hover { background: var(--bg); color: var(--text); }

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.badge-dot:empty { display: none; }

/* ===== 页面内容 ===== */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

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

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

.card-body { padding: 20px; }

/* ===== KPI卡片 ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: var(--transition);
}

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

.kpi-info { flex: 1; }

.kpi-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.kpi-unit { font-size: 14px; font-weight: 400; color: var(--text-secondary); margin-left: 4px; }

.kpi-trend {
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

.cert-mini-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cert-mini-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
  line-height: 1.4;
}
.cert-mini-tag.cert-advanced { background: #fef3c7; color: #92400e; }
.cert-mini-tag.cert-intermediate { background: #dbeafe; color: #1e40af; }
.cert-mini-tag.cert-basic { background: #d1fae5; color: #166534; }
.cert-mini-tag.cert-qualified { background: #e0e7ff; color: #3730a3; }
.cert-mini-tag.cert-other { background: #f3f4f6; color: #6b7280; }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.teal { background: var(--primary-bg); color: var(--primary); }
.kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.amber { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }

/* ===== 图表区域 ===== */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-container {
  position: relative;
  height: 260px;
  padding: 16px 20px;
}

.chart-container canvas, .chart-container svg {
  max-height: 260px;
}

/* ===== 表格 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.data-table tbody tr {
  transition: var(--transition);
}

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

.data-table tbody tr.row-selected {
  background: #e6f7f5 !important;
  border-left: 3px solid var(--primary);
}

.data-table tbody tr.row-selected:hover {
  background: #d1f0ec !important;
}

/* 复选框样式 */
.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* 批量操作按钮样式 */
.btn-danger.btn-sm {
  font-weight: 500;
  animation: fadeInRight 0.2s ease;
}

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

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.pagination-info {
  white-space: nowrap;
}

.page-size-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

.pagination-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled):not(.active) {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.page-btn:disabled {
  color: var(--text-light);
  cursor: not-allowed;
  background: var(--bg);
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-light);
  font-size: 14px;
  letter-spacing: 2px;
}

.data-table .actions {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

/* 工单列表：固定列宽，平均分布，避免某一列被撑出大段空白 */
#woTable {
  table-layout: fixed;
  min-width: 1100px;
}

#woTable thead th,
#woTable tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#woTable thead th:first-child,
#woTable tbody td:first-child {
  text-align: center;
  overflow: visible;
}

#woTable .actions {
  justify-content: flex-start;
  gap: 3px;
  flex-wrap: nowrap;
}

/* 工单操作列：紧凑按钮布局，保证小分辨率下不挤压 */
#woTable .actions .btn-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
#woTable .actions .btn-icon svg {
  width: 14px;
  height: 14px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

/* ===== 状态标签 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-success { background: var(--success-bg); color: var(--success); }
.tag-warning { background: var(--warning-bg); color: #b45309; }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-default { background: #f1f5f9; color: var(--text-secondary); }

/* ===== 工单派单闭环样式 ===== */
.wo-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.wo-stat-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.wo-stat-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.wo-stat-item.active { box-shadow: 0 0 0 2px #0d9488; transform: translateY(-1px); }
.wo-stat-item .num { font-size: 24px; font-weight: 600; color: var(--text); }
.wo-stat-item .lbl { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.wo-stat-item.warning .num { color: #d97706; }
.wo-stat-item.info .num { color: var(--info); }
.wo-stat-item.primary .num { color: var(--primary); }
.wo-stat-item.success .num { color: var(--success); }
@media (max-width: 1100px) { .wo-stats { grid-template-columns: repeat(3, 1fr); } }

/* 时间线 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-dot {
  position: absolute; left: -20px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

/* 作业单展示 */
.report-block {
  background: var(--bg);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.mini-table {
  width: 100%; border-collapse: collapse;
  margin-top: 8px; font-size: 13px;
}
.mini-table th, .mini-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  text-align: left;
}
.mini-table th { background: var(--bg); font-weight: 500; color: var(--text-secondary); }
.section-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-top: 16px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.btn-sm { padding: 4px 10px; font-size: 12px; }
.tag-default { background: #f1f5f9; color: var(--text-secondary); }
.tag-primary { background: var(--primary-bg); color: var(--primary); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

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

.btn-secondary:hover { background: var(--border-light); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-icon {
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  display: inline-flex;
  transition: var(--transition);
}

.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.edit:hover { color: var(--info); }
.btn-icon.delete:hover { color: var(--danger); }
.btn-icon.view:hover { color: var(--primary); }

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-select, .search-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  transition: var(--transition);
}

/* 多选筛选按钮（与 select 视觉对齐） */
button.filter-multi {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  min-width: 120px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
button.filter-multi:hover { border-color: var(--primary); background: #fafbfc; }
button.filter-multi.active { border-color: var(--primary); color: var(--primary); background: #f0fdfa; }

.filter-select:focus, .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}

.search-input { width: 220px; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 720px;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}

.modal-close:hover { color: var(--text); }

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== 表单 ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

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

.form-label .req { color: var(--danger); }

.form-input, .form-select, .form-textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--card-bg);
  transition: var(--transition);
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}

.form-textarea { resize: vertical; min-height: 80px; }

/* ===== 人员证书上传 ===== */
.cert-link {
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.cert-link:hover {
  text-decoration: underline;
}

.cert-hint {
  font-size: 12px;
  color: #94a3b8;
  font-weight: normal;
  margin-left: 6px;
}

.cert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fafafa;
  min-height: 80px;
  align-items: flex-start;
}

.cert-empty {
  width: 100%;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 16px 0;
}

.cert-thumb {
  position: relative;
  width: 110px;
  height: 130px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.cert-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cert-thumb-img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.cert-pdf-icon {
  width: 100%;
  height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-size: 28px;
  font-weight: bold;
}

.cert-pdf-icon span {
  font-size: 12px;
  font-weight: normal;
  margin-top: 2px;
}

.cert-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s;
}

.cert-remove:hover {
  background: #dc2626;
}

.cert-preview-mask {
  position: absolute;
  inset: 0 0 32px 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: auto;
}

.cert-thumb:hover .cert-preview-mask {
  opacity: 1;
}

.cert-name {
  height: 32px;
  padding: 4px 6px;
  font-size: 11px;
  color: #475569;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-top: 1px solid #f1f5f9;
  background: #fff;
}

.cert-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.cert-upload-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.cert-upload-btn:hover {
  background: #0b7e74;
}

.cert-upload-hint {
  font-size: 12px;
  color: #64748b;
  flex: 1;
  word-break: break-all;
}

/* ===== 证书预览 ===== */
.cert-preview-img-wrap {
  text-align: center;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  max-height: 70vh;
  overflow: auto;
}

.cert-preview-img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 4px;
}

.cert-preview-meta {
  text-align: center;
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
  word-break: break-all;
}

/* ===== 客户选择器（带搜索框） ===== */
.cust-picker {
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  transition: border-color 0.2s;
}

.cust-picker:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}

.cust-picker-search {
  width: 100%;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 14px;
  background: #f8fafc;
  border-radius: 6px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.cust-picker-search::placeholder {
  color: #94a3b8;
}

.cust-picker .form-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  padding: 8px;
  font-size: 13px;
  background: #fff;
  box-sizing: border-box;
}

.cust-picker-tip {
  margin-top: 6px;
  font-size: 12px;
  color: #999;
  padding: 0 4px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
}

/* ===== 确认框 ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  backdrop-filter: blur(2px);
}

.confirm-overlay.show { display: flex; }

.confirm-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

.confirm-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.confirm-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-msg {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* 确认弹窗：输入"确定"双重确认 */
.confirm-input-wrap {
  margin: -6px 0 18px;
}
.confirm-input-wrap input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  outline: none;
}
.confirm-input-wrap input:focus {
  border-color: var(--primary);
}

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  border-left: 4px solid var(--primary);
  animation: toastIn 0.3s ease;
  min-width: 280px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastOut {
  to { transform: translateX(100%); opacity: 0; }
}

/* ===== 告警列表 ===== */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
}

.alert-item.danger { background: var(--danger-bg); }
.alert-item.warning { background: var(--warning-bg); }
.alert-item.info { background: var(--info-bg); }

.alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.alert-item.danger .alert-icon { background: var(--danger); color: #fff; }
.alert-item.warning .alert-icon { background: var(--warning); color: #fff; }
.alert-item.info .alert-icon { background: var(--info); color: #fff; }

.alert-content { flex: 1; }
.alert-title { font-weight: 500; }
.alert-desc { font-size: 12px; color: var(--text-secondary); }

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

.empty-state svg { margin-bottom: 16px; }
.empty-state p { font-size: 14px; }

/* ===== 进度条 ===== */
.progress {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-bar.teal { background: var(--primary); }
.progress-bar.amber { background: var(--warning); }
.progress-bar.red { background: var(--danger); }
.progress-bar.green { background: var(--success); }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .chart-grid, .chart-grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { position: fixed; left: -240px; height: 100vh; }
  .sidebar.show { left: 0; }
  .topbar-search input { width: 140px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ===== 通知面板 ===== */
.notif-panel {
  position: fixed;
  top: 60px;
  right: 24px;
  width: 380px;
  max-width: 90vw;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 999;
  display: none;
}

.notif-panel.show { display: block; }

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

.notif-body {
  max-height: 400px;
  overflow-y: auto;
}

.notif-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.notif-item:hover { background: #f8fafc; }
.notif-item:last-child { border-bottom: none; }

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

/* ===== 详情页 ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 12px;
  color: var(--text-light);
}

.detail-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.detail-item.full { grid-column: 1 / -1; }

/* ===== 分段标题 ===== */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title:first-child { margin-top: 0; }

.section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}

/* ===== 工单详情 — 标签列表 ===== */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.tag-list .tag { margin: 0; }

/* ===== 工单详情 — 药品卡片列表 ===== */
.drug-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.drug-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s;
}

.drug-card:hover {
  border-color: var(--primary);
  background: var(--card-bg);
}

.drug-card-index {
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.drug-card-content {
  flex: 1;
  min-width: 0;
}

.drug-card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
  margin-bottom: 4px;
}

.drug-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.drug-card-qty {
  font-size: 13px;
  font-weight: 600;
  color: #4CAF50;
  background: rgba(76, 175, 80, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.drug-card-method {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(33, 150, 243, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ===== 工单详情 — 照片网格 ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.photo-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.15s;
}

.photo-thumb:hover {
  transform: scale(1.03);
  border-color: var(--primary);
}

/* ===== 工单详情 — 客户签名 ===== */
.signature-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 4px;
}

.signature-img {
  display: block;
  width: 100%;
  max-width: 480px;
  max-height: 220px;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* ===== 工单详情 — 作业单报告 ===== */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 12px;
}

.report-block {
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 8px;
  word-break: break-all;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}

/* ===== 列表项卡片 ===== */
.list-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.list-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

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

.list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.list-card-title { font-size: 15px; font-weight: 600; }

.list-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.list-card-body .label { color: var(--text-light); min-width: 70px; display: inline-block; }

/* ===== 企业资质证书展示 ===== */
.cert-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 4px;
}

.cert-show-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.cert-show-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--primary-light);
}

.cert-show-thumb {
  height: 140px;
  background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.cert-show-thumb::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(13,148,136,0.03) 20px, rgba(13,148,136,0.03) 40px);
}

.cert-show-thumb-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(13,148,136,0.3);
}

.cert-show-status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  z-index: 2;
}

.cert-show-status.valid { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.cert-show-status.expiring { background: var(--warning-bg); color: var(--warning); border: 1px solid #fcd34d; }
.cert-show-status.expired { background: var(--danger-bg); color: var(--danger); border: 1px solid #fca5a5; }

.cert-show-info {
  padding: 12px 14px;
}

.cert-show-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cert-show-meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.cert-show-meta .cert-meta-row {
  display: flex;
  justify-content: space-between;
}

.cert-show-meta .cert-meta-label {
  color: var(--text-light);
}

.cert-show-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  color: #fff;
  text-align: center;
  padding: 20px 0 8px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.cert-show-card:hover .cert-show-overlay { opacity: 1; }

/* 证书预览弹窗 */
.cert-preview-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.cert-preview-content {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.cert-preview-title { font-size: 16px; font-weight: 600; }

.cert-preview-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.cert-preview-close:hover { background: var(--bg); color: var(--text); }

.cert-preview-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.cert-preview-img-area {
  width: 100%;
  min-height: 300px;
  background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.cert-preview-img-area::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(13,148,136,0.03) 20px, rgba(13,148,136,0.03) 40px);
}

.cert-preview-placeholder-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  z-index: 1;
}

.cert-preview-placeholder-text {
  font-size: 14px;
  color: var(--text-light);
  z-index: 1;
}

.cert-preview-details {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cert-preview-detail-item {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.cert-preview-detail-label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.cert-preview-detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.cert-preview-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.cert-upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  border: 2px dashed var(--primary-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  color: var(--primary);
  font-size: 13px;
}

.cert-upload-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
}

/* ===== 登录界面 ===== */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 50%, #0f172a 100%);
}
.login-card {
  width: 380px;
  max-width: 92vw;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.login-logo {
  margin-bottom: 14px;
}
.login-title {
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px;
}
.login-sub {
  font-size: 13px;
  color: #94a3b8;
  margin: 0 0 26px;
}
.login-form {
  text-align: left;
}
.login-field {
  margin-bottom: 16px;
}
.login-field label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 6px;
  font-weight: 500;
}
.login-field input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.login-error {
  font-size: 13px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
}
.login-btn {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 4px;
}
.login-btn:hover { background: #0f766e; }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.login-footer {
  margin-top: 24px;
  font-size: 12px;
  color: #cbd5e1;
}

/* ===== 退出登录按钮 ===== */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.logout-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}
