/* ===== 全局变量 ===== */
:root {
  /* 侧边栏 */
  --sidebar-bg: #1f2937;
  --sidebar-bg-hover: #2d3a4d;
  --sidebar-bg-active: #1665d8;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #334155;

  /* 内容区 */
  --content-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #edf0f5;

  /* 文字 */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;

  /* 状态色 - 严格遵循要求 */
  --status-danger: #dc2626;      /* 警告/异常/逾期/低库存 红 */
  --status-danger-bg: #fef2f2;
  --status-danger-border: #fecaca;
  --status-warning: #d97706;     /* 提醒/即将到期/接近阈值 黄 */
  --status-warning-bg: #fffbeb;
  --status-warning-border: #fde68a;
  --status-success: #16a34a;     /* 正常/达标 绿 */
  --status-success-bg: #f0fdf4;
  --status-success-border: #bbf7d0;
  --status-info: #2563eb;        /* 信息/进行中 蓝 */
  --status-info-bg: #eff6ff;
  --status-info-border: #bfdbfe;

  /* 主色 */
  --primary: #1665d8;
  --primary-dark: #0d4fb0;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;

  /* 顶部栏 */
  --topbar-bg: #0f172a;
  --topbar-text: #f1f5f9;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.08);

  /* 尺寸 */
  --sidebar-width: 200px;
  --topbar-height: 52px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--content-bg);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ===== 布局 ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 顶部导航栏 ===== */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  color: var(--topbar-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
  z-index: 10;
}

.topbar-left .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #60a5fa;
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.datetime {
  font-size: 13px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.notif-icon {
  position: relative;
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.notif-icon:hover {
  color: #f1f5f9;
}

.data-mgr-icon {
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.data-mgr-icon:hover {
  color: #f1f5f9;
}

.badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--status-danger);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  line-height: 1;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
  border-left: 1px solid #334155;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: #f1f5f9;
}

.user-role {
  font-size: 11px;
  color: #64748b;
}

/* 项目切换器 */
.project-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  user-select: none;
}
.project-switcher:hover {
  border-color: #475569;
  background: rgba(51, 65, 85, 0.6);
}
.project-name {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 6px;
  display: none;
  z-index: 100;
}
.project-switcher.open .project-dropdown {
  display: block;
}
.project-dropdown-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.project-dropdown-item:hover {
  background: var(--bg-secondary);
}
.project-dropdown-item.active {
  color: var(--primary-color);
  background: rgba(59, 130, 246, 0.1);
  font-weight: 500;
}
.project-dropdown-item.active::after {
  content: '';
  margin-left: auto;
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center / contain;
}
.project-dropdown-title {
  padding: 6px 12px 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 2px;
}

.nav-menu {
  padding: 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-bg-hover);
  color: #f1f5f9;
}

.nav-item.active {
  background: rgba(22, 101, 216, 0.15);
  color: var(--sidebar-text-active);
  border-left-color: var(--primary-light);
}

/* ===== 内容区 ===== */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  background: var(--content-bg);
}

.content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== 模块通用 ===== */
.module {
  display: none;
  animation: fadeIn 0.2s ease;
}

.module.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 12px;
}

.card-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

.card-body {
  padding: 12px 14px;
}

/* ===== KPI 卡片 ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.kpi-card.danger::after { background: var(--status-danger); }
.kpi-card.warning::after { background: var(--status-warning); }
.kpi-card.success::after { background: var(--status-success); }

.kpi-label {
  font-size: 12px;
  color: var(--text-tertiary);
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-value .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-left: 2px;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.kpi-trend .trend-up { color: var(--status-success); }
.kpi-trend .trend-down { color: var(--status-danger); }

.trend-arrow {
  display: inline-block;
  font-size: 12px;
}

/* ===== 网格布局 ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-2-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.grid-2-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* ===== 表格 ===== */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-size: 12px;
}

.sortable-th:hover {
  color: var(--text-primary);
  background: #f1f5f9;
}

.sortable-th.sorted {
  color: var(--primary);
}

.sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.7;
  min-width: 10px;
  text-align: center;
}

.sortable-th.sorted .sort-arrow {
  opacity: 1;
  color: var(--primary);
}

tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* 状态标签 */
.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.tag-danger { background: var(--status-danger-bg); color: var(--status-danger); border: 1px solid var(--status-danger-border); }
.tag-warning { background: var(--status-warning-bg); color: var(--status-warning); border: 1px solid var(--status-warning-border); }
.tag-success { background: var(--status-success-bg); color: var(--status-success); border: 1px solid var(--status-success-border); }
.tag-info { background: var(--status-info-bg); color: var(--status-info); border: 1px solid var(--status-info-border); }
.tag-default { background: #f1f5f9; color: var(--text-secondary); border: 1px solid #e2e8f0; }

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.progress-fill.success { background: var(--status-success); }
.progress-fill.warning { background: var(--status-warning); }
.progress-fill.danger { background: var(--status-danger); }
.progress-fill.info { background: var(--status-info); }

.progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.progress-row .progress-bar {
  flex: 1;
}

.progress-row .progress-text {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: right;
}

/* 时间线 */
.timeline {
  position: relative;
  padding-left: 18px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 10px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -18px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--primary);
}

.timeline-dot.danger { border-color: var(--status-danger); }
.timeline-dot.warning { border-color: var(--status-warning); }
.timeline-dot.success { border-color: var(--status-success); }

.timeline-date {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.timeline-title {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.timeline-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* 数字格式 */
.num {
  font-variant-numeric: tabular-nums;
}

.text-danger { color: var(--status-danger); }
.text-warning { color: var(--status-warning); }
.text-success { color: var(--status-success); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* 图表容器 */
.chart-box {
  width: 100%;
  min-height: 260px;
}

.chart-box.sm {
  min-height: 200px;
}

.chart-box.lg {
  min-height: 320px;
}

/* 环形进度 */
.gauge-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
}

/* 表单元素 */
select, input[type="text"] {
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  color: var(--text-primary);
}

select:focus, input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  padding: 5px 12px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-secondary);
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

/* 甘特图 */
.gantt-table {
  width: 100%;
  border-collapse: collapse;
}

.gantt-table th,
.gantt-table td {
  border-bottom: 1px solid var(--border-light);
  padding: 6px 10px;
  font-size: 12px;
  text-align: left;
}

.gantt-bar-wrap {
  position: relative;
  height: 20px;
  background: #f1f5f9;
  border-radius: 2px;
  min-width: 200px;
}

.gantt-bar {
  position: absolute;
  top: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary-light);
}

.gantt-bar.actual {
  background: var(--status-success);
  opacity: 0.85;
}

.gantt-bar.danger {
  background: var(--status-danger);
}

.gantt-bar.warning {
  background: var(--status-warning);
}

.gantt-milestone {
  position: absolute;
  top: -2px;
  width: 4px;
  height: 24px;
  background: #8b5cf6;
  border-radius: 1px;
}

/* 工具行 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.seg-item {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  background: #fff;
  border-right: 1px solid var(--border-color);
}

.seg-item:last-child {
  border-right: none;
}

.seg-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 小列表 */
.small-list .list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}

.small-list .list-item:last-child {
  border-bottom: none;
}

.list-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-title {
  color: var(--text-primary);
  font-weight: 500;
}

