:root {
  --color-start: #0d6efd;
  --color-doing: #ffc107;
  --color-unpaid: #fd7e14;
  --color-done: #198754;
}

body {
  background: #f0f2f5;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

.navbar-custom {
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  padding: 0.6rem 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.navbar-brand { font-weight: 700; font-size: 1.2rem; }

.status-badge {
  font-size: 0.8rem;
  padding: 0.3em 0.65em;
  border-radius: 0.375rem;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
}
.status-启动 { background: var(--color-start); }
.status-进行 { background: var(--color-doing); color: #212529; }
.status-未结款 { background: var(--color-unpaid); }
.status-已完成 { background: var(--color-done); }

.stat-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  background: #fff;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); }
.stat-card .stat-icon { font-size: 2.2rem; opacity: 0.85; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: 0.85rem; color: #6c757d; }

.project-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  border-left: 5px solid transparent;
  background: #fff;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }
.project-card.border-启动 { border-left-color: var(--color-start); }
.project-card.border-进行 { border-left-color: var(--color-doing); }
.project-card.border-未结款 { border-left-color: var(--color-unpaid); }
.project-card.border-已完成 { border-left-color: var(--color-done); }

.issue-card {
  border-radius: 0.5rem;
  border-left: 4px solid #dee2e6;
  background: #fff;
  transition: box-shadow 0.15s;
}
.issue-card:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); }
.issue-card.issue-pending { border-left-color: #dc3545; }
.issue-card.issue-processing { border-left-color: #ffc107; }
.issue-card.issue-resolved { border-left-color: #198754; }

.chart-container {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1.25rem;
}

.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: #e0e0e0; }
.timeline-item { position: relative; margin-bottom: 1rem; }
.timeline-dot { position: absolute; left: -1.5rem; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--color-start); border: 2px solid #fff; box-shadow: 0 0 0 2px #e0e0e0; }
.timeline-content { background: #f8f9fa; padding: 0.75rem 1rem; border-radius: 0.5rem; }

.login-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #1a237e 0%, #3949ab 50%, #5c6bc0 100%); }
.login-card { width: 400px; max-width: 90vw; background: #fff; border-radius: 1rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; }
.login-header { text-align: center; padding: 2rem 1rem 1rem; background: linear-gradient(135deg, #1a237e, #3949ab); color: #fff; }
.login-header i { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.login-header h3 { margin-bottom: 0.25rem; }
.login-header p { margin-bottom: 0; }
.login-body { padding: 2rem; }
.login-hint { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: #adb5bd; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; z-index: 9998; padding: 1rem; }
.modal-box { background: #fff; border-radius: 0.75rem; width: 540px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal-header-bar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid #e9ecef; }
.modal-header-bar h5 { margin: 0; font-weight: 700; }

.text-muted-sm { font-size: 0.8rem; color: #6c757d; }
.text-orange { color: #fd7e14 !important; }
.cursor-pointer { cursor: pointer; }
.notif-item.unread { background-color: #f0f7ff; border-left: 3px solid #0d6efd !important; }
.notif-item.read { background-color: #f8f9fa; opacity: 0.8; }
.notif-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ============ 图片附件 ============ */
.att-container { min-height: 0; }
.att-thumb {
  width: 72px;
  height: 72px;
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid #e9ecef;
  position: relative;
  cursor: pointer;
  background: #f8f9fa;
}
.att-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.15s;
}
.att-thumb:hover img { transform: scale(1.08); }
.att-del-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
}
.att-thumb:hover .att-del-btn { opacity: 1; }
.att-upload-btn { height: 72px; border-style: dashed; }
.att-upload-btn:hover { background: #f8f9fa; }

/* ============ 移动端适配 ============ */
@media (max-width: 768px) {
  .navbar-custom { padding: 0.4rem 0.5rem; }
  .navbar-brand { font-size: 1rem; }
  .navbar-custom .container-fluid { flex-wrap: nowrap; gap: 0.5rem; }
  .navbar-custom .d-flex { gap: 0.75rem !important; flex-wrap: nowrap; }
  .navbar-custom .nav-link { font-size: 0.85rem; padding: 0.25rem 0.25rem; white-space: nowrap; }
  .navbar-custom .navbar-text { font-size: 0.8rem; }
  .navbar-custom .btn-sm { padding: 0.2rem 0.5rem; font-size: 0.8rem; }

  .stat-card .stat-icon { font-size: 1.6rem; }
  .stat-card .stat-value { font-size: 1.4rem; }
  .stat-card .stat-label { font-size: 0.75rem; }

  .project-card .card-body { padding: 0.75rem; }
  .project-card h6 { font-size: 0.95rem; }
  .status-badge { font-size: 0.7rem; padding: 0.2em 0.5em; }

  .chart-container { padding: 0.75rem; }
  .chart-container h6 { font-size: 0.85rem; }

  .modal-box { width: 100%; max-width: 100vw; border-radius: 0; min-height: 100vh; max-height: 100vh; }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-header-bar { padding: 0.75rem 1rem; }
  .modal-box .p-4 { padding: 1rem !important; }

  .login-card { width: 100%; max-width: 100vw; border-radius: 0; min-height: 100vh; }

  .table { font-size: 0.85rem; }
  .table th, .table td { padding: 0.4rem 0.5rem; }

  .issue-card { padding: 0.75rem !important; }
  .timeline { padding-left: 1.2rem; }

  /* 分页控件移动端触摸友好 */
  .pagination .page-link { padding: 0.4rem 0.6rem; font-size: 0.85rem; }

  /* 仪表盘操作栏换行优化 */
  .container-fluid .d-flex.justify-content-between { flex-direction: column; align-items: flex-start !important; gap: 0.5rem; }
  .container-fluid .d-flex .btn-group { width: 100%; }
  .container-fluid .d-flex .btn-group .btn { flex: 1; }

  /* 移动端导航下拉菜单 */
  #mobileNav { background: rgba(0, 0, 0, 0.2); }
  #mobileNav .nav-link { font-size: 0.9rem; }
}

/* 触摸设备：去掉 hover 效果依赖，增大点击区域 */
@media (hover: none) and (pointer: coarse) {
  .project-card:hover, .stat-card:hover { transform: none; }
  .att-thumb:hover .att-del-btn { opacity: 1; } /* 触摸设备常显删除按钮 */
  .att-del-btn { opacity: 1; width: 24px; height: 24px; font-size: 0.7rem; }
}

/* 图片预览大图遮罩 */
.img-preview-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  cursor: zoom-out;
  padding: 2rem;
}
.img-preview-large {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 0.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}