:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --border: #e6e9f0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: #eff4ff;
  --green: #16a34a;
  --green-soft: #ecfdf3;
  --orange: #f59e0b;
  --orange-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --gray: #9ca3af;
  --gray-soft: #f3f4f6;
  --blue: #2563eb;
  --purple: #7c3aed;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 46px; height: 46px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 24px;
}
.brand h1 { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.brand .sub { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.updated-at { font-size: 12px; opacity: 0.85; }

.badge {
  display: inline-block; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.15);
}
.badge-real { background: rgba(22,163,74,0.25); border-color: rgba(255,255,255,0.4); }

.btn {
  border: none; cursor: pointer;
  padding: 8px 16px; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 500;
  transition: opacity 0.15s, transform 0.05s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--gray-soft); opacity: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 7px; }

/* 自定义起止日期区间 */
.range-label .range-pair { display: flex; align-items: center; gap: 6px; }
.range-label input[type="date"] { min-width: 0; padding: 6px 8px; }
.range-sep { color: var(--muted); font-size: 12px; }

/* ---------- 主容器 ---------- */
.container {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- 概览卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  border-left: 4px solid var(--border);
  border-top: 1px solid var(--border);
}
.card .k { font-size: 13px; color: var(--muted); }
.card .v { font-size: 30px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .s { font-size: 12px; color: var(--muted); margin-top: 4px; }

.card.c-total { border-left-color: var(--primary); }
.card.c-total .v { color: var(--primary); }
.card.c-running { border-left-color: var(--orange); }
.card.c-running .v { color: var(--orange); }
.card.c-done { border-left-color: var(--green); }
.card.c-done .v { color: var(--green); }
.card.c-overdue { border-left-color: var(--red); }
.card.c-overdue .v { color: var(--red); }
.card.c-refused { border-left-color: var(--gray); }
.card.c-refused .v { color: var(--gray); }

/* ---------- 工具栏 ---------- */
.toolbar {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.filters label {
  display: flex; flex-direction: column;
  font-size: 12px; color: var(--muted); gap: 4px;
}
.filters select, .filters input {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; color: var(--text);
  background: #fff; min-width: 110px;
}
.filters input { min-width: 190px; }
.filters select:focus, .filters input:focus {
  outline: 2px solid var(--primary-soft); border-color: var(--primary);
}
.toolbar-stat { font-size: 13px; color: var(--muted); }

/* ---------- 统计面板 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 16px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.panel-attention { border: 1px solid #fde2e2; background: #fffaf7; }

/* 条形分布 */
.bar-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-item .lbl { width: 84px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 10px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); }
.bar-fill.f-green { background: var(--green); }
.bar-fill.f-orange { background: var(--orange); }
.bar-fill.f-red { background: var(--red); }
.bar-fill.f-purple { background: var(--purple); }
.bar-fill.f-gray { background: var(--gray); }
.bar-item .cnt { font-size: 13px; font-weight: 600; width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

/* 提醒列表 */
.attention-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.attention-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
}
.attention-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.attention-item .tt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ---------- 列表面板 ---------- */
.list-panel { padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
.list-count { font-size: 13px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 10px 12px; border-bottom: 2px solid var(--border);
  white-space: nowrap; font-size: 12px;
}
.table tbody td {
  padding: 12px; border-bottom: 1px solid #f0f2f7;
  vertical-align: middle;
}
.table tbody tr { cursor: pointer; transition: background 0.12s; }
.table tbody tr:hover { background: var(--primary-soft); }
.tr-overdue { background: #fff8f7; }
.tr-overdue:hover { background: #fdecea !important; }

.project-name { font-weight: 600; color: var(--text); }
.project-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 状态徽章 */
.state {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.st-running { background: var(--orange-soft); color: var(--orange); }
.st-completed { background: var(--green-soft); color: var(--green); }
.st-terminated { background: var(--gray-soft); color: var(--muted); }
.st-refused { background: var(--red-soft); color: var(--red); }
.st-overdue { background: var(--red-soft); color: var(--red); }

/* 审批节点进度 */
.flow { display: flex; align-items: center; gap: 2px; }
.flow .node {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; border: 2px solid var(--border);
  background: #fff; color: var(--muted);
}
.flow .connector { width: 12px; height: 2px; background: var(--border); }
.flow .node.done { background: var(--green); border-color: var(--green); color: #fff; }
.flow .node.current { background: var(--orange); border-color: var(--orange); color: #fff; box-shadow: 0 0 0 3px var(--orange-soft); }
.flow .node.rejected { background: var(--red); border-color: var(--red); color: #fff; }
.flow .node.terminated { background: var(--gray); border-color: var(--gray); color: #fff; }
.flow .connector.done { background: var(--green); }

/* REQ-002b/c：当前审批人 + 百分比进度条 */
.nowrap { white-space: nowrap; }
.progress {
  width: 96px; height: 8px; background: var(--gray-soft);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--green); border-radius: 999px;
  transition: width 0.25s ease;
}
/* 审批列按状态换色（开发列共用 running/gray，另加 paused） */
.progress-fill.running { background: var(--orange); }
.progress-fill.refused { background: var(--red); }
.progress-fill.terminated { background: var(--gray); }
/* 开发列状态色：已暂停 / 未开始 用灰；进行中复用 running(橙)；已完成复用基础 .progress-fill(绿) */
.progress-fill.paused { background: var(--gray); }
.progress-fill.gray { background: var(--gray); }
.prog-label { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* REQ-004：开发进度（复用审批进度条样式 + 已暂停 stop 标记） */
.dev-cell { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.dev-more { color: var(--muted); font-size: 11px; }
.dev-progress { margin-bottom: 1px; }
.dev-progress + .prog-label { margin-bottom: 2px; }
.dev-stop {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; font-size: 12px; line-height: 1;
  background: var(--gray-soft); color: var(--muted); cursor: default;
}
.dev-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px;
  background: #fbfcfe;
}
.dev-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dev-card .dev-progress { max-width: 340px; }
.dev-card .dev-stop { margin-bottom: 10px; }
.dev-card .muted { font-size: 12px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.hidden { display: none !important; }
.modal {
  background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 640px; max-width: 100%; max-height: 85vh;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; overflow: auto; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-grid .f { font-size: 13px; }
.detail-grid .f .k { color: var(--muted); font-size: 12px; }
.detail-grid .f .v { font-weight: 500; }
.detail-full { grid-column: 1 / -1; }

.empty-tip { text-align: center; padding: 40px 0; color: var(--muted); }
.empty-icon { font-size: 40px; margin-bottom: 8px; }
.empty-tip.hidden { display: none; }

.footer {
  text-align: center; color: var(--muted);
  font-size: 12px; padding: 20px 0 32px;
}

/* 加载态 */
.loading { text-align: center; padding: 40px; color: var(--muted); }
.spinner {
  width: 28px; height: 28px; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