.list-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.list-right {
  text-align: right;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.btn-sm {
  padding: 3px 8px;
  font-size: 11px;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 11px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-success {
  background: var(--status-success);
  border-color: var(--status-success);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
}

.btn-warning {
  background: var(--status-warning);
  border-color: var(--status-warning);
  color: #fff;
}

.btn-warning:hover {
  background: #b45309;
  border-color: #b45309;
}

.btn-orange {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}
.btn-orange:hover {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}
.btn-orange:active {
  background: #c2410c;
}

.btn-danger {
  background: var(--status-danger);
  border-color: var(--status-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-default {
  background: #f8fafc;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-default:hover {
  background: #f1f5f9;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
  padding: 2px 6px;
}

.btn-ghost:hover {
  background: rgba(66, 133, 244, 0.08);
}

.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--status-danger);
  padding: 2px 6px;
}

.btn-danger-ghost:hover {
  background: rgba(220, 38, 38, 0.08);
}

.btn-icon {
  padding: 2px 6px;
  font-size: 11px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-secondary);
  border-radius: 2px;
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-bg);
}

.btn-icon.danger:hover {
  color: var(--status-danger);
  border-color: var(--status-danger);
  background: var(--status-danger-bg);
}

.btn-icon.success {
  color: #16a34a;
  border-color: #16a34a;
  background: #f0fdf4;
  font-weight: 500;
}

.btn-icon.success:hover {
  color: #fff;
  border-color: #16a34a;
  background: #16a34a;
}

select.btn {
  height: 28px;
}

/* ===== 表单 ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.form-grid.col-1 { grid-template-columns: 1fr; }
.form-grid.col-3 { grid-template-columns: repeat(3, 1fr); }

.form-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-item.full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-label .required {
  color: var(--status-danger);
  margin-right: 2px;
}

.form-control {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background: #fff;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 101, 216, 0.1);
}

.form-control[readonly] {
  background: #f8fafc;
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.form-control.input-error {
  border-color: var(--status-danger);
}

textarea.form-control {
  resize: vertical;
  min-height: 54px;
  font-family: inherit;
}

.form-control[disabled] {
  background: #f8fafc;
  cursor: not-allowed;
}

/* 行内操作按钮组 */
.row-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.row-actions .btn {
  flex: 1;
  min-width: 0;
}

select.form-control {
  height: 28px;
  cursor: pointer;
}

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2000;
}

.modal-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  transform: translateY(10px);
  transition: transform 0.15s ease;
  max-width: calc(100vw - 32px);
}

.modal-mask.show .modal-panel {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;  color: var(--text-tertiary);
  border-radius: 3px;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  user-select: text;
  -webkit-user-select: text;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
  user-select: text;
  -webkit-user-select: text;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  font-size: 13px;
  color: var(--text-primary);
  border-left: 3px solid var(--status-success);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.2s ease;
  min-width: 180px;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success { border-left-color: var(--status-success); }
.toast-error { border-left-color: var(--status-danger); }
.toast-warning { border-left-color: var(--status-warning); }
.toast-info { border-left-color: var(--status-info); }

.toast-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: var(--status-success); }
.toast-error .toast-icon { background: var(--status-danger); }
.toast-warning .toast-icon { background: var(--status-warning); }
.toast-info .toast-icon { background: var(--status-info); }

/* ===== 子标签页 ===== */
.sub-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.sub-tab {
  padding: 12px 22px;
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  font-weight: 600;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
  user-select: none;
}

.sub-tab:hover {
  color: var(--primary);
  background: rgba(66, 133, 244, 0.06);
}

.sub-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(66, 133, 244, 0.08);
  font-weight: 700;
}

/* ===== 提醒卡片网格 ===== */
.alert-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.alert-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--status-warning);
  border-radius: 4px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.alert-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.alert-card.danger { border-left-color: var(--status-danger); }
.alert-card.warning { border-left-color: var(--status-warning); }
.alert-card.success { border-left-color: var(--status-success); }
.alert-card.info { border-left-color: var(--status-info); }

.alert-card .alert-label {
  font-size: 12px;
  color: var(--text-tertiary);
}

.alert-card .alert-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.alert-card.danger .alert-value { color: var(--status-danger); }
.alert-card.warning .alert-value { color: var(--status-warning); }
.alert-card.success .alert-value { color: var(--status-success); }

/* ===== 表格操作列 ===== */
.table-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

/* 表格行状态背景 */
tbody tr.row-danger {
  background: var(--status-danger-bg);
}
tbody tr.row-warning {
  background: var(--status-warning-bg);
}

/* 响应式 */
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2, .grid-2-3, .grid-3-2, .grid-2-2 {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 56px;
  }
  .nav-item span { display: none; }
  .logo-text { display: none; }
  .datetime { display: none; }
  .user-detail { display: none; }
  .user-info { border-left: none; padding-left: 0; }
  .nav-text { display: none; }
}

/* ===== 登录页 ===== */
.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, #1e3a8a 0%, transparent 60%),
              radial-gradient(900px 500px at 80% 90%, #0f766e 0%, transparent 60%),
              linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  z-index: 1000;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

.login-card {
  position: relative;
  width: 400px;
  padding: 40px 36px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  color: #f1f5f9;
}

.login-card .login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  color: #60a5fa;
}

.login-card .login-title {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 1px;
}

.login-card .login-subtitle {
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin-top: 6px;
  margin-bottom: 28px;
}

.login-form .form-item {
  margin-bottom: 16px;
}

.login-form .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-form .input-wrap .icon {
  position: absolute;
  left: 12px;
  color: #64748b;
  pointer-events: none;
}

.login-form .input-wrap input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  font-size: 14px;
  color: #f1f5f9;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.login-form .input-wrap input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.login-form .input-wrap .toggle-pwd {
  position: absolute;
  right: 10px;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
}

.login-form .input-wrap .toggle-pwd:hover {
  color: #cbd5e1;
}

.login-btn {
  width: 100%;
  padding: 11px;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  font-family: inherit;
}

.login-btn:hover {
  opacity: 0.92;
}

.login-btn:active {
  transform: translateY(1px);
}

.login-error {
  color: #f87171;
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
  min-height: 18px;
}

.login-footer {
  text-align: center;
  font-size: 11px;
  color: #475569;
  margin-top: 20px;
}

/* 用户下拉菜单 */
.user-menu-trigger {
  cursor: pointer;
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.18s ease;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown .user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: 5px;
  cursor: pointer;
}

.user-dropdown .user-dropdown-item:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.user-dropdown .user-dropdown-item.danger {
  color: var(--status-danger);
}

.user-dropdown .user-dropdown-item.danger:hover {
  background: var(--status-danger-bg);
}

.user-dropdown .ud-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* 状态小圆点 */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.link-like {
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.link-like:hover {
  text-decoration: underline;
}

/* ===== 通知下拉面板 ===== */
.notif-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 340px;
  max-height: 480px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-soft);
}

.notif-panel-body {
  flex: 1;
  overflow-y: auto;
  max-height: 340px;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover {
  background: var(--bg-muted);
}

.notif-item-left {
  flex-shrink: 0;
  padding-top: 2px;
}

.notif-item-main {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.notif-empty {
  padding: 30px 14px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

.notif-panel-footer {
  padding: 8px 10px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-soft);
}

/* 紫色标签 */
.tag-purple {
  background: #f3e8ff;
  color: #9333ea;
}
.tag-warning-light {
  background: #fef9c3;
  color: #a16207;
}

/* ===== 数据管理面板 ===== */
.data-manager-panel {
  position: fixed;
  top: 56px;
  right: 20px;
  width: 360px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.15);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.18s ease;
  font-size: 12px;
}

.data-manager-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}

.dm-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.dm-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 4px;
}

.dm-close:hover {
  color: var(--text-primary);
  background: var(--bg-muted);
}

.dm-section {
  padding: 10px 14px;
}

/* 数据管理面板：分组标题 */
.dm-group-label {
  padding: 10px 14px 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dm-group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.dm-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dm-section-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.dm-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0 14px;
}

