/* ═══════════════════════════════════════════════════════
   督办管理系统 - 样式表
   ═══════════════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #dbeafe;
  --success: #22c55e;
  --success-dark: #16a34a;
  --warning: #f59e0b;
  --warning-dark: #d97706;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --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;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --font: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  --transition: .2s ease;
}

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ───────────────────────────────────────── */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.top-bar {
  background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.top-bar .logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
}

.top-bar .user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.top-bar .user-name {
  background: rgba(255,255,255,.15);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.main-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 56px);
}

/* ─── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  padding: 16px 0;
  flex-shrink: 0;
  overflow-y: auto;
}

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

.sidebar .nav-item:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}

.sidebar .nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar .nav-item .nav-icon { width: 18px; text-align: center; }
.sidebar .nav-divider { height: 1px; background: var(--gray-200); margin: 8px 16px; }

/* ─── Content Area ─────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-width: 0;
}

.page { display: none; }
.page.active { display: block; }

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

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

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

/* ─── Auth Pages (Login / Register) ────────────────── */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1e40af 100%);
  padding: 20px;
}

.auth-card {
  background: #fff;
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}

.auth-card .auth-title {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card .auth-title h1 {
  font-size: 22px;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.auth-card .auth-title p {
  color: var(--gray-500);
  font-size: 13px;
}

/* ─── Forms ────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

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

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

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  transition: var(--transition);
  background: #fff;
  color: var(--gray-800);
}

.form-control:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.form-control::placeholder { color: var(--gray-400); }

select.form-control { cursor: pointer; }

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.5;
}

.btn:active { transform: scale(.97); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

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

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--warning-dark); }

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

.btn-outline {
  background: transparent;
  border-color: var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-white { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-white:hover { background: var(--gray-50); }

/* ─── Cards ────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

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

.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); }

/* ─── Stat Cards (Dashboard) ──────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: #8b5cf6; }

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ─── Tables ───────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #ddd;
  background: #fff;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

thead {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #fff;
}

th {
  padding: 14px 10px;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.15);
  min-width: 80px;
}

td {
  padding: 10px 8px;
  border: 1px solid #ddd;
  vertical-align: top;
  position: relative;
}

tbody tr:nth-child(even) { background-color: #f9f9f9; }
tbody tr:hover { background-color: #e3f2fd; }

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-500);
  flex-wrap: wrap;
  gap: 15px;
}

/* ─── Filter Bar ───────────────────────────────────── */
.filter-bar {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.filter-bar .filter-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 12px;
}

.filter-bar .filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-bar .filter-item {
  flex: 1;
  min-width: 160px;
}

.filter-bar .filter-item label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.filter-bar .filter-item .form-control { padding: 7px 10px; font-size: 13px; }

.filter-bar .filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-bottom: 1px;
}

/* ─── Status Badges ────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.badge-success { background: rgba(34,197,94,.12); color: var(--success-dark); }
.badge-success-light { background: rgba(34,197,94,.08); color: #15803d; border: 1px dashed #86efac; }
.badge-warning { background: rgba(245,158,11,.12); color: var(--warning-dark); }
.badge-danger  { background: rgba(239,68,68,.12); color: var(--danger-dark); }
.badge-orange  { background: rgba(249,115,22,.12); color: #c2410c; }
.badge-gray    { background: var(--gray-100); color: var(--gray-500); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ─── Modals ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform .2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

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

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--gray-400);
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--gray-700); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-lg { max-width: 800px; }

/* ─── Checkbox cells ───────────────────────────────── */
.cb-cell { width: 40px; text-align: center; }
.cb-cell input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ─── Attachment list ──────────────────────────────── */
.att-list { display: flex; flex-direction: column; gap: 6px; }

.att-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 6px;
  background: var(--gray-50);
  border-radius: 4px;
}

.att-item a { color: var(--primary); }
.att-item .att-actions { margin-left: auto; display: flex; gap: 4px; }

/* ─── Toast notifications ──────────────────────────── */
.toast-container {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--gray-800);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 400px;
  animation: toast-in .3s ease;
}

.toast.toast-success { background: var(--success-dark); }
.toast.toast-error   { background: var(--danger-dark); }
.toast.toast-warning { background: var(--warning-dark); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Unit checkbox list (for approval) ────────────── */
.unit-checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.unit-checkbox-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}

