/* ===== 全局变量与重置 ===== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff6ff;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0891b2;
  --info-bg: #ecfeff;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --bg-page: #f0f4ff;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(180deg, #1e3a5f 0%, #1e293b 40%);
  --bg-sidebar-hover: rgba(255,255,255,0.1);
  --bg-sidebar-active: #2563eb;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;

  --border: #e5e7eb;
  --border-light: #f3f4f6;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --radius-sm: 4px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --sidebar-width: 240px;
  --header-height: 60px;
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a56db 0%, #0f766e 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(255,255,255,0.08) 0%, transparent 50%);
}

.login-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 420px;
  max-width: 90vw;
  padding: 48px 40px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  margin-bottom: 16px;
}

.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.login-logo p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.login-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1); }

.login-hint {
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.login-hint strong { color: var(--gray-700); }

/* ===== 布局 ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.sidebar-header .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  margin-right: 12px;
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 15px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.nav-group-title {
  padding: 8px 24px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  color: var(--text-sidebar);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  border-left: 3px solid transparent;
  gap: 10px;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: white;
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  border-left-color: var(--primary-light);
}

.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background: rgba(255,255,255,0.25);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.sidebar-user:hover { background: var(--bg-sidebar-hover); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info .name { font-size: 13px; font-weight: 600; color: white; }
.user-info .role { font-size: 11px; color: var(--gray-400); }

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== 顶部导航 ===== */
.topbar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.topbar-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.topbar-spacer { flex: 1; }

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

.topbar-date {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  font-size: 18px;
  color: var(--gray-700);
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: inline-flex; }
}

/* 侧边栏遮罩 */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== 内容区域 ===== */
.content-area {
  flex: 1;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.page-header .actions {
  display: flex;
  gap: 10px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  border-color: var(--gray-200);
  transform: translateY(-1px);
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
}

.card-body { padding: 20px; }
.card-body.no-padding { padding: 0; }

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

.stat-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  cursor: pointer;
}

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

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

.stat-icon.blue { background: var(--primary-bg); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.cyan { background: var(--info-bg); color: var(--info); }
.stat-icon.gray { background: var(--gray-100); color: var(--gray-600); }

.stat-info { flex: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-trend { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  color: var(--gray-700);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,0.35); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97) translateY(0); }

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #15803d; }

/* 逾期任务行高亮 */
.task-overdue {
  background: #fff5f5 !important;
}
.task-overdue:hover {
  background: #fee2e2 !important;
}

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px 10px; }

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

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

.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-full { grid-column: 1 / -1; }

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background: white;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ===== 表格 ===== */
.table-wrapper {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 13px;
}

table.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--gray-700);
  vertical-align: middle;
  word-break: break-word;
}

table.data-table thead th { min-width: 80px; }
table.data-table tbody td:first-child { min-width: 140px; }
table.data-table tbody td:nth-child(2) { min-width: 160px; }
table.data-table tbody td:nth-child(3) { min-width: 110px; }
table.data-table tbody td:nth-child(4) { min-width: 110px; }
table.data-table tbody td:nth-child(5) { min-width: 100px; }
table.data-table tbody td:nth-child(6) { min-width: 60px; text-align: center; }
table.data-table tbody td:nth-child(7) { min-width: 100px; }
table.data-table tbody td:nth-child(8) { min-width: 90px; }

table.data-table tbody tr { transition: var(--transition); }
table.data-table tbody tr:hover { background: var(--gray-50); }

table.data-table .actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ===== 徽章/标签 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-cyan { background: #cffafe; color: #155e75; }

.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  margin: auto;
}

.modal.modal-lg { max-width: 900px; }
.modal.modal-xl { max-width: 1200px; }

/* 手写弹窗容器（部分业务弹窗直接使用 modal-card，必须有不透明白底，
   否则底层内容透过半透明遮罩显示出来，视觉杂乱） */
.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  margin: auto;
  position: relative;
}

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

.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--gray-900); }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: 6px;
  font-size: 20px;
  transition: var(--transition);
}

.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.modal-body { padding: 24px; max-height: 65vh; overflow-y: auto; }

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

/* ===== 详情页样式 ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}

.detail-label {
  color: var(--text-secondary);
  font-weight: 500;
  text-align: right;
}

.detail-value { color: var(--gray-800); }

.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 时间线 ===== */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--gray-300);
}