.dm-stats {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.dm-stats span + span::before {
  content: "";
}

.dm-stats-table {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}

.dm-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}
.dm-stat-row:last-child { border-bottom: none; }
.dm-stat-row:nth-child(odd) { background: rgba(255,255,255,0.3); }
.dm-stat-num { font-weight: 600; color: var(--text-primary); }

.dm-stat-total {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-align: right;
  margin-top: 4px;
}

.dm-cache-status {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 10px;
}

.dm-cache-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.dm-cache-label { flex-shrink: 0; }

.dm-cache-value {
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

.dm-cache-status-text.status-ok { color: var(--success, #22c55e); font-weight: 600; }
.dm-cache-status-text.status-pending { color: var(--warning, #f59e0b); font-weight: 600; }
.dm-cache-status-text.status-error { color: var(--danger, #ef4444); font-weight: 600; }

.dm-preview {
  margin-top: 8px;
}

.dm-pv-box {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px;
}

.dm-pv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.dm-pv-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-bottom: 8px;
}

.dm-pv-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.dm-pv-count.changed {
  color: var(--status-warning);
  font-weight: 600;
}

.dm-pv-warn {
  font-size: 11px;
  padding: 6px 8px;
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border-radius: 4px;
  margin-bottom: 6px;
  line-height: 1.4;
}

/* ===== 角色权限控制 ===== */
/* 普通权限下隐藏财务模块菜单 */
body.role-normal .hide-finance { display: none !important; }

/* 普通权限下隐藏金额字段 */
body.role-normal .hide-amount { display: none !important; }

/* 普通权限下表格金额列隐藏（通过列th/td的类名控制） */
body.role-normal th.col-amount,
body.role-normal td.col-amount { display: none !important; }

body.role-normal th.col-paid,
body.role-normal td.col-paid { display: none !important; }

body.role-normal th.col-progress,
body.role-normal td.col-progress { display: none !important; }

body.role-normal th.col-status,
body.role-normal td.col-status { display: none !important; }

/* 普通权限下隐藏财务类图表 */
body.role-normal .chart-payment { display: none !important; }
body.role-normal .card-payment { display: none !important; }

/* 普通权限下金额显示为星号 */
body.role-normal .mask-amount {
  -webkit-text-security: disc;
  letter-spacing: 2px;
  color: var(--text-muted) !important;
}


/* ===== 维护保养计划模块 ===== */

.maintenance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 12px;
}

.month-selector,
.week-selector,
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-row {
  display: flex;
  gap: 10px;
}

.stat-pill {
  padding: 6px 14px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  text-align: center;
  min-width: 90px;
}
.stat-pill.success { border-color: var(--status-success); background: var(--status-success-bg); }
.stat-pill.success .stat-value { color: var(--status-success); }
.stat-pill.warning { border-color: var(--status-warning); background: var(--status-warning-bg); }
.stat-pill.warning .stat-value { color: var(--status-warning); }
.stat-pill.info { border-color: var(--status-info); background: var(--status-info-bg); }
.stat-pill.info .stat-value { color: var(--status-info); }

.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.compact-table th {
  background: var(--bg-page);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}
.compact-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-light);
}
.compact-table tbody tr:hover {
  background: var(--bg-hover);
}
.compact-table .text-center { text-align: center; }

.rest-row {
  background: var(--bg-page);
  color: var(--text-tertiary);
}

/* ===== 维护保养计划：日期分块布局 ===== */
.plan-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-day-block {
  display: flex;
  flex-direction: column;
}

.plan-day-header {
  height: 32px;
  background: #e8f0fe;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-radius: 4px 4px 0 0;
}

.pdh-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdh-bar {
  width: 3px;
  height: 16px;
  background: #2563eb;
  border-radius: 2px;
}

.pdh-date {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  line-height: 1;
}

.pdh-week {
  font-size: 12px;
  font-weight: 500;
  color: #3b82f6;
}

.pdh-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pdh-count {
  font-weight: 600;
  color: #2563eb;
}

.pdh-location-count {
  color: var(--text-tertiary);
  font-size: 11px;
}

.plan-day-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-top: none;
  border-radius: 0 0 4px 4px;
}

.plan-day-body.rest-body {
  padding: 12px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

.plan-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 8px 10px;
  padding-right: 64px;
}

.plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.plan-card-loc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-card-count {
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  background: #e8f0fe;
  padding: 2px 8px;
  border-radius: 10px;
}

.plan-card-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.plan-card-unit {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.plan-card-unitname {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.4;
  font-weight: 500;
}

.plan-card-regno {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
  word-break: break-all;
  font-family: Menlo, Consolas, monospace;
}
.plan-card-regno.muted {
  color: #9ca3af;
  font-style: italic;
  font-family: inherit;
}

.plan-edit-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}
.plan-edit-btn:hover {
  background: #eef2ff;
  color: #4f46e5;
}

.plan-del-btn {
  position: absolute;
  top: 6px;
  right: 34px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #ef4444;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}
.plan-del-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* 编辑弹窗表单行 */
.plan-edit-modal .form-row {
  margin-bottom: 14px;
}
.plan-edit-modal .form-row label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.status-tag.pending { background: #eef0f3; color: #6b7280; }
.status-tag.doing { background: #fef3c7; color: #b45309; }
.status-tag.done { background: #d1fae5; color: #047857; }
.status-tag.rest { background: #f3f4f6; color: #9ca3af; }
.status-tag.signed { background: #d1fae5; color: #047857; }
.status-tag.pending { background: #fef3c7; color: #b45309; }

/* ===== 查询模态样式 ===== */
.query-form .status-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.query-form table.compact-table th { background: var(--bg-card); font-weight: 600; font-size: 12px; color: var(--text-secondary); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border-light); }
.query-form table.compact-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.query-form table.compact-table tr:hover td { background: var(--bg-hover); }
.query-form .dq-check, .query-form .wq-check, .query-form .mq-check { cursor: pointer; }

/* ===== Toolbar 按钮（醒目大按钮） ===== */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-direction: row-reverse; /* 主操作在最右边 */
}
.toolbar-btn {
  height: 36px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  line-height: 36px;
}
.toolbar-btn.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
}
.toolbar-btn.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}
.toolbar-btn.btn {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  font-weight: 600;
}
.toolbar-btn.btn:hover {
  background: #eff6ff;
  color: var(--primary);
  border-color: var(--primary-hover);
}

/* 周排查适用类型tag补充 */
.wk-type-tag.active { color: #1e40af; }

/* 日管控 */
.daily-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
}

.daily-main .card,
.daily-side .card {
  margin-bottom: 12px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
}
.card-title {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.card .form-item {
  padding: 8px 14px;
}
.card .table-wrapper {
  padding: 0;
}

.elevator-chips {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.elevator-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-size: 12px;
}
.ec-loc { color: var(--text-primary); font-weight: 500; }
.ec-regno {
  font-family: Menlo, Consolas, 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ec-no { color: var(--text-secondary); font-size: 11px; }
.ec-source {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
  line-height: 1.4;
}
.ec-source.ec-plan {
  background: #e8f0fe;
  color: #2563eb;
}
.ec-source.ec-manual {
  background: #fef3c7;
  color: #b45309;
}
.elevator-chip.is-manual {
  border-style: dashed;
  border-color: #fbbf24;
  background: #fffbeb;
}
.ec-del {
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: #ef4444;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0.7;
  transition: all 0.15s;
}
.ec-del:hover {
  background: #fef2f2;
  opacity: 1;
}
.empty-elevator-tip {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 8px 0;
  text-align: center;
  width: 100%;
}

.mark-pass { color: var(--status-success); }
.mark-fail { color: var(--status-danger); }
.mark-repair { color: var(--status-warning); }
.mark-na { color: var(--text-tertiary); font-weight: 500; }
.mark-empty { color: var(--text-tertiary); }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 14px;
}
.form-grid-2 .form-item {
  padding: 8px 0;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 0 14px;
}
.form-grid-3 .form-item {
  padding: 8px 0;
}

.signatures-area {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signature-card {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  background: var(--bg-page);
}
.sig-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.sig-img-wrap {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 4px;
  border: 1px dashed var(--border-light);
}
.sig-img {
  max-width: 100%;
  max-height: 100%;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-block {
  width: 100%;
}

/* 签字面板 */
.sig-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
}
.sig-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* 周排查 / 月调度 */
.weekly-form .card,
.monthly-form .card {
  margin-bottom: 12px;
}

.radio-row {
  padding: 8px 14px 12px;
  display: flex;
  gap: 24px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.sig-section {
  padding: 0 14px 12px;
}
.sig-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}
.sig-mini img {
  height: 40px;
  background: #fff;
  border-radius: 4px;
  padding: 2px 6px;
}
.sig-mini span {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}

.form-control-sm {
  padding: 4px 8px;
  font-size: 12px;
  height: 28px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  height: 26px;
}

.btn-danger {
  background: var(--status-danger);
  color: #fff;
  border-color: var(--status-danger);
}
.btn-danger:hover {
  background: #b91c1c;
}

@media (max-width: 1024px) {
  .daily-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ========== 故障电梯记录 ========== */
.fault-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fault-item {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--bg-page);
}
.fault-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 13px;
}
.fault-index {
  font-weight: 600;
  color: var(--text-primary);
}
.fault-loc {
  color: var(--text-secondary);
}
.fault-time {
  color: var(--text-tertiary);
  font-size: 12px;
}
.fault-trapped {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--status-success-bg);
  color: var(--status-success);
}
.fault-trapped.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}
.fault-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.fault-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.fault-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* 签名位占位 */
.sig-empty { opacity: 0.7; }
.sig-empty:hover { opacity: 1; border-color: var(--primary); }
.sig-placeholder {
  height: 80px;
  width: 100%;
  border-radius: 4px;
}

/* ========== 移动端填写页面 ========== */
body.mobile-mode #app,
body.mobile-mode .app {
  display: block !important;
  height: auto !important;
  min-height: 100vh;
  overflow: visible !important;
}
body.mobile-mode .main {
  display: block !important;
  height: auto !important;
  overflow: visible !important;
}
body.mobile-mode .sidebar,
body.mobile-mode .topbar {
  display: none !important;
}
body.mobile-mode {
  background: #f5f7fa;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body.mobile-mode .mobile-page input,
body.mobile-mode .mobile-page textarea,
body.mobile-mode .mobile-page select {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px; /* 防止 iOS 微信聚焦时自动缩放 */
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
  background: #fff;
  color: #111827;
  position: relative;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath fill='%236b7280' d='M6 7L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 7px;
  padding-right: 30px;
}
body.mobile-mode .mobile-page input:focus,
body.mobile-mode .mobile-page textarea:focus,
body.mobile-mode .mobile-page select:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
body.mobile-mode #content {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100vh;
  height: auto !important;
  overflow: visible !important;
  overflow-y: visible !important;
  position: static !important;
  left: 0;
  top: 0;
  -webkit-overflow-scrolling: touch;
}
.mobile-page {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 160px;
  background: #f5f7fa;
  min-height: 100vh;
  -webkit-overflow-scrolling: touch;
}
.mobile-header {
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.mobile-header > div:first-child {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: #111827;
}
.mobile-header > div:nth-child(2) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mobile-date-input {
  width: 200px;
  padding: 10px 32px 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  color: #111827;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath fill='%236b7280' d='M6 7L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 7px;
}
.mobile-date-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.mobile-section {
  background: #fff;
  margin: 10px 12px;
  border-radius: 10px;
  padding: 14px;
}
.mobile-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}
.mobile-check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  min-height: 52px;
  background: #f9fafb;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.mobile-check-item:active {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.mci-text {
  flex: 1;
  padding-right: 12px;
  line-height: 1.4;
}
.mci-mark {
  min-width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 600;
  font-size: 18px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
}
.mci-mark.mark-pass { color: #10b981; border-color: #10b981; background: #ecfdf5; }
.mci-mark.mark-fail { color: #ef4444; border-color: #ef4444; background: #fef2f2; }
.mci-mark.mark-repair { color: #f59e0b; border-color: #f59e0b; background: #fffbeb; }
.mci-mark.mark-empty { color: #9ca3af; }
/* 调试信息面板 */
.mobile-debug-panel {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #991b1b;
  word-break: break-all;
  font-family: monospace;
}
.mobile-debug-panel .md-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  color: #7f1d1d;
}

/* 桌面端：双签字 / 三签字并排 */
.sig-dual-row,
.sig-triple-row {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}
.sig-block {
  flex: 1;
  text-align: center;
}
.sig-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-align: center;
}
.sig-section {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.sig-mini img {
  max-height: 60px;
  margin-bottom: 4px;
}

/* 移动端：签字上下堆叠 */
.mobile-sig-stack {
  margin-top: 12px;
}
.mobile-sig-stack:first-child {
  margin-top: 10px;
}
.msig-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-align: center;
}

.mobile-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}

/* 移动端顶部Tab切换 */
.mobile-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 20;
}
.mobile-tab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.mobile-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* 检查项卡片：标题行 */
.mci-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}
.mci-idx {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  margin-top: 1px;
}
.mci-name {
  flex: 1;
  line-height: 1.4;
  font-size: 14px;
  padding-right: 8px;
  word-break: break-all;
}

/* 检查项：子行（适用类型标签） */
.mci-sub-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 检查项：详情（不合格时显示） */
.mci-detail {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.mci-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  box-sizing: border-box;
}
.mci-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* 适用类型标签 */
.mw-type-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  color: #6b7280;
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mw-type-tag.active {
  color: var(--primary);
  border-color: var(--primary);
  background: #eff6ff;
  font-weight: 500;
}

/* 检查项状态色（复用 mci-mark） */
.mark-na { color: #6b7280; }

/* 周排查 mobile-check-item 纵向布局 */
.mobile-check-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.mobile-check-item .mci-mark {
  margin-left: auto;
  margin-top: -28px;
}
.mobile-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  color: #111827;
  line-height: 1.6;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
  -webkit-tap-highlight-color: transparent;
}
.mobile-textarea:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.mobile-date-input {
}
.mobile-sig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mobile-sig-slot {
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 10px;
  background: #fff;
  text-align: center;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s;
}
.mobile-sig-slot:active {
  border-color: var(--primary, #2563eb);
  background: #f0f7ff;
}
.ms-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}
.ms-placeholder {
  font-size: 13px;
  color: #9ca3af;
  padding: 12px 8px;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  width: 100%;
  background: #f9fafb;
}
.mobile-sig-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  background: #fff;
}
.mobile-sig-empty {
  cursor: pointer;
  background: #f9fafb;
  border-style: dashed;
}
.mobile-sig-empty:hover {
  border-color: var(--primary);
  background: #eff6ff;
}
.msig-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #374151;
}
.msig-img {
  height: 60px;
  max-width: 100%;
}
.msig-time {
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
}
.msig-placeholder {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 13px;
}
.mobile-fault-list {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-fault-item {
  padding: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 13px;
}
.mfi-title {
  font-weight: 600;
  color: #92400e;
  margin-bottom: 4px;
}
.mfi-desc {
  color: #78350f;
  margin-bottom: 4px;
  line-height: 1.4;
}
.mfi-meta {
  font-size: 12px;
  color: #92400e;
}
.mobile-empty {
  padding: 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}
.mobile-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e5e7eb;
  max-width: 480px;
  margin: 0 auto;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
.btn-lg {
  padding: 12px 20px;
  font-size: 15px;
}

/* ========== 全屏签字面板（移动端优先，微信兼容） ========== */
.sig-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
}
.sig-mask.show {
  display: flex;
}
.sig-mask-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.sig-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}
.sig-signer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.sig-btn {
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  color: #2563eb;
  cursor: pointer;
  border-radius: 6px;
}
.sig-btn:active {
  background: #eff6ff;
}
.sig-btn-cancel {
  color: #6b7280;
}
.sig-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  background: #f9fafb;
  min-height: 260px;
}
.sig-canvas-wrap canvas {
  background: #fff;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.sig-tip {
  margin-top: 12px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}