.unit-checkbox-list label:hover { background: var(--gray-100); }
.unit-checkbox-list input[type="checkbox"] { width: 15px; height: 15px; }

/* ─── Charts ───────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.chart-card h4 {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 12px;
  text-align: center;
}

.chart-card canvas { height: 280px !important; }

.chart-card.full-width { grid-column: 1 / -1; }

/* ─── 统计页双栏布局 ─────────────────────────────────── */
.stats-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  min-width: 0;
  overflow: hidden;
}
.stats-left, .stats-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.stats-unit-block {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 12px 16px 16px;
  min-width: 0;
  overflow: hidden;
}
.stats-unit-block > .unit-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  border-left: 3px solid var(--primary);
  padding-left: 8px;
  margin-bottom: 12px;
}
.stats-unit-block .chart-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}
.stats-unit-block .chart-row .chart-card {
  padding: 12px;
  min-width: 0;
  overflow: hidden;
}
.stats-unit-block .chart-row .chart-card h4 {
  font-size: 13px;
  margin-bottom: 8px;
}
.stats-unit-block .chart-row .chart-card canvas {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 260px !important;
}
.stats-unit-block .chart-row .chart-card:first-child canvas { height: 340px !important; }
.stats-unit-details {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stats-unit-details.empty {
  color: var(--gray-500);
  font-size: 13px;
  text-align: center;
  padding: 14px 0 2px;
}
.stats-category-group {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.stats-category-title {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
}
.stats-task-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.stats-unit-block.empty {
  color: var(--gray-500);
  font-size: 13px;
  text-align: center;
  padding: 18px;
}
@media (max-width: 1100px) {
  .stats-layout { grid-template-columns: 1fr; }
  .stats-unit-block .chart-row { grid-template-columns: 1fr; }
}

/* ─── 列隐藏 ─────────────────────────────────────────── */
.col-hidden { display: none !important; }

/* ─── 列设置弹窗里的勾选列表 ───────────────────────────── */
.col-settings-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
}
.col-settings-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
  font-size: 13px;
}
.col-settings-list label:hover { background: var(--gray-50); }
.col-settings-list input[type="checkbox"] { margin: 0; }

/* ─── 工作台单位事项卡片 ───────────────────────────────── */
.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  user-select: none;
}
.toggle-inline input { margin: 0; }