.timeline-item.active .timeline-dot { border-color: var(--primary); background: var(--primary); }
.timeline-item.completed .timeline-dot { border-color: var(--success); background: var(--success); }

.timeline-content { }
.timeline-time { font-size: 12px; color: var(--text-tertiary); margin-bottom: 2px; }
.timeline-title { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.timeline-desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== 日历 ===== */
.calendar {
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.calendar-title { font-size: 17px; font-weight: 700; color: var(--gray-900); }

.calendar-nav { display: flex; gap: 8px; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-weekday {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-light);
}

.calendar-day {
  min-height: 100px;
  padding: 6px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}

.calendar-day:hover { background: var(--gray-50); }
.calendar-day.other-month { color: var(--gray-300); background: var(--gray-50); }
.calendar-day.today { background: var(--primary-bg); }
.calendar-day.today .day-number { background: var(--primary); color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }

.day-number { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }

.day-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-event {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.day-event.blue { background: var(--primary-bg); color: var(--primary); }
.day-event.green { background: var(--success-bg); color: var(--success); }
.day-event.orange { background: var(--warning-bg); color: var(--warning); }
.day-event.red { background: var(--danger-bg); color: var(--danger); }

/* ===== 看板 ===== */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  flex: 0 0 300px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

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

.kanban-column-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-column-count {
  background: var(--gray-200);
  color: var(--gray-600);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.kanban-column-body {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}

.kanban-card {
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}

.kanban-card:hover { box-shadow: var(--shadow-md); }

.kanban-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
  line-height: 1.4;
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kanban-card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== 筛选栏 ===== */
.filter-bar {
  background: white;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-item label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

.filter-item .form-control { width: auto; min-width: 140px; padding: 6px 12px; font-size: 13px; }

.filter-spacer { flex: 1; }

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

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p { font-size: 14px; }

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

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

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

.toast .toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast .toast-msg { font-size: 14px; color: var(--gray-700); }

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

/* ===== 部门卡片 ===== */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.dept-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.dept-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dept-card.active { border-color: var(--primary); }

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

.dept-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
}

.dept-card-name { font-size: 15px; font-weight: 700; color: var(--gray-800); margin-bottom: 8px; }

.dept-card-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.dept-card-stat {
  display: flex;
  flex-direction: column;
}

.dept-card-stat .num { font-size: 20px; font-weight: 700; }
.dept-card-stat .label { font-size: 11px; color: var(--text-tertiary); }

/* ===== 任务卡片 ===== */
.task-item {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--gray-300);
  transition: var(--transition);
}

.task-item:hover { box-shadow: var(--shadow); }

.task-item.pending { border-left-color: var(--warning); }
.task-item.accepted { border-left-color: var(--primary); }
.task-item.in_progress { border-left-color: var(--primary-light); }
.task-item.completed { border-left-color: var(--success); }
.task-item.rejected { border-left-color: var(--danger); }
.task-item.cancelled { border-left-color: var(--gray-300); opacity: 0.6; }
.task-item.cancelled .task-item-title { text-decoration: line-through; }

.task-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 10px;
}

.task-item-title { font-size: 14px; font-weight: 600; color: var(--gray-800); flex: 1; }

.task-item-body {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  background: var(--gray-50);
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  line-height: 1.6;
}

.task-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-item-meta { font-size: 12px; color: var(--text-tertiary); display: flex; gap: 12px; }

/* ===== 通知单预览 ===== */
.notification-paper {
  background: white;
  padding: 40px 50px;
  max-width: 800px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.8;
  color: #333;
}

.notification-paper .np-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #333;
}

.notification-paper .np-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 8px;
}

.notification-paper .np-subtitle {
  font-size: 14px;
  color: #666;
}

.notification-paper .np-order-no {
  text-align: right;
  margin-bottom: 16px;
  font-size: 13px;
  color: #666;
}

.notification-paper table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.notification-paper table th,
.notification-paper table td {
  border: 1px solid #ddd;
  padding: 8px 12px;
  font-size: 13px;
  text-align: left;
}

.notification-paper table th {
  background: #f5f5f5;
  font-weight: 600;
  width: 120px;
}

.notification-paper .np-section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 20px 0 10px;
  padding-left: 10px;
  border-left: 4px solid #1a56db;
}

.notification-paper .np-signatures {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 40px;
  padding-top: 20px;
  gap: 30px 0;
}

.notification-paper .np-signature {
  text-align: center;
  width: 33.33%;
  box-sizing: border-box;
  padding: 0 8px;
}