.sig-mask-footer {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.sig-btn-confirm {
  width: 100%;
  height: 48px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.sig-btn-confirm:active {
  background: #1d4ed8;
}

/* ========== 筛选工具栏 ========== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-light);
}
.filter-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.filter-label {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1;
}
.filter-bar .input-sm {
  height: 28px;
  font-size: 12px;
  padding: 4px 8px;
  min-width: 120px;
}
.filter-bar select.input-sm {
  min-width: 110px;
}
.filter-result {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-tertiary);
  justify-content: center;
  align-self: flex-end;
  padding-bottom: 4px;
}

/* 可排序表头 */
.sortable-th {
  cursor: pointer;
  user-select: none;
}
.sortable-th:hover {
  color: var(--primary);
}
.sortable-th.sorted {
  color: var(--primary);
}
.sort-arrow {
  font-size: 10px;
  opacity: 0.5;
  margin-left: 2px;
}
.sortable-th.sorted .sort-arrow {
  opacity: 1;
  color: var(--primary);
}

/* ========== 检查项选择面板 ========== */
.mark-picker {
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.mark-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  user-select: none;
}
.mark-picker-option:hover {
  background: var(--bg-page);
}
.mark-picker-option .mp-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  border: 1.5px solid transparent;
}
.mp-pass .mp-icon { color: #10b981; border-color: #10b981; background: #ecfdf5; }
.mp-fail .mp-icon { color: #ef4444; border-color: #ef4444; background: #fef2f2; }
.mp-repair .mp-icon { color: #f59e0b; border-color: #f59e0b; background: #fffbeb; }
.mp-na .mp-icon { color: #6b7280; border-color: #d1d5db; background: #f3f4f6; }
.mp-clear .mp-icon { color: #9ca3af; border-color: #d1d5db; background: #f9fafb; }

/* 移动端：选择面板底部弹出（action sheet风格） */
.mobile-mode .mark-picker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  z-index: 1000;
  border-radius: 16px 16px 0 0;
  padding: 8px 16px 24px;
  box-shadow: 0 -6px 20px rgba(0,0,0,0.15);
  min-width: auto;
  -webkit-tap-highlight-color: transparent;
}
.mobile-mode .mark-picker-option {
  padding: 16px 12px;
  font-size: 16px;
  border-bottom: 1px solid #f3f4f6;
  min-height: 52px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.mobile-mode .mark-picker-option:active {
  background: #f3f4f6;
}
.mobile-mode .mark-picker-mask {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  -webkit-tap-highlight-color: transparent;
}
.mobile-mode .mark-picker-mask.show {
  display: block;
}

/* ===== 移动端：select 元素样式 ===== */
body.mobile-mode .mobile-page select.mobile-date-input,
body.mobile-mode .mobile-page select.mobile-textarea {
  height: 44px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 16px;
  color: #111827;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath fill='%239ca3af' d='M6 7L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* 移动端签字区域（垂直列表，日管控） */
.mobile-sig-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mobile-sig-item {
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mobile-sig-role {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}
.mobile-sig-display {
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  background: #f9fafb;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.mobile-sig-display .msig-img {
  max-height: 60px;
  max-width: 100%;
}
.mobile-sig-display .msig-time {
  font-size: 11px;
  color: #9ca3af;
}
.mobile-sig-item .btn.btn-sm {
  height: 44px;
  font-size: 14px;
  border-radius: 8px;
}

/* 移动端签字卡片（周排查/月调度） */
.mobile-sig-card {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  text-align: center;
}
.msig-img {
  max-width: 100%;
  max-height: 120px;
  display: block;
  margin: 0 auto;
}
.msig-time {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
}

/* 移动端调试信息面板 */
.mobile-debug-panel {
  margin: 10px 16px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: #92400e;
}
.md-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #b45309;
}

/* 移动端：检查项详情（不合格时展开） */
.mci-detail {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 10px 12px;
  margin-top: -8px;
  margin-bottom: 8px;
}
.mci-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.mci-detail-row:last-child { margin-bottom: 0; }
.mci-detail-row label {
  font-size: 12px;
  color: #991b1b;
  flex-shrink: 0;
  width: 70px;
}
.mci-input {
  flex: 1;
  height: 36px !important;
  font-size: 14px !important;
  padding: 0 10px !important;
  border-radius: 6px !important;
}

/* ===== 周排查表格样式 ===== */
.wk-check-table td {
  font-size: 13px;
  vertical-align: middle;
}
.wk-type-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.wk-type-tag {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  color: #6b7280;
  background: #fff;
  user-select: none;
  transition: all 0.15s;
}
.wk-type-tag:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}
.wk-type-tag.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1e40af;
  font-weight: 500;
  color: #2563eb;
  font-weight: 500;
}

/* ===== 历史记录列表 ===== */
.hist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  transition: background 0.15s;
}
.hist-item:hover {
  background: #f9fafb;
}
.hist-item:last-child {
  border-bottom: none;
}
.hist-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}
.hist-tag.done {
  background: #d1fae5;
  color: #065f46;
}
.hist-tag.pending {
  background: #fef3c7;
  color: #92400e;
}

/* ========== 表单注释提示 ========== */
.form-note {
  padding: 8px 12px;
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
  font-size: 12px;
  color: #475569;
  line-height: 1.7;
  margin-top: 8px;
}
.form-note p {
  margin: 2px 0;
  padding: 0;
}

/* ========== 日管控月度台账 ========== */
.ledger-table {
  width: 100%;
  font-size: 13px;
}
.ledger-table th {
  background: #f1f5f9;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.ledger-table td {
  padding: 6px 8px;
}
.ledger-row {
  cursor: pointer;
  transition: background 0.15s;
}
.ledger-row:hover {
  background: #eff6ff;
}

/* ========== 日管控签字槽样式 ========== */
.signature-grid {
  display: flex;
  gap: 16px;
}
.sig-clear-btn {
  margin-top: 6px;
}

/* 签字已填样式 */
.sig-filled img {
  height: 0.93cm;
  width: 2.8cm;
  object-fit: contain;
  display: block;
  margin: 0 auto 4px;
}
.sig-time {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}
.sig-signer {
  font-weight: 500;
  color: var(--text-secondary);
}
.sig-mini .sig-signer {
  font-size: 12px;
}
.sig-status {
  margin-top: 6px;
  font-size: 12px;
  text-align: center;
  color: var(--text-tertiary);
}
.sig-status.confirmed {
  color: #16a34a;
  font-weight: 600;
}

/* ===== 日管控汇总表样式 ===== */
#summary-modal .modal {
  max-width: 95vw;
  width: 1200px;
}
#summary-modal table.compact-table th {
  background: #f1f5f9;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
#summary-modal .mark-pass { color: #16a34a; font-weight: 600; }
#summary-modal .mark-fail { color: #dc2626; font-weight: 600; }
#summary-modal .mark-repair { color: #f59e0b; font-weight: 600; }
#summary-modal [data-summary-date]:hover {
  background: #eff6ff;
}
#summary-modal table td:first-child,
#summary-modal table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f8fafc;
}
#summary-modal table thead th:first-child {
  z-index: 3;
  background: #f1f5f9;
}

