/* ==================== 全局 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #333; font-size: 14px; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }

/* ==================== 登录页 ==================== */
.login-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #1a3a5c 0%, #2d6a9f 50%, #3498db 100%);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-box {
  background: #fff; border-radius: 16px; padding: 40px; width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center;
}
.login-logo { font-size: 56px; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 700; color: #1a3a5c; margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: #888; margin-bottom: 28px; }
.login-form { text-align: left; }
.login-input-group {
  display: flex; align-items: center; background: #f5f7fa; border-radius: 10px;
  padding: 0 14px; margin-bottom: 16px; border: 2px solid transparent; transition: all .2s;
}
.login-input-group:focus-within { border-color: #2d6a9f; background: #fff; }
.login-icon { font-size: 18px; margin-right: 10px; }
.login-input {
  flex: 1; border: none; background: transparent; padding: 14px 0; font-size: 16px;
}
.login-pw-toggle { cursor: pointer; font-size: 16px; opacity: .5; }
.login-pw-toggle:hover { opacity: 1; }
.login-error {
  color: #e74c3c; font-size: 13px; min-height: 24px; margin-bottom: 8px;
  text-align: center;
}
.login-btn {
  width: 100%; padding: 14px; background: linear-gradient(135deg, #2d6a9f, #3498db);
  color: #fff; border: none; border-radius: 10px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all .2s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,106,159,.3); }
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.login-spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-footer {
  text-align: center; margin-top: 20px; font-size: 12px; color: #aaa;
  display: flex; justify-content: center; gap: 8px;
}
.login-change-pw { color: #2d6a9f; cursor: pointer; }
.login-change-pw:hover { text-decoration: underline; }

/* ==================== 顶部导航 ==================== */
.app-header {
  height: 56px; background: linear-gradient(135deg, #1a3a5c, #2d6a9f); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; box-shadow: 0 2px 8px rgba(0,0,0,.15); position: fixed;
  top: 0; left: 0; right: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.app-logo { font-size: 28px; }
.app-title { font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.user-badge { background: rgba(255,255,255,.15); padding: 4px 12px; border-radius: 14px; font-size: 13px; }
.header-date { font-size: 13px; opacity: .8; }

/* ==================== 布局 ==================== */
.app-layout { display: flex; margin-top: 56px; min-height: calc(100vh - 56px); }

/* ==================== 侧边栏 ==================== */
.sidebar {
  width: 200px; background: #fff; border-right: 1px solid #e8e8e8;
  padding: 12px 0; position: fixed; top: 56px; left: 0;
  height: calc(100vh - 56px); overflow-y: auto; z-index: 50;
}
.nav-list { list-style: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px;
  cursor: pointer; color: #555; transition: all .2s; position: relative;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #f5f7fa; color: #1a3a5c; }
.nav-item.active { background: #e8f0fe; color: #1a3a5c; border-left-color: #2d6a9f; font-weight: 600; }
.nav-icon { font-size: 18px; }
.nav-label { font-size: 14px; }
.nav-badge {
  margin-left: auto; background: #e74c3c; color: #fff; font-size: 11px;
  padding: 1px 7px; border-radius: 10px; min-width: 18px; text-align: center;
}

/* ==================== 主内容 ==================== */
.main-content {
  flex: 1; margin-left: 200px; padding: 24px; min-height: calc(100vh - 56px);
}

/* ==================== 统计卡片 ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: 13px; color: #888; }
.stat-card.blue { border-left: 4px solid #2d6a9f; } .stat-card.blue .stat-value { color: #2d6a9f; }
.stat-card.green { border-left: 4px solid #27ae60; } .stat-card.green .stat-value { color: #27ae60; }
.stat-card.orange { border-left: 4px solid #e67e22; } .stat-card.orange .stat-value { color: #e67e22; }
.stat-card.red { border-left: 4px solid #e74c3c; } .stat-card.red .stat-value { color: #e74c3c; }
.stat-card.purple { border-left: 4px solid #8e44ad; } .stat-card.purple .stat-value { color: #8e44ad; }
.stat-card.teal { border-left: 4px solid #1abc9c; } .stat-card.teal .stat-value { color: #1abc9c; }

/* ==================== 通用组件 ==================== */
.section-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.section-title .more-link { font-size: 13px; font-weight: 400; color: #2d6a9f; cursor: pointer; margin-left: auto; }

.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 20px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px;
  border-radius: 6px; border: none; font-size: 14px; transition: all .2s;
}
.btn-primary { background: #2d6a9f; color: #fff; }
.btn-primary:hover { background: #1a4a7a; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #1e8449; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-outline { background: #fff; border: 1px solid #d9d9d9; color: #555; }
.btn-outline:hover { border-color: #2d6a9f; color: #2d6a9f; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 4px; }
.btn-warning { background: #e67e22; color: #fff; }
.btn-warning:hover { background: #d35400; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.toolbar-left { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.search-input { padding: 8px 14px; border: 1px solid #d9d9d9; border-radius: 6px; width: 220px; font-size: 14px; }
.search-input:focus { border-color: #2d6a9f; }

.filter-select { padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; background: #fff; }

/* ==================== 表格 ==================== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
th { background: #fafafa; font-weight: 600; color: #555; white-space: nowrap; }
tr:hover td { background: #f8fafe; }

/* ==================== 标签 ==================== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.tag-red { background: #fde8e8; color: #c0392b; }
.tag-green { background: #e8f8e8; color: #1e8449; }
.tag-blue { background: #e8f0fe; color: #2d6a9f; }
.tag-orange { background: #fef3e2; color: #d35400; }
.tag-gray { background: #f0f0f0; color: #666; }
.tag-purple { background: #f0e8ff; color: #7d3c98; }

/* ==================== 模态框 ==================== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 12px; width: 90%; max-width: 680px;
  max-height: 85vh; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid #f0f0f0;
}
.modal-header h3 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 20px; color: #999; cursor: pointer; padding: 4px; }
.modal-close:hover { color: #333; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; gap: 8px; }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; font-size: 14px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 6px;
  transition: border .2s; font-size: 14px;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: #2d6a9f; box-shadow: 0 0 0 2px rgba(45,106,159,.1); }
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ==================== 列表 ==================== */
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: background .15s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #fafafa; margin: 0 -12px; padding: 12px; border-radius: 8px; }
.list-item-content { flex: 1; }
.list-item-title { font-weight: 500; margin-bottom: 2px; }
.list-item-desc { color: #888; font-size: 13px; }
.list-item-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: #999; }

/* ==================== 看板 ==================== */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { min-width: 280px; max-width: 320px; flex: 1; }
.kanban-col-header { font-weight: 600; font-size: 15px; padding: 10px 0; border-bottom: 2px solid; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.kanban-col-header .count { color: #999; font-weight: 400; font-size: 13px; }
.kanban-card {
  background: #fff; border-radius: 8px; padding: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: pointer; transition: all .15s;
  border-left: 3px solid #ddd;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.kanban-card .card-title { font-weight: 500; margin-bottom: 6px; }
.kanban-card .card-meta { font-size: 12px; color: #999; display: flex; gap: 8px; flex-wrap: wrap; }

/* ==================== 时间线 ==================== */
.timeline { padding-left: 20px; border-left: 2px solid #e8e8e8; }
.timeline-item { position: relative; padding: 0 0 20px 20px; }
.timeline-item::before {
  content: ''; position: absolute; left: -8px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%; background: #2d6a9f; border: 2px solid #fff;
}
.timeline-item .tl-date { font-size: 12px; color: #999; margin-bottom: 4px; }
.timeline-item .tl-title { font-weight: 500; margin-bottom: 2px; }
.timeline-item .tl-desc { font-size: 13px; color: #666; }

/* ==================== 标签云 ==================== */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud .tag-item { padding: 4px 14px; border-radius: 16px; background: #e8f0fe; color: #2d6a9f; cursor: pointer; font-size: 13px; transition: all .15s; }
.tag-cloud .tag-item:hover { background: #2d6a9f; color: #fff; }
.tag-cloud .tag-item .count { font-size: 11px; opacity: .7; }

/* ==================== 工程阶段条 ==================== */
.phase-bar { display: flex; gap: 4px; margin: 8px 0; }
.phase-step { flex: 1; text-align: center; padding: 6px 4px; font-size: 11px; border-radius: 4px; background: #f0f0f0; color: #999; }
.phase-step.active { background: #2d6a9f; color: #fff; font-weight: 500; }
.phase-step.done { background: #27ae60; color: #fff; }
.phase-step.current { background: #e67e22; color: #fff; }

/* ==================== 空状态 ==================== */
.empty-state { text-align: center; padding: 40px 20px; color: #999; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 15px; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .sidebar .nav-label { display: none; }
  .sidebar .nav-badge { display: none; }
  .main-content { margin-left: 56px; padding: 16px; }
  .nav-item { justify-content: center; padding: 14px 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
