body {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: #1f2933;
  min-height: 100vh;
}

/* 响应式容器 - 根据屏幕大小自动调整页边距 */
.container {
  max-width: 100%;
  padding-left: clamp(12px, 3vw, 24px);
  padding-right: clamp(12px, 3vw, 24px);
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

@media (min-width: 1600px) {
  .container {
    max-width: 1480px;
  }
}

.card {
  border-radius: 0.9rem;
  border: none;
}

.card.shadow-sm,
.card.shadow {
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.page-header-card .card-body {
  background: rgba(255, 255, 255, 0.75);
}

.form-label-sm {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.btn-soft-primary {
  color: #0b5ed7;
  background: rgba(13, 110, 253, 0.12);
  border: 1px solid rgba(13, 110, 253, 0.18);
}

.btn-soft-primary:hover,
.btn-soft-primary:focus {
  color: #fff;
  background: #0b5ed7;
  border-color: #0b5ed7;
}

.table-modern thead th {
  background: #f1f5f9;
  border-bottom: none;
  color: #334155;
  font-weight: 600;
  text-wrap: nowrap;
  white-space: nowrap;
}

.table-modern tbody td {
  background: #ffffff;
}

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

.table-sticky-head thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.table-sticky-first .sticky-col {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #ffffff;
  box-shadow: 6px 0 12px rgba(15, 23, 42, 0.08);
  min-width: 4rem;
}

.table-sticky-first tbody td.sticky-col,
.table-sticky-first thead th.sticky-col {
  background: #ffffff;
}

.person-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.person-name {
  font-weight: 600;
  color: #0f172a;
}

.person-meta {
  font-size: 0.75rem;
  color: #64748b;
}

.grade-color-chip {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.table thead th {
  text-wrap: nowrap;
  white-space: nowrap;
}

/* ========== 表格响应式优化 ========== */

/* 表格容器 - 支持横向滚动 */
.table-responsive {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
  scroll-behavior: smooth;
  max-width: 100%;
  margin-bottom: 1rem;
}

/* 自定义滚动条样式 */
.table-responsive::-webkit-scrollbar {
  height: 10px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* 表格基础样式 - 不限制最小宽度,让内容自然展开 */
.table-responsive > table {
  margin-bottom: 0;
  white-space: nowrap; /* 防止文字换行 */
}

/* 表格单元格默认样式 */
.table th,
.table td {
  padding: 0.75rem;
  vertical-align: middle;
}

/* 人员管理表格特定样式 */
.personnel-table th,
.personnel-table td {
  min-width: 100px; /* 默认最小宽度 */
  max-width: 300px; /* 防止过宽 */
}

/* 人员表格输入框样式 */
.personnel-table input[type="text"],
.personnel-table input[type="date"],
.personnel-table select,
.personnel-table textarea {
  min-width: 90px;
  max-width: 100%;
}

/* 特定列宽度优化 */
.personnel-table th:nth-child(1),
.personnel-table td:nth-child(1) {
  min-width: 40px;
  max-width: 40px;
  width: 40px;
  padding: 0.5rem;
}

/* 工号列 */
.personnel-table th:nth-child(2),
.personnel-table td:nth-child(2) {
  min-width: 80px;
  width: 100px;
}

/* 姓名列 */
.personnel-table th:nth-child(3),
.personnel-table td:nth-child(3) {
  min-width: 80px;
  width: 100px;
}

/* 岗位、班组等文本列 */
.personnel-table th:nth-child(n+4):nth-child(-n+10),
.personnel-table td:nth-child(n+4):nth-child(-n+10) {
  min-width: 120px;
  width: auto;
}

/* 日期列 */
.personnel-table input[type="date"] {
  min-width: 140px;
}

/* 下拉选择列 */
.personnel-table select {
  min-width: 100px;
  width: auto;
}

/* 计算字段列(年龄、工龄等) */
.personnel-table td[data-computed] {
  min-width: 70px;
  width: 90px;
  text-align: center;
  background-color: #f8f9fa;
  font-weight: 500;
}

/* 操作列 */
.personnel-table th:last-child,
.personnel-table td:last-child {
  min-width: 80px;
  width: 80px;
  text-align: center;
  position: sticky;
  right: 0;
  background: white;
  box-shadow: -2px 0 5px rgba(0,0,0,0.05);
  z-index: 1;
}

.personnel-table thead th:last-child {
  background: #f8f9fa;
}

/* 通用数据表格样式优化 */
.table-sm th,
.table-sm td {
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
}

/* 表格内的表单控件 */
.table input.form-control-sm,
.table select.form-select-sm {
  min-width: 80px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* 培训记录表格 */
.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* 表格内的徽章 */
.table .badge {
  white-space: nowrap;
  padding: 0.35em 0.65em;
}

/* 文本截断显示 */
.table .text-truncate {
  max-width: 200px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* 操作按钮列 */
.table th:has(.form-check-input),
.table td:has(.form-check-input) {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  text-align: center;
  padding: 0.5rem;
}

/* 移动端表格优化 */
@media (max-width: 768px) {
  .table-responsive {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .table th,
  .table td {
    padding: 0.5rem;
    font-size: 0.875rem;
  }

  /* 移动端不压缩单元格 */
  .personnel-table th,
  .personnel-table td {
    min-width: 100px;
  }

  .personnel-table input,
  .personnel-table select,
  .personnel-table textarea {
    font-size: 0.875rem;
  }

  /* 移动端表格文字大小 */
  .table-sm {
    font-size: 0.8125rem;
  }

  /* 移动端徽章 */
  .table .badge {
    font-size: 0.7rem;
    padding: 0.25em 0.5em;
  }
}

/* 大屏幕优化 - 充分利用空间 */
@media (min-width: 1400px) {
  .personnel-table th,
  .personnel-table td {
    min-width: 120px;
  }

  .personnel-table input[type="text"],
  .personnel-table select {
    min-width: 110px;
  }

  .table th,
  .table td {
    padding: 0.85rem 0.75rem;
  }
}

/* ========== 图表容器响应式 ========== */

/* ECharts 图表容器 */
[id*="Chart"],
[id*="chart"] {
  width: 100% !important;
  height: auto !important;
  min-height: 300px;
  max-height: 600px;
}

/* 移动端图表高度调整 */
@media (max-width: 768px) {
  [id*="Chart"],
  [id*="chart"] {
    min-height: 250px;
    max-height: 400px;
  }
}

@media (max-width: 576px) {
  [id*="Chart"],
  [id*="chart"] {
    min-height: 200px;
    max-height: 350px;
  }
}

/* ========== 卡片响应式优化 ========== */

.card {
  margin-bottom: 1rem;
}

/* 移动端卡片内边距调整 */
@media (max-width: 576px) {
  .card-body {
    padding: 1rem;
  }

  .card-header {
    padding: 0.75rem 1rem;
  }
}

/* ========== 按钮组响应式 ========== */

.btn-group {
  flex-wrap: wrap;
  gap: 0.25rem;
}

@media (max-width: 576px) {
  .btn-group {
    width: 100%;
  }

  .btn-group > .btn {
    flex: 1 1 auto;
  }
}

/* ========== 移动端优化 ========== */

@media (max-width: 768px) {
  .page-header-card .card-body {
    background: rgba(255, 255, 255, 0.9);
  }

  .table-sticky-first .sticky-col {
    min-width: 3.5rem;
    box-shadow: 4px 0 10px rgba(15, 23, 42, 0.08);
  }

  /* 导航栏优化 */
  .navbar-collapse {
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 表单组优化 */
  .row.g-3 > .col-md-2,
  .row.g-3 > .col-md-3,
  .row.g-3 > .col-md-4,
  .row.g-3 > .col-md-6 {
    margin-bottom: 0.75rem;
  }

  /* 统计卡片堆叠 */
  .row.g-3 > .col-md-3,
  .row.g-3 > .col-md-4 {
    min-width: 100%;
  }
}

/* ========== 触摸优化 ========== */

/* 增大点击区域 */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }

  .btn-sm {
    min-height: 38px;
    padding: 0.4rem 0.8rem;
  }

  .form-control,
  .form-select {
    min-height: 44px;
    font-size: 16px; /* 防止iOS自动放大 */
  }

  .form-control-sm,
  .form-select-sm {
    min-height: 38px;
    font-size: 14px;
  }
}

/* ========== 表单响应式优化 ========== */

/* 筛选表单 */
.row.align-items-end > [class*="col-"] {
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .row.align-items-end > [class*="col-"] {
    margin-bottom: 0.75rem;
  }

  /* 按钮占满宽度 */
  .row.align-items-end button,
  .row.align-items-end a {
    width: 100%;
  }
}

/* ========== 模态框响应式 ========== */

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .modal-lg,
  .modal-xl {
    max-width: calc(100% - 1rem);
  }
}

/* ========== 实用工具类 ========== */

/* 文本截断 */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 滚动阴影效果 */
.scroll-shadow {
  position: relative;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.scroll-shadow::before,
.scroll-shadow::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  pointer-events: none;
  z-index: 2;
}

.scroll-shadow::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 100%);
}

.scroll-shadow::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 100%);
}