/* ===== 日管控汇总表 Tab 页面 ===== */
.summary-page {
  padding: 16px 20px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 16px;
}
.summary-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #1e40af;
}
.summary-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #334155;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.summary-stats {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: 6px;
}
.summary-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 55vh;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  position: relative;
}
.summary-table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
}
.summary-table th {
  background: #f1f5f9;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  text-align: center;
  padding: 6px 4px;
}
.summary-table td {
  text-align: center;
  font-size: 13px;
  padding: 4px 2px;
  min-width: 28px;
}
.summary-table .mark-pass { color: #16a34a; font-weight: 600; }
.summary-table .mark-fail { color: #dc2626; font-weight: 600; }
.summary-table .mark-repair { color: #f59e0b; font-weight: 600; }
.summary-table [data-summary-date]:hover {
  background: #eff6ff;
  cursor: pointer;
}
.summary-sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f8fafc;
  text-align: left !important;
  white-space: nowrap;
}
.summary-thead-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
}
.summary-thead-sticky .summary-sticky-col {
  z-index: 3;
  background: #f1f5f9;
}
.summary-block {
  margin-top: 12px;
}
.summary-block-title {
  font-weight: 600;
  font-size: 13px;
  color: #1e293b;
  margin-bottom: 4px;
}
.summary-block-body {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  min-height: 50px;
  white-space: pre-wrap;
  font-size: 12px;
  background: #fff;
  border-radius: 4px;
  color: #334155;
  line-height: 1.6;
}
.summary-footer-note {
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.7;
  background: #f8fafc;
  border-radius: 4px;
}

/* ===== 移动端统一入口页面 ===== */
.mobile-home {
  min-height: 100vh;
  background: linear-gradient(180deg, #1e40af 0%, #2563eb 35%, #f0f4ff 35%, #f0f4ff 100%);
  padding: 48px 20px 24px;
  box-sizing: border-box;
}
.mobile-home-hero {
  text-align: center;
  color: #fff;
  margin-bottom: 32px;
}
.mobile-home-icon {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}
.mobile-home-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.mobile-home-subtitle {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}
.mobile-home-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}
.mobile-home-btn {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 20px;
  background: #2563eb;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mobile-home-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.mhb-icon {
  font-size: 26px;
  margin-right: 14px;
  width: 36px;
  text-align: center;
}
.mhb-text {
  flex: 1;
}
.mhb-arrow {
  font-size: 28px;
  font-weight: 300;
  opacity: 0.8;
}
.mobile-home-footer {
  margin-top: 32px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
}

/* ===== 移动端顶部返回栏 ===== */
.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}
.mobile-back-btn {
  width: 50px;
  font-size: 15px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
}
.mobile-back-btn:active {
  opacity: 0.6;
}
.mobile-topbar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}


