* { box-sizing: border-box; }

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --today: #e5484d;
  --cell-w: 40px;
  --row-h: 56px;
  --name-w: 220px;
}

html, body { height: 100%; }

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

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { font-weight: 600; font-size: 15px; white-space: nowrap; }

.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.status { font-size: 12px; color: var(--muted); }
.status.error { color: #b42318; }

button {
  font-family: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 5px 12px; border-radius: 7px; transition: background .12s;
}
button:hover { background: #f9fafb; }
button.primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
button.primary:hover { background: #1e40af; }
button.danger { color: #b42318; border-color: #fecdca; }
button.danger:hover { background: #fef3f2; }

select, input[type="text"], input[type="date"], input:not([type]) {
  font-family: inherit; font-size: 13px; color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 8px; background: var(--panel); outline: none;
}
select:focus, input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

.view { padding: 16px; }

.toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; flex-wrap: wrap;
}

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-left: auto; }
.legend-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; }
.legend-group strong { color: var(--text); font-weight: 600; margin-right: 2px; }
.legend .item { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; background: var(--c); flex: 0 0 auto; }

.board {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  max-height: calc(100vh - 190px);
  position: relative;
}

.board-inner { min-width: max-content; }

.head-row, .row { display: flex; }

.head-row {
  position: sticky; top: 0; z-index: 3;
  background: var(--panel);
}

.cell {
  width: var(--cell-w);
  flex: 0 0 var(--cell-w);
  height: var(--row-h);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.cell.name {
  position: sticky; left: 0; z-index: 2;
  width: var(--name-w); flex: 0 0 var(--name-w);
  background: var(--panel);
  box-shadow: 3px 0 6px -4px rgba(16,24,40,.22);
  padding: 6px 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  overflow: hidden;
}
.head-row .cell.name { z-index: 4; font-weight: 600; font-size: 13px; color: var(--muted); }

.name-top { display: flex; align-items: center; gap: 6px; }
.name-title {
  font-size: 13px; font-weight: 500; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.code { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 报名确认无时间：单位勾选进度挂在名称列下方 */
.signup-line {
  font-size: 11px; color: var(--muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tag {
  font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 5px;
  white-space: nowrap; flex: 0 0 auto;
}
.tag.tender { background: #eff6ff; color: #1d4ed8; }
.tag.procurement { background: #f0fdf4; color: #15803d; }

.cell.head {
  height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; font-size: 11px; color: var(--muted);
  background: #fcfcfd;
}
.cell.head .m { font-size: 10px; color: #98a2b3; height: 12px; line-height: 12px; }
.cell.head .d { font-size: 13px; font-weight: 600; color: var(--text); line-height: 15px; font-variant-numeric: tabular-nums; }
.cell.head .w { font-size: 10px; line-height: 12px; }
.cell.head.weekend { background: #fafafa; }
.cell.head.weekend .d { color: #98a2b3; }
.cell.head.today .d { color: var(--today); }

.cell.weekend { background: #fcfcfd; }

/* ---- 泳道式日历（横道图）---- */

.row .cell.name {
  height: auto; min-height: var(--row-h);
}

.day-grid {
  position: relative;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.gcell {
  position: absolute;
  top: 0; height: 100%;
  width: var(--cell-w);
  border-right: 1px solid var(--border);
}
.gcell.weekend { background: #fcfcfd; }
.gcell.today {
  border-left: 2px solid var(--today);
  border-right: 2px solid var(--today);
  background: #fff5f5;
}

.gbar {
  position: absolute;
  border-radius: 4px;
  background: var(--c);
  cursor: default;
  transition: filter .12s;
}
.gbar:hover { filter: brightness(1.08); }
/* 流程已发起但未确认完成：虚线空框，文字用步骤色（底透明白字不可读） */
.gbar.pending {
  background: transparent;
  border: 1.5px dashed var(--c);
}
.gbar.pending:hover { filter: none; background: rgba(0, 0, 0, .04); }
.gbar.pending .bar-label { color: var(--c); text-shadow: none; }
.gbar.seg-start { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.gbar.seg-end { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.bar-label {
  display: block;
  font-size: 11px; line-height: 22px;
  color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.18);
  padding-left: 7px;
  white-space: nowrap;
  transform-origin: left center;
}
.bar-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #e5484d;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.9);
  cursor: help;
  transition: transform .12s;
}
.bar-dot:hover { transform: scale(1.35); }

/* ---- 自定义即时提示气泡 ---- */
.tip {
  position: fixed;
  z-index: 100;
  display: none;
  pointer-events: none;
  max-width: 280px;
  padding: 7px 10px;
  background: #101828;
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-line;
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
}
.tip.show { display: block; }
.cell.head.today {
  background: #fff5f5;
  border-left: 2px solid var(--today);
  border-right: 2px solid var(--today);
}

.empty {
  padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 14px;
  align-items: end;
}
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form-grid label input, .form-grid label select { width: 100%; }
.form-grid .full { grid-column: 1 / -1; }

.section-card .card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.head-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-name { font-weight: 600; font-size: 14px; }
.head-actions { margin-left: auto; display: flex; gap: 8px; }

.steps-editor { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 14px; }

.meta-grid { margin-bottom: 14px; }

.steps-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.steps-table th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.steps-table td { padding: 5px 8px; border-bottom: 1px solid #f2f4f7; }
.steps-table input[type="text"] { width: 100%; min-width: 120px; }
.steps-table input[type="date"] { width: 140px; }

.step-name { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: 0 0 auto; }

.editor-actions { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
.save-msg { font-size: 12px; color: var(--muted); }
.save-msg.ok { color: #15803d; }
.save-msg.error { color: #b42318; }

.empty-card {
  padding: 32px; text-align: center; color: var(--muted);
  background: var(--panel); border: 1px dashed var(--border); border-radius: 10px;
}
/* ---- 使用说明浮窗 ---- */
.help-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 24, 40, .4);
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 60px 16px 16px;
}
.help-panel {
  background: var(--panel); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .28);
  width: 420px; max-width: 100%;
  max-height: calc(100vh - 90px); overflow: auto;
  padding: 16px 20px 18px;
}
.help-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.help-head h3 { margin: 0; font-size: 15px; }
.help-close { font-size: 12px; }
.help-panel ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.help-panel li { font-size: 13px; line-height: 1.6; color: var(--text); }
.help-panel li b { color: #1d4ed8; }