.unit-issue-group {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
}
.unit-issue-group:last-child { margin-bottom: 0; }
.unit-issue-group-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.unit-issue-group-header .count-tags {
  font-size: 12px;
  font-weight: 400;
  color: var(--gray-500);
}
.unit-issue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.unit-issue-table th,
.unit-issue-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--gray-100);
  text-align: left;
  vertical-align: top;
}
.unit-issue-table th {
  background: #fff;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-200);
}
.unit-issue-table tr.notified { background: #f5f5f5; color: var(--gray-500); }
/* 通用折叠类，覆盖所有有 .folded 的行（统计页 mini-table 也用同一规则） */
tr.folded { display: none !important; }
tr.notified { background: #f5f5f5; color: var(--gray-500); }
.unit-issue-table td.actions { text-align: right; white-space: nowrap; }

/* ─── 统计页 Tab ─────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 16px;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.unit-button-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.unit-button-bar .unit-btn {
  background: #fff;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.unit-button-bar .unit-btn:hover { border-color: var(--primary); color: var(--primary); }
.unit-button-bar .unit-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ─── Recent tasks list ────────────────────────────── */
.recent-list { list-style: none; }

.recent-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.recent-list li:last-child { border-bottom: none; }

.recent-list .task-info { flex: 1; min-width: 0; }

.recent-list .task-info .task-title {
  color: var(--gray-800);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-list .task-info .task-meta {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ─── Empty state ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

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

/* ─── Loading spinner ──────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  color: var(--gray-500);
  font-size: 14px;
}

/* ─── Pagination ───────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination .page-btn {
  padding: 5px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background: #fff;
  color: var(--gray-700);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.pagination .page-btn:hover { background: var(--gray-50); }
.pagination .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ─── File upload area ─────────────────────────────── */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--gray-500);
  cursor: pointer;
  transition: var(--transition);
}

.upload-area:hover { border-color: var(--primary); color: var(--primary); }

.upload-area input[type="file"] { display: none; }

/* ─── Approval card ────────────────────────────────── */
.approval-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.approval-card .info { flex: 1; }
.approval-card .info h4 { font-size: 15px; margin-bottom: 4px; }
.approval-card .info p { font-size: 13px; color: var(--gray-500); margin-bottom: 2px; }
.approval-card .card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── User table badge ─────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.role-admin { background: #fef3c7; color: #92400e; }
.role-user  { background: var(--primary-light); color: var(--primary-dark); }

.status-tag { font-size: 12px; font-weight: 600; }
.status-approved { color: var(--success); }
.status-pending  { color: var(--warning); }
.status-disabled { color: var(--gray-400); }
.status-rejected { color: var(--danger); }

/* ─── Task cell specific widths ────────────────────── */
.col-index    { width: 56px; min-width: 56px; text-align: center; }
.col-category { min-width: 120px; text-align: center; }
.col-no       { width: 60px; min-width: 60px; text-align: center; }
.col-unit     { min-width: 100px; text-align: center; }
.col-content  { min-width: 420px; }
.col-leader   { min-width: 90px; text-align: center; }
.col-person   { min-width: 90px; text-align: center; }
.col-deadline { min-width: 110px; text-align: center; }
.col-progress { min-width: 300px; }
.col-status   { min-width: 90px; text-align: center; }
.col-attach   { min-width: 100px; text-align: center; }
.col-blockers { min-width: 200px; }
.col-coord    { min-width: 200px; }
.col-actions  { min-width: 80px; text-align: center; }
.col-time     { min-width: 140px; }
.col-updater  { min-width: 80px; text-align: center; }

/* ─── Locked cell (read-only) ─────────────────────── */
td.locked-cell {
  background-color: #ecf0f1;
  color: #555;
  font-weight: 500;
  text-align: center;
}

/* ─── Editable cell highlight ──────────────────────── */
td.editable-cell {
  cursor: pointer;
  transition: background .15s;
}
td.editable-cell:hover {
  background: rgba(52, 152, 219, .08);
}

/* ─── Inline editable fields ──────────────────────── */
.inline-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font);
  background: #fff;
  transition: all .3s;
}

.inline-input:focus {
  border-color: #3498db;
  outline: none;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

textarea.inline-input { min-height: 60px; resize: vertical; }

select.inline-input {
  cursor: pointer;
  padding: 6px 8px;
}

/* ─── Inline edit active state ────────────────────── */
td.editing {
  padding: 4px;
  background: #fff !important;
}

/* ─── Save indicator ──────────────────────────────── */
.save-indicator {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  color: var(--success);
  opacity: 0;
  transition: opacity .3s;
}
.save-indicator.visible { opacity: 1; }

/* ─── Stats: status-grouped task lists ─────────────── */
.stats-task-lists {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stats-right .stats-task-lists { margin-top: 0; }

.stats-status-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.stats-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.stats-section-header:hover { opacity: .9; }
.stats-section-header h3 { font-size: 15px; font-weight: 600; margin: 0; color: #fff; }
.stats-section-header .toggle-icon { font-size: 12px; color: rgba(255,255,255,.8); }

.stats-section-header.warning-header  { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stats-section-header.success-header  { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.stats-section-header.danger-header   { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.stats-section-header.gray-header     { background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%); }
.stats-section-header.orange-header   { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }

.stats-task-list {
  overflow-x: auto;
  overflow-y: hidden;
  transition: max-height .3s ease;
}
.stats-task-list.collapsed {
  max-height: 0 !important;
  overflow: hidden;
}
.stats-task-list .stats-mini-table {
  min-width: 100%;
}
/* 右侧分栏下表格更紧凑 */
.stats-right .stats-mini-table th,
.stats-right .stats-mini-table td { font-size: 12px; padding: 6px; }

.stats-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.stats-mini-table thead {
  background: var(--gray-100);
  color: var(--gray-700);
}
.stats-mini-table th {
  padding: 10px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  border: 1px solid var(--gray-200);
  white-space: nowrap;
  color: var(--gray-700);
}
.stats-mini-table td {
  padding: 8px;
  border: 1px solid var(--gray-200);
  vertical-align: top;
  text-align: center;
}
.stats-mini-table tbody tr:nth-child(even) { background-color: #f9f9f9; }
.stats-mini-table tbody tr:hover { background-color: #e3f2fd; }

/* 统计分析-单位明细表：固定列宽，确保不同任务类别分组的列严格对齐 */
.stats-unit-details .stats-mini-table {
  min-width: 1180px;
}
.stats-unit-details .stats-mini-table th:nth-child(1),
.stats-unit-details .stats-mini-table td:nth-child(1) { width: 92px; }
.stats-unit-details .stats-mini-table th:nth-child(2),
.stats-unit-details .stats-mini-table td:nth-child(2) { width: 46%; }
.stats-unit-details .stats-mini-table th:nth-child(3),
.stats-unit-details .stats-mini-table td:nth-child(3) { width: 86px; }
.stats-unit-details .stats-mini-table th:nth-child(4),
.stats-unit-details .stats-mini-table td:nth-child(4) { width: 86px; }
.stats-unit-details .stats-mini-table th:nth-child(5),
.stats-unit-details .stats-mini-table td:nth-child(5) { width: 112px; }
.stats-unit-details .stats-mini-table th:nth-child(6),
.stats-unit-details .stats-mini-table td:nth-child(6) { width: 170px; }
.stats-unit-details .stats-mini-table th:nth-child(7),
.stats-unit-details .stats-mini-table td:nth-child(7) { width: 160px; }
.stats-unit-details .stats-mini-table th:nth-child(8),
.stats-unit-details .stats-mini-table td:nth-child(8) { width: 170px; }

@media (max-width: 768px) {
  .stats-unit-block { padding: 10px; border-radius: 10px; }
  .stats-unit-block > .unit-title { font-size: 14px; }
  .stats-unit-block .chart-row { gap: 10px; }
  .stats-unit-block .chart-row .chart-card { padding: 10px; }
  .stats-unit-block .chart-row .chart-card canvas { height: 260px !important; }
  .stats-unit-block .chart-row .chart-card:first-child canvas { height: 300px !important; }
  .stats-task-table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
  .stats-unit-details .stats-mini-table { min-width: 980px; font-size: 12px; }
  .stats-mini-table th { padding: 8px 6px; }
  .stats-mini-table td { padding: 7px 6px; }
}

/* ─── Hamburger button (hidden on desktop) ─────── */
.btn-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}
.btn-hamburger:hover { background: rgba(255,255,255,.15); }

/* ─── Sidebar overlay (mobile only) ────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .btn-hamburger { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: none;
    width: 220px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .content-area { padding: 16px; }
  .top-bar { padding: 0 12px; }
  .top-bar .logo { font-size: 15px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .chart-grid { grid-template-columns: 1fr; }
  .filter-bar .filter-row { flex-direction: column; }
  .filter-bar .filter-item { min-width: auto; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .modal { max-width: calc(100vw - 40px); }
  .auth-card { padding: 28px 20px; }
  .top-bar .user-area { gap: 6px; font-size: 12px; }
  .top-bar .user-area .user-name { padding: 3px 8px; font-size: 12px; }
}

/* ─── Scrollbar ────────────────────────────────────── */
::-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); }

/* ─── Misc ─────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ─── 列头筛选按钮 + 弹层 ───────────────────────────── */
#task-table thead th { position: relative; }
.col-filter-btn {
  margin-left: 4px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: #888;
  cursor: pointer;
  border-radius: 3px;
}
.col-filter-btn:hover { background: #eef; color: #2563eb; }
.col-filter-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.col-filter-popover {
  position: absolute;
  z-index: 9999;
  background: #fff;
  border: 1px solid #d6d9e0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-radius: 6px;
  padding: 10px;
  width: 260px;
  font-size: 13px;
}
.col-filter-popover .cfp-section { margin-bottom: 8px; }
.col-filter-popover .cfp-sort button {
  margin-right: 4px; padding: 4px 8px; font-size: 12px;
  border: 1px solid #d6d9e0; background: #f7f8fa; cursor: pointer; border-radius: 4px;
}
.col-filter-popover .cfp-sort button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.col-filter-popover .cfp-date { display: flex; flex-direction: column; gap: 4px; }
.col-filter-popover .cfp-date label { font-size: 12px; color: #666; }
.col-filter-popover .cfp-values {
  max-height: 220px; overflow-y: auto; border: 1px solid #ececec; border-radius: 4px; padding: 6px;
}
.col-filter-popover .cfp-values label {
  display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer;
  font-weight: normal; font-size: 12px;
}
.col-filter-popover .cfp-values label input { margin: 0; }
.col-filter-popover .cfp-footer { display: flex; justify-content: space-between; }

.filter-item-keyword { flex: 1; min-width: 240px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