/* 历史记录弹窗 */
.history-modal {
  width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  overflow: hidden;
}
.history-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.history-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}
.history-item:hover {
  background: var(--bg-hover);
}
.history-item:last-child { border-bottom: none; }
.hist-main { flex: 1; min-width: 0; }
.hist-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.hist-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}
.hist-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.hist-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 4px;
}
.hist-done { background: #dcfce7; color: #166534; }
.hist-half { background: #fef3c7; color: #92400e; }
.hist-draft { background: #f1f5f9; color: #64748b; }
.history-empty {
  padding: 40px 0;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* 签字栏单列 */
.sig-single-row .sig-block { max-width: 280px; }
.mobile-sig-single .mobile-sig-item { max-width: 100%; }

/* 移动端调试栏（可折叠） */
.mobile-debug-bar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9999;
  font-size: 11px;
}
.md-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(15,23,42,0.6);
  color: #fff;
  border: none;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  cursor: pointer;
  opacity: 0.7;
}
.md-toggle:hover { opacity: 1; }
.md-panel {
  background: #fffef0;
  border: 1px solid #fde68a;
  border-radius: 0 0 0 8px;
  padding: 28px 10px 8px 10px;
  min-width: 180px;
  box-shadow: -2px 2px 8px rgba(0,0,0,0.1);
}
.md-line {
  line-height: 1.6;
  color: #78350f;
  word-break: break-all;
}
.md-err { color: #dc2626; font-weight: 500; }
.md-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #fde68a;
}

/* 日期排序按钮 */
.date-sort-btn {
  height: 32px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-color, #d0d7de);
  background: var(--bg-card, #fff);
  color: var(--text-secondary, #57606a);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.date-sort-btn:hover {
  border-color: var(--primary-color, #0969da);
  color: var(--primary-color, #0969da);
}
.date-sort-btn.active {
  border-color: var(--primary-color, #0969da);
  color: var(--primary-color, #0969da);
  background: rgba(9, 105, 218, 0.06);
}
.date-sort-btn:active {
  transform: translateY(1px);
}

/* ===== 移动端：记录查看页 ===== */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}
.mobile-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  border-radius: 6px;
}
.mobile-back:active {
  background: #f1f5f9;
}
.mobile-header-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}
.mobile-body {
  padding: 12px;
  padding-bottom: 100px;
}
.mrec-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.mrec-banner-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 4px;
}
.mrec-banner-desc {
  font-size: 12px;
  color: #3b82f6;
  line-height: 1.5;
}
.mrec-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 16px 0 8px 2px;
}
.mrec-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mrec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
}
.mrec-main {
  flex: 1;
  min-width: 0;
}
.mrec-title {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 4px;
}
.mrec-meta {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mrec-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}
.mrec-empty {
  text-align: center;
  padding: 24px 0;
  color: #9ca3af;
  font-size: 13px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px dashed #e5e7eb;
}

/* ===== 移动端首页：查看记录按钮（次级样式） ===== */
.mobile-home-btn-secondary {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
}
.mobile-home-btn-secondary:active {
  background: #f1f5f9;
}
.mobile-home-export-all {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  margin-top: 12px !important;
}

/* ===== 管理端：同步提示横幅 ===== */
.sync-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
}
.sync-banner-icon {
  flex-shrink: 0;
  color: #d97706;
}
.sync-banner-text {
  flex: 1;
}
.sync-banner-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #92400e;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.7;
}
.sync-banner-close:hover {
  opacity: 1;
  background: rgba(217, 119, 6, 0.1);
}