.notification-paper .np-signature .label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 30px;
}

.notification-paper .np-signature .line {
  border-top: 1px solid #333;
  width: 120px;
  margin: 0 auto;
  padding-top: 4px;
  font-size: 12px;
  color: #999;
}

.notification-paper .np-footer {
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid #ddd;
  text-align: center;
  font-size: 12px;
  color: #999;
}

/* ===== 会议室选择器 ===== */
.room-selector {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.room-floor-group {
  border-left: 3px solid var(--primary-light);
  padding-left: 12px;
}

.room-floor-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.room-floor-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.room-option {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  background: white;
}

.room-option:hover { border-color: var(--primary-light); }
.room-option.selected { border-color: var(--primary); background: var(--primary-bg); }

.room-option-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: white;
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.4;
  white-space: nowrap;
}

.room-option-info { font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 2px; }

/* ===== 人员选择器 ===== */
.personnel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.personnel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  background: white;
}

.personnel-item:hover { border-color: var(--primary-light); }
.personnel-item.selected { border-color: var(--primary); background: var(--primary-bg); }
.personnel-item.disabled { opacity: 0.5; cursor: not-allowed; }

.personnel-item .pi-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.personnel-item .pi-info { flex: 1; min-width: 0; }
.personnel-item .pi-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.personnel-item .pi-pos { font-size: 11px; color: var(--text-secondary); }

/* ===== 分割线 ===== */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: 700; }
.text-sm { font-size: 12px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-muted { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }

  /* 移动端顶部栏 */
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }
  .topbar-subtitle { display: none; }
  .topbar-date { font-size: 12px; }

  /* 内容区域内边距缩小 */
  .content-area { padding: 12px; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }

  /* 看板双列布局改为单列 */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  /* 部门任务概况移动端优化 */
  .dept-overview-item {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 12px 0 !important;
  }
  .dept-overview-stats {
    width: 100%;
    justify-content: flex-start;
  }
  .dept-overview-stats .badge {
    flex: 1;
    justify-content: center;
  }

  /* 表格横向滚动 */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }
  .table-responsive table.data-table {
    min-width: 600px;
  }
  /* 未手动包裹的表格，自动在移动端可横向滚动 */
  .card-body.no-padding:has(> table.data-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card-body.no-padding:has(> table.data-table) > table.data-table {
    min-width: 600px;
  }
  /* 兜底：任何表格不撑破容器（非卡片化表格自动收缩换行） */
  .content-area table {
    max-width: 100% !important;
    white-space: normal !important;
  }

  /* 统计卡片在手机上横向双列 */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px;
    gap: 10px;
  }
  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
  .stat-value { font-size: 22px; }
  .stat-trend { font-size: 11px; }

  /* 今日会议卡片 */
  .today-event-item {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .today-event-item .event-divider { display: none; }
  .today-event-item .event-time {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: auto !important;
  }
}