/* ===== 数据管理：导入维保记录 ===== */
.dm-maint-section {
  margin-bottom: 12px;
}
.dm-merge-result {
  margin-top: 10px;
  padding: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
}
.dm-merge-result .dm-merge-title {
  font-weight: 600;
  color: #166534;
  margin-bottom: 6px;
}
.dm-merge-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.dm-merge-add { color: #16a34a; font-weight: 500; }
.dm-merge-overwrite { color: #d97706; font-weight: 500; }
.dm-merge-skip { color: #6b7280; }

/* ===== 移动端：首页导出卡片 ===== */
.mobile-home-export-card {
  margin: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fed7aa;
  border-radius: 12px;
}
.mhec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #c2410c;
  margin-bottom: 12px;
}
.mhec-title svg { color: #f97316; }
.mhec-steps {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 14px;
}
.mhec-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #9a3412;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 6px 8px;
}
.mhec-num {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: #f97316;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 移动端：弹窗 ===== */
.mobile-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.mobile-modal {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  animation: scaleIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.mm-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mm-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}
.mm-desc {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
}
.mm-tip-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  text-align: left;
  margin-bottom: 20px;
}
.mm-tip-card svg {
  flex-shrink: 0;
  color: #f97316;
  margin-top: 1px;
}
.mm-tip-text {
  font-size: 13px;
  color: #9a3412;
  line-height: 1.5;
  flex: 1;
}
.mm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mm-guide-list {
  background: #f9fafb;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 20px;
  text-align: left;
}
.mm-guide-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #374151;
  padding: 4px 0;
}
.mm-guide-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: #1890ff;
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mm-noshare {
  font-size: 12px;
  color: #6b7280;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 8px;
  padding: 10px;
  line-height: 1.5;
  text-align: left;
}

/* ===== 管理端：同步横幅增强 ===== */
.sync-banner-warn {
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fbbf24;
  color: #78350f;
  padding: 12px 16px;
}
.sync-banner-warn .sync-banner-icon {
  color: #d97706;
}
.sync-banner-warn strong {
  color: #92400e;
}
.sync-banner-warn .sync-banner-close {
  color: #78350f;
}
.sync-banner-success {
  background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #34d399;
  color: #065f46;
  padding: 12px 16px;
}
.sync-banner-success .sync-banner-icon {
  color: #059669;
}
.sync-banner-success strong {
  color: #064e3b;
}
.sync-banner-success .sync-banner-close {
  color: #065f46;
}

/* ===== 管理端：快速导入对话框 ===== */
.qi-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: qiFade 0.2s ease;
}
@keyframes qiFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.qi-dialog {
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: qiScale 0.2s ease;
}
@keyframes qiScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.qi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.qi-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}
.qi-title svg { color: #f97316; }
.qi-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.qi-close:hover { background: #f3f4f6; color: #374151; }
.qi-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}
.qi-guide {
  background: #f9fafb;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.qi-guide-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}
.qi-guide-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #4b5563;
  line-height: 1.6;
  padding: 2px 0;
}
.qi-guide-num {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: #f97316;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.qi-drop {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #6b7280;
}
.qi-drop:hover, .qi-drop.drag-over {
  border-color: #f97316;
  background: #fff7ed;
  color: #c2410c;
}
.qi-drop svg {
  margin-bottom: 10px;
  color: #9ca3af;
}
.qi-drop:hover svg, .qi-drop.drag-over svg {
  color: #f97316;
}
.qi-drop-title {
  font-size: 14px;
  font-weight: 500;
  color: inherit;
  margin-bottom: 4px;
}
.qi-drop-desc {
  font-size: 12px;
  color: #9ca3af;
}
.qi-preview {
  margin-top: 4px;
}
.qi-preview-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #166534;
  margin-bottom: 4px;
}
.qi-preview-title::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  background: #dcfce7;
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}
.qi-file-name {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 14px;
  word-break: break-all;
}
.qi-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.qi-stat-card {
  background: #f9fafb;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}
.qi-stat-num {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  margin-bottom: 2px;
}
.qi-stat-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}
.qi-stat-sub {
  font-size: 11px;
  color: #9ca3af;
}
.qi-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 13px;
}
.qi-summary-label {
  font-weight: 600;
  color: #9a3412;
}
.qi-summary-val {
  color: #7c2d12;
  font-weight: 500;
}
.qi-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}

/* ===== 派工单 ===== */
.workorder-wrap {
  padding: 12px 16px;
}
.wo-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.wo-month-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wo-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wo-stat-pill {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--bg-card);
  border-radius: 4px;
  border: 1px solid var(--border-light);
}
.wo-stat-pill strong {
  color: var(--text-primary);
  font-weight: 600;
  margin: 0 2px;
}
.wo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wo-day-block {
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.wo-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-gray);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
}
.wo-day-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.wo-day-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.wo-day-week {
  font-size: 12px;
  color: var(--text-tertiary);
}
.wo-day-right {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}
.wo-day-body {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.wo-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.15s;
}
.wo-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.wo-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.wo-card-loc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.wo-card-mid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-secondary);
}
.wo-card-field {
  display: flex;
  gap: 4px;
}
.wo-field-label {
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.wo-field-value {
  color: var(--text-secondary);
  font-family: Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
}
.wo-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 2px;
}
.wo-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
}
.wo-status-gen {
  background: #eef2ff;
  color: #4f46e5;
}
.wo-status-print {
  background: #fef3c7;
  color: #b45309;
}
.wo-status-done {
  background: #dcfce7;
  color: #15803d;
}
.wo-status-cancel {
  background: #fee2e2;
  color: #b91c1c;
}

/* 打印样式兜底（实际打印在新窗口）*/
@media print {
  .workorder-wrap, .wo-card, .wo-day-block {
    display: none !important;
  }
}

/* ===== 保养计划子Tab ===== */
.plan-sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-light);
  padding: 0 16px;
  background: var(--bg-card);
}
.plan-sub-tab {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  font-weight: 500;
}
.plan-sub-tab:hover {
  color: var(--text-primary);
}
.plan-sub-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* 派工单卡片更小字号文本 */
.wo-smaller-text { font-size: 11px; color: var(--text-secondary); }

/* 派工单列表整体样式 */
.workorder-wrap { padding: 12px 16px; }
.wo-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.wo-stat-pill {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-page);
  padding: 4px 10px;
  border-radius: 12px;
}
.wo-stat-pill strong {
  color: var(--text-primary);
  font-weight: 600;
}
.wo-day-block {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.wo-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
}
.wo-day-left { display: flex; align-items: baseline; gap: 8px; }
.wo-day-date { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.wo-day-week { font-size: 11px; color: var(--text-tertiary); }
.wo-day-right { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; }

.wo-day-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  padding: 10px;
}
.wo-card {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  transition: box-shadow 0.15s;
}
.wo-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.wo-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.wo-card-loc {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.wo-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.wo-status-gen { background: #eff6ff; color: #2563eb; }
.wo-status-print { background: #fef3c7; color: #d97706; }
.wo-status-done { background: #dcfce7; color: #16a34a; }
.wo-status-cancel { background: #fee2e2; color: #dc2626; }

.wo-card-mid { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.wo-card-field { font-size: 12px; display: flex; line-height: 1.4; }
.wo-field-label { color: var(--text-tertiary); flex-shrink: 0; }
.wo-field-value { color: var(--text-secondary); word-break: break-all; }
.wo-card-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ===== 隐藏平台注入的悬浮工具栏 ===== */
/* 尝试匹配常见的浮窗类名 */
[class*="float-toolbar"],
[class*="float-menu"],
[class*="miaoda-float"],
[class*="app-float"],
[class*="platform-widget"],
[class*="download-widget"],
[class*="doubao-float"],
[class*="doubao-widget"],
[id*="float-toolbar"],
[id*="float-menu"],
[id*="platform-widget"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* 针对右下角固定定位浮窗的兜底（body直接子元素，fixed定位，靠右下角） */
body > div[style*="position: fixed"][style*="bottom:"][style*="right:"],
body > div[style*="position:fixed"][style*="bottom:"][style*="right:"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

/* 针对包含"豆包"文字的fixed浮窗兜底 */
body > div[style*="fixed"]:has(> *:is(button, div, span)) {
  /* 仅作为兜底，不默认启用 */
}

/* ===== 云同步 ===== */
.cloud-sync-indicator {
  position: relative;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all .15s;
}
.cloud-sync-indicator .cs-text {
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  color: inherit;
}
@media (max-width: 900px) {
  .cloud-sync-indicator .cs-text { display: none; }
  .cloud-sync-indicator { min-width: 36px; padding: 0; }
}
.cloud-sync-indicator:hover {
  background: rgba(0,0,0,.05);
  color: var(--text-primary);
}
.cloud-sync-indicator .cs-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  border: 2px solid var(--bg-page, #f8fafc);
  transition: background .2s;
}
.cloud-sync-indicator.cs-synced { color: #10b981; }
.cloud-sync-indicator.cs-synced .cs-dot { background: #10b981; }
.cloud-sync-indicator.cs-syncing { color: #3b82f6; }
.cloud-sync-indicator.cs-syncing .cs-dot { background: #3b82f6; animation: cs-pulse 1.2s infinite; }
.cloud-sync-indicator.cs-pending { color: #f59e0b; }
.cloud-sync-indicator.cs-pending .cs-dot { background: #f59e0b; }
.cloud-sync-indicator.cs-error { color: #ef4444; }
.cloud-sync-indicator.cs-error .cs-dot { background: #ef4444; }

@keyframes cs-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(1.3); }
}

/* 云同步设置面板 */
.cloud-sync-settings {
  font-size: 13px;
}
.cs-section {
  padding: 4px 0;
}
.cs-section-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cs-divider {
  height: 1px;
  background: var(--border-color);
  margin: 14px 0;
}
.cs-status-grid {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 0;
}
.cs-status-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 12px;
}
.cs-status-label {
  color: var(--text-secondary);
}
.cs-status-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* 云同步 tooltip 内容 */
.cloud-sync-tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 12px 14px;
  font-size: 12px;
  min-width: 200px;
  z-index: 200;
  display: none;
}
.cloud-sync-tooltip.show {
  display: block;
}
.cs-tt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 12px;
}
.cs-tt-label {
  color: var(--text-secondary);
}
.cs-tt-value {
  color: var(--text-primary);
  font-weight: 500;
}
.cs-tt-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}
.cs-tt-actions button {
  flex: 1;
  font-size: 11px;
  padding: 4px 8px;
}

/* =====================================================
   移动端响应式样式（手机端全面适配）
   ===================================================== */

/* ---------- 通用：移动端触屏优化 ---------- */
@media (max-width: 768px) {
  /* 增大点击区域 */
  .btn {
    min-height: 44px;
    padding: 0 16px;
    font-size: 15px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
  .btn-xs {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12px;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  input[type="search"],
  select,
  textarea {
    min-height: 44px;
    font-size: 16px; /* 防止 iOS 自动缩放 */
    padding: 8px 12px;
  }

  textarea {
    min-height: 88px;
  }

  /* 顶部栏高度增加，方便触屏 */
  :root {
    --topbar-height: 56px;
  }

  /* 顶部栏布局紧凑化 */
  .topbar-left .logo .logo-text {
    display: none;
  }

  .datetime {
    display: none;
  }

  .user-detail {
    display: none;
  }

  .project-switcher {
    max-width: 120px;
  }
  .project-switcher .project-name {
    font-size: 13px;
  }

  /* 汉堡按钮 */
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: var(--topbar-text);
    cursor: pointer;
    border-radius: 8px;
    margin-right: 4px;
  }
  .menu-toggle:hover {
    background: rgba(255,255,255,0.1);
  }
  .menu-toggle:active {
    background: rgba(255,255,255,0.2);
  }
}

@media (min-width: 769px) {
  .menu-toggle {
    display: none;
  }
  .sidebar-mask {
    display: none !important;
  }
}

/* ---------- 侧边栏抽屉模式（移动端） ---------- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar .nav-item span {
    display: inline;
  }

  /* 移动端侧栏导航：增大点击区域，确保 ≥44px 高度 */
  .sidebar .nav-item {
    padding: 14px 20px;
    font-size: 16px;
    min-height: 52px;
    gap: 14px;
    border-left-width: 4px;
  }

  .sidebar .nav-item svg,
  .sidebar .nav-item .nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .sidebar .logo-text {
    display: none; /* 侧边栏内无 logo 文字 */
  }

  /* 内容区占满宽度 */
  .main {
    padding-left: 0;
  }

  .content {
    padding: 12px;
  }

  /* 遮罩层 */
  .sidebar-mask {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-mask.show {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ---------- 表格移动端适配：横滚 + 优化 ---------- */
@media (max-width: 768px) {
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
    border-radius: 0;
  }

  .table-wrapper table {
    min-width: 640px;
    font-size: 13px;
  }

  table th,
  table td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  /* 表格操作列按钮更小更紧凑 */
  table .btn {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }

  table td .btn + .btn {
    margin-left: 4px;
  }
}

/* ---------- KPI 卡片移动端 ---------- */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card {
    padding: 14px 12px;
  }
  .kpi-card .kpi-value {
    font-size: 24px;
  }
  .kpi-card .kpi-label {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- 筛选栏/搜索栏移动端 ---------- */
@media (max-width: 768px) {
  .filter-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  .filter-bar .search-input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .filter-bar select,
  .filter-bar input[type="date"],
  .filter-bar input[type="text"] {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .filter-bar .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }

  .page-header .page-title {
    font-size: 18px;
  }

  .page-header .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-header .page-actions .btn {
    flex: 1;
  }
}

/* ---------- 表单移动端 ---------- */
@media (max-width: 768px) {
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .form-item label {
    font-size: 13px;
    margin-bottom: 4px;
  }

  .modal {
    width: calc(100% - 24px);
    max-width: none;
    max-height: calc(100vh - 40px);
    margin: 20px auto;
    border-radius: 12px;
  }

  .modal-body {
    padding: 16px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-header {
    padding: 14px 16px;
    font-size: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
    gap: 8px;
  }
  .modal-footer .btn {
    flex: 1;
  }
}

/* ---------- 卡片/面板移动端 ---------- */
@media (max-width: 768px) {
  .card {
    border-radius: 10px;
    margin-bottom: 10px;
  }

  .card-header {
    padding: 12px 14px;
    font-size: 15px;
  }

  .card-body {
    padding: 12px 14px;
  }

  .stats-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stat-item {
    flex: 1 1 calc(50% - 4px);
    padding: 10px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 12px;
  }
}

/* ---------- 底部操作栏（移动端特有） ---------- */
@media (max-width: 768px) {
  .bottom-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 8px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  .bottom-action-bar .btn {
    flex: 1;
  }

  /* 有底部操作栏时，内容区底部留空 */
  body.has-bottom-bar .content {
    padding-bottom: 80px;
  }
}

/* ---------- 通知中心/弹窗移动端 ---------- */
@media (max-width: 768px) {
  .notif-panel {
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    top: calc(var(--topbar-height) + 8px);
  }

  .user-dropdown {
    right: 8px;
  }

  .toast {
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    font-size: 14px;
    padding: 10px 16px;
  }
}

/* ---------- 分页移动端 ---------- */
@media (max-width: 768px) {
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 10px 0;
  }
  .pagination .page-btn {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }
  .pagination .page-info {
    width: 100%;
    text-align: center;
    margin-bottom: 4px;
  }
}

/* ---------- 登录页移动端 ---------- */
@media (max-width: 768px) {
  .login-card {
    width: calc(100% - 32px);
    max-width: 360px;
    padding: 28px 24px;
  }
  .login-card .login-title {
    font-size: 20px;
  }
  .login-card .login-subtitle {
    font-size: 13px;
  }
}

/* ---------- 安全区域适配（iOS 刘海屏） ---------- */
@supports (padding: max(0px)) {
  .topbar {
    padding-top: max(0px, env(safe-area-inset-top, 0px));
  }

  .sidebar {
    padding-top: max(0px, env(safe-area-inset-top, 0px));
  }

  .content {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
}

/* ---------- 平板端中间尺寸 ---------- */
@media (min-width: 769px) and (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .content {
    padding: 16px;
  }

  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }
}

/* ---------- PWA 独立模式下的微调 ---------- */
@media all and (display-mode: standalone) {
  body {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
  }

  /* 可交互元素保留选择能力 */
  input, textarea, select, button {
    user-select: text;
    -webkit-touch-callout: default;
  }

  .topbar {
    cursor: default;
  }
}

/* ---------- 减少动画（尊重用户偏好） ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