/* ===== 布置形式图选 ===== */
.layout-selector {
  flex-wrap: wrap;
}
.layout-option {
  cursor: pointer;
  transition: all 0.2s ease;
}
.layout-option:hover {
  border-color: var(--primary) !important;
  background: var(--primary-bg, #eff6ff) !important;
}
.layout-option.selected {
  border-color: var(--primary) !important;
  background: var(--primary-bg, #eff6ff) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.layout-option .layout-icon {
  width: 56px;
  height: 42px;
  margin: 0 auto 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.layout-icon-boardroom { background: #fef3c7; }
.layout-icon-u_shape { background: #dbeafe; }
.layout-icon-classroom { background: #d1fae5; }
.layout-icon-theater { background: #ede9fe; }
.layout-icon-discussion { background: #fce7f3; }
.layout-icon-other { background: #f3f4f6; }

/* 更小屏幕单列统计 */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ===== 打印样式 ===== */
@media print {
  .sidebar, .topbar, .page-header, .filter-bar, .actions { display: none !important; }
  .main-content { margin-left: 0; }
  .content-area { padding: 0; }
  .notification-paper { box-shadow: none; padding: 20px; }
  body { background: #fff !important; }
}

/* ===== 会议室幻灯片轮播 ===== */
.room-slideshow {
  background: #1a1a2e;
  position: relative;
}
.room-slides-track {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.room-slides-track::-webkit-scrollbar {
  display: none;
}
.room-slide {
  user-select: none;
  -webkit-user-select: none;
}
.room-slide img {
  transition: opacity 0.3s;
}
.room-slide-dots {
  background: var(--bg-card, #fff);
}
.slide-dot.active {
  background: var(--primary, #3b82f6) !important;
  transform: scale(1.3);
}
.room-slide-arrow {
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
}
.room-slide-arrow:hover {
  opacity: 1;
  background: rgba(0,0,0,0.75) !important;
}

/* 移动端幻灯片适配 */
@media (max-width: 768px) {
  .room-slide img {
    height: 240px !important;
  }
  .room-slide-arrow {
    width: 30px !important;
    height: 30px !important;
    font-size: 14px !important;
  }
}

/* ===== 移动端全面优化 ===== */
@media (max-width: 768px) {
  /* 登录页 */
  .login-container {
    padding: 20px 16px !important;
    min-height: 100vh;
  }
  .login-card {
    padding: 24px 16px !important;
    border-radius: 12px !important;
  }
  .login-card h1 { font-size: 20px; }
  .login-card .demo-accounts { font-size: 12px; }

  /* 弹窗全屏化 */
  .modal-card {
    max-width: 100vw !important;
    width: 100vw !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    position: fixed !important;
    bottom: 0;
    left: 0;
    max-height: 85vh;
    overflow-y: auto;
  }
  .modal-body { padding: 16px; }

  /* 页面标题 */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
  }
  .page-header h2 { font-size: 18px; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { width: 100%; }

  /* 筛选栏纵向排列 */
  .filter-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }
  .filter-item {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .filter-item label { font-size: 12px; }
  .filter-item .form-control,
  .filter-item select { width: 100% !important; min-width: auto !important; }
  .filter-spacer { display: none; }
  .filter-bar .btn { width: 100%; }

  /* 按钮全宽+更大触控区 */
  .btn {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 40px;
  }
  .btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 32px;
  }
  .actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  /* 表单输入全宽 */
  .form-control {
    font-size: 16px !important;
    padding: 10px 12px;
  }
  .form-group label { font-size: 13px; }

  /* 表单区块 */
  .form-section { padding: 12px; }
  .form-section-title { font-size: 14px; }

  /* 签批区域 */
  .approval-section {
    flex-direction: column;
  }
  .approval-section > div { width: 100%; }

  /* 任务卡片 */
  .task-item {
    padding: 12px;
    gap: 8px;
  }
  .task-item-header {
    flex-direction: column;
    gap: 4px;
  }
  .task-item-title { font-size: 14px; }
  .task-item-footer {
    flex-direction: column;
    gap: 8px;
  }
  .task-item-meta {
    flex-wrap: wrap;
    gap: 4px;
  }
  .task-item-meta span { font-size: 12px; }

  /* 部门概况 */
  .dept-overview { gap: 6px; }
  .dept-overview-item { padding: 8px 0 !important; }

  /* 指派人员弹窗 */
  .assign-personnel-grid {
    grid-template-columns: 1fr !important;
  }

  /* 布置形式选择器 */
  .layout-selector {
    gap: 6px;
  }
  .layout-option {
    padding: 8px 10px;
    font-size: 12px;
    flex: 1 1 calc(33% - 6px);
    min-width: 80px;
  }

  /* 收费项目行 */
  .charge-item-row {
    padding: 8px 10px;
  }
  .charge-item-row > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .charge-item-details {
    width: 100%;
    flex-wrap: wrap;
  }

  /* 消费单/结账单预览 */
  .notification-paper {
    padding: 12px;
    font-size: 12px;
  }

  /* 通知单签字区 */
  .np-signature { width: 100% !important; }

  /* 模态弹窗按钮组 */
  .modal-footer {
    flex-direction: column;
    gap: 6px;
  }
  .modal-footer .btn { width: 100%; }
}

/* 小屏手机 (iPhone SE 等) */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }

  .login-card { padding: 16px 12px !important; }
  .login-card h1 { font-size: 18px; }

  .content-area { padding: 8px; }
  .card-header { padding: 10px 12px; }
  .card-body { padding: 10px 12px; }

  .topbar { padding: 0 8px; }
  .topbar-title { font-size: 13px; }

  .btn { padding: 8px 12px; font-size: 13px; min-height: 36px; }
  .btn-sm { padding: 5px 8px; font-size: 12px; min-height: 28px; }

  .data-table th,
  .data-table td { padding: 6px 8px; font-size: 12px; }
}

/* ===== UI 视觉增强 ===== */
/* 表单输入聚焦光晕 */
.form-control:focus, select.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

/* 统计卡片呼吸感 */
.stat-card {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
  border: 1px solid transparent;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  border-color: var(--gray-200);
}

/* 页面标题区呼吸间距 */
.page-header {
  margin-bottom: 20px;
}

/* toast 微动效 */
.toast {
  animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 任务卡片 hover */
.task-item {
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.task-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-color: var(--gray-300);
}

/* ===== 移动端全面适配补充 ===== */
@media (max-width: 768px) {
  /* 订单详情页双栏 → 单栏 */
  .card-body > div[style*="grid-template-columns:2fr 1fr"],
  .card-body > div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns:2fr 1fr"]:not(.dashboard-grid) {
    grid-template-columns: 1fr !important;
  }

  /* 详情网格（标签+值）堆叠 */
  .detail-grid {
    grid-template-columns: 1fr !important;
    gap: 2px 0 !important;
  }
  .detail-grid .detail-label {
    text-align: left !important;
    font-size: 12px !important;
    color: var(--text-tertiary) !important;
    margin-top: 8px;
  }
  .detail-grid .detail-value {
    font-size: 14px !important;
  }

  /* 日历适配 */
  .calendar-day {
    min-height: 60px !important;
    padding: 3px !important;
  }
  .calendar-weekday {
    padding: 6px 2px !important;
    font-size: 10px !important;
  }
  .day-number {
    font-size: 12px !important;
  }
  .day-event {
    font-size: 9px !important;
    padding: 1px 3px !important;
  }
  .calendar-header {
    padding: 10px 12px !important;
  }
  .calendar-title {
    font-size: 15px !important;
  }

  /* 看板列在手机上更宽 */
  .kanban-column {
    flex: 0 0 260px !important;
  }

  /* 页面头部操作按钮换行 */
  .page-header .actions,
  .page-header .actions-cell {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
  .page-header .actions .btn {
    flex: 1 !important;
    min-width: auto !important;
  }

  /* 供应商/房间网格单列 */
  div[style*="grid-template-columns:repeat(auto-fill,minmax(350px"],
  div[style*="grid-template-columns:repeat(auto-fill, minmax(350px"],
  div[style*="grid-template-columns:repeat(auto-fill,minmax(300px"],
  div[style*="grid-template-columns:repeat(auto-fill, minmax(300px"] {
    grid-template-columns: 1fr !important;
  }

  /* 人员选择器网格单列 */
  .personnel-list {
    grid-template-columns: 1fr !important;
  }

  /* 房间选择器网格单列 */
  .room-floor-list {
    grid-template-columns: 1fr !important;
  }

  /* 供应商卡片内部布局 */
  .card-body[style*="display:flex"] {
    flex-direction: column !important;
    gap: 12px !important;
  }

  /* 顶部栏标题缩小 */
  .topbar-title {
    font-size: 15px !important;
  }

  /* 模态框头部 */
  .modal-header {
    padding: 14px 16px !important;
  }
  .modal-header h3 {
    font-size: 15px !important;
  }

  /* 卡片头部 */
  .card-header h3 {
    font-size: 14px !important;
  }

  /* 签批区域签名画布 */
  #approvalSignature {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 统计卡片数值缩小 */
  .stat-value {
    font-size: 20px !important;
  }

  /* 通知单预览在手机上去掉多余边距 */
  .notification-paper {
    padding: 16px 12px !important;
  }
  .notification-paper .np-title {
    font-size: 20px !important;
    letter-spacing: 2px !important;
  }
  .notification-paper .np-signature {
    width: 50% !important;
  }

  /* 表格最小宽度统一 */
  .table-wrapper table,
  .table-responsive table {
    min-width: 600px !important;
  }

  /* 内联 flex 布局换行 */
  .card-body div[style*="display:flex;gap:24px"],
  .card-body div[style*="display:flex;gap: 24px"] {
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* 消费结账单列表项 */
  .billing-list-item {
    padding: 12px !important;
  }

  /* 按钮组在行内换行 */
  .actions-cell {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .actions-cell .btn {
    flex: 1 !important;
    min-width: 60px !important;
  }

  /* 签批/审批弹窗内容 */
  .modal-body div[style*="display:flex;gap:8px"] {
    flex-wrap: wrap !important;
  }

  /* 服务人员行 */
  .service-staff-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .service-staff-row > div {
    width: 100% !important;
  }

  /* 房型配置行 */
  .room-type-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .room-type-row > div {
    width: 100% !important;
  }

  /* ===== 表格 → 卡片式布局（核心移动优化） ===== */
  table.data-table.responsive-card,
  table.data-table.responsive-card thead,
  table.data-table.responsive-card tbody,
  table.data-table.responsive-card th,
  table.data-table.responsive-card td,
  table.data-table.responsive-card tr {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  /* 覆盖 .table-responsive / .card-body.no-padding 的 min-width:600px，避免卡片化后仍横向撑宽 */
  table.data-table.responsive-card {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* 隐藏表头 */
  table.data-table.responsive-card thead {
    display: none !important;
  }

  /* 每行变卡片 */
  table.data-table.responsive-card tbody tr {
    background: white !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 12px !important;
    padding: 8px 0 !important;
    box-shadow: var(--shadow-sm) !important;
    transition: var(--transition) !important;
  }
  table.data-table.responsive-card tbody tr:hover {
    box-shadow: var(--shadow-md) !important;
    background: white !important;
  }

  /* 每列变行，带标签 */
  table.data-table.responsive-card tbody td {
    display: flex !important;
    align-items: center !important;
    min-height: 36px !important;
    padding: 6px 12px !important;
    border-bottom: 1px solid var(--border-light) !important;
    text-align: left !important;
    font-size: 14px !important;
    gap: 10px !important;
  }
  table.data-table.responsive-card tbody td:last-child {
    border-bottom: none !important;
  }

  /* 列标签（来自 data-label） */
  table.data-table.responsive-card tbody td::before {
    content: attr(data-label) !important;
    display: inline-block !important;
    min-width: 70px !important;
    max-width: 80px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    flex-shrink: 0 !important;
  }

  /* 操作列特殊处理 */
  table.data-table.responsive-card tbody td.actions-cell::before {
    display: none !important;
  }
  table.data-table.responsive-card tbody td.actions-cell {
    justify-content: flex-start !important;
    padding: 8px 12px !important;
    gap: 6px !important;
  }
  table.data-table.responsive-card tbody td.actions-cell .btn {
    flex: none !important;
    min-width: auto !important;
  }

  /* 状态标签列 */
  table.data-table.responsive-card tbody td .badge {
    font-size: 13px !important;
    padding: 4px 12px !important;
  }
}

/* 超小屏幕（≤375px）进一步压缩 */
@media (max-width: 375px) {
  .stat-grid {
    grid-template-columns: 1fr !important;
  }
  .calendar-day {
    min-height: 48px !important;
  }
  .day-event {
    display: none !important;
  }
  .calendar-day.today .day-number {
    width: 20px !important;
    height: 20px !important;
    font-size: 11px !important;
  }
  .topbar-title {
    font-size: 13px !important;
  }
  .login-logo h1 {
    font-size: 18px !important;
  }
  .notification-paper .np-signature {
    width: 100% !important;
  }
}

/* ===== 移动端强制适配（兜底） =====
   当微信内置浏览器忽略 meta viewport 按桌面渲染时，JS 会给 <html> 加 .mobile-device 类
   此处复制关键移动端规则（侧边栏隐藏、表格卡片化、栅格单列、弹窗内边距等），
   不依赖 @media (max-width: 768px) 匹配，确保任意 viewport 宽度下都能生效。 */
.mobile-device .sidebar { transform: translateX(-100%); z-index: 200; }
.mobile-device .sidebar.open { transform: translateX(0); }
.mobile-device .main-content { margin-left: 0; }
.mobile-device .form-grid,
.mobile-device .form-grid-3,
.mobile-device .form-grid-4 { grid-template-columns: 1fr; }
.mobile-device .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.mobile-device .stat-card { padding: 14px; gap: 10px; }
.mobile-device .stat-icon { width: 38px; height: 38px; font-size: 18px; }
.mobile-device .stat-value { font-size: 22px; }
.mobile-device .stat-trend { font-size: 11px; }

.mobile-device .topbar { padding: 0 12px; gap: 10px; }
.mobile-device .topbar-subtitle { display: none; }
.mobile-device .topbar-date { font-size: 12px; }

.mobile-device .content-area { padding: 12px; }
.mobile-device .card-header { padding: 12px 14px; }
.mobile-device .card-body { padding: 14px; }
.mobile-device .dashboard-grid { grid-template-columns: 1fr !important; }

.mobile-device .today-event-item {
  flex-direction: column;
  align-items: flex-start !important;
  gap: 10px !important;
}
.mobile-device .today-event-item .event-divider { display: none; }
.mobile-device .today-event-item .event-time {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: auto !important;
}

.mobile-device .dept-overview-item {
  flex-direction: column;
  align-items: flex-start !important;
  gap: 8px !important;
  padding: 12px 0 !important;
}
.mobile-device .dept-overview-stats {
  width: 100%;
  justify-content: flex-start;
}
.mobile-device .dept-overview-stats .badge { flex: 1; justify-content: center; }

/* 横向滚动兜底（非卡片化表格不撑破容器） */
.mobile-device .content-area table { max-width: 100% !important; white-space: normal !important; }
.mobile-device .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }

/* ===== 表格卡片化（mobile-device 强制生效，不依赖媒体查询） ===== */
.mobile-device table.data-table.responsive-card,
.mobile-device table.data-table.responsive-card thead,
.mobile-device table.data-table.responsive-card tbody,
.mobile-device table.data-table.responsive-card th,
.mobile-device table.data-table.responsive-card td,
.mobile-device table.data-table.responsive-card tr {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.mobile-device table.data-table.responsive-card {
  min-width: 0 !important;
  max-width: 100% !important;
}
.mobile-device table.data-table.responsive-card thead { display: none !important; }
.mobile-device table.data-table.responsive-card tbody tr {
  background: white !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  margin-bottom: 12px !important;
  padding: 8px 0 !important;
  box-shadow: var(--shadow-sm) !important;
  transition: var(--transition) !important;
}
.mobile-device table.data-table.responsive-card tbody tr:hover {
  box-shadow: var(--shadow-md) !important;
  background: white !important;
}
.mobile-device table.data-table.responsive-card tbody td {
  display: flex !important;
  align-items: center !important;
  min-height: 36px !important;
  padding: 6px 12px !important;
  border-bottom: 1px solid var(--border-light) !important;
  text-align: left !important;
  font-size: 14px !important;
  gap: 10px !important;
}
.mobile-device table.data-table.responsive-card tbody td:last-child { border-bottom: none !important; }
.mobile-device table.data-table.responsive-card tbody td::before {
  content: attr(data-label) !important;
  display: inline-block !important;
  min-width: 70px !important;
  max-width: 80px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
  flex-shrink: 0 !important;
}
.mobile-device table.data-table.responsive-card tbody td.actions-cell::before { display: none !important; }
.mobile-device table.data-table.responsive-card tbody td.actions-cell {
  justify-content: flex-start !important;
  padding: 8px 12px !important;
  gap: 6px !important;
}
.mobile-device table.data-table.responsive-card tbody td.actions-cell .btn {
  flex: none !important;
  min-width: auto !important;
}
.mobile-device table.data-table.responsive-card tbody td .badge {
  font-size: 13px !important;
  padding: 4px 12px !important;
}

/* 弹窗 + 移动端紧凑字号 */
.mobile-device .modal-card { padding: 0 !important; }
.mobile-device .modal-body { padding: 16px; }
.mobile-device .modal-header h3 { font-size: 16px; }
.mobile-device .mobile-menu-btn { display: inline-flex !important; }

/* 任务分派看板：横向 4 列 → 单列堆叠（手机端更适合纵向浏览） */
.mobile-device .kanban-board {
  display: block !important;
  overflow-x: visible !important;
  padding-bottom: 0 !important;
}
.mobile-device .kanban-column {
  flex: none !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  margin-bottom: 16px !important;
}
.mobile-device .kanban-column-body {
  overflow-y: visible !important;
  max-height: none !important;
}

/* auto-fill + minmax 的 inline-grid 在手机端强制单列（@media 兜底规则在 .mobile-device 下也生效） */
.mobile-device div[style*="grid-template-columns:repeat(auto-fill,minmax(350px"],
.mobile-device div[style*="grid-template-columns:repeat(auto-fill, minmax(350px"],
.mobile-device div[style*="grid-template-columns:repeat(auto-fill,minmax(300px"],
.mobile-device div[style*="grid-template-columns:repeat(auto-fill, minmax(300px"] {
  grid-template-columns: 1fr !important;
}
