/* projects.css — 项目管理页面样式 */

/* ── 工具栏：搜索 + 筛选 ── */
.projects-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.history-run {
  height: 292px;
  min-height: 292px;
  padding: 0;
  display: grid;
  grid-template-columns: 124px minmax(0,1fr);
  overflow: hidden;
  cursor: default;
}
.history-run:hover { transform: none; }
.history-card-visual { position: relative; min-height: 100%; overflow: hidden; background: linear-gradient(135deg,#eef6f1,#f8eee5); }
.history-card-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg,rgba(61,64,91,.02) 34%,rgba(38,42,59,.74)); pointer-events: none; }
.history-card-visual img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 48%; transform: scale(1.035); }
.history-card-visual span { position: absolute; z-index: 1; left: 15px; right: 10px; bottom: 16px; color: #fff; font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.history-card-body { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 20px 22px; }
.history-card-body > header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.history-card-body > header span { padding: 4px 9px; border-radius: 999px; background: #eef7f2; color: var(--primary, #5d8e76); font-size: 10px; font-weight: 800; }
.history-card-body > header small { max-width: 55%; overflow: hidden; color: #8a8c98; text-overflow: ellipsis; white-space: nowrap; }
.history-card-body h3 { min-height: 48px; margin: 13px 0 7px; overflow: hidden; color: #3d405b; font-size: 19px; line-height: 1.28; letter-spacing: -.02em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.history-card-body > p { min-height: 36px; margin: 0; overflow: hidden; color: #777b8d; font-size: 11px; line-height: 1.65; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.history-card-context { display: flex; gap: 6px; margin-top: 11px; overflow: hidden; }
.history-card-context span { flex: 0 1 auto; min-width: 0; padding: 4px 7px; overflow: hidden; border-radius: 6px; color: #667085; background: #f7f3ee; font-size: 9px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.history-artifacts { display: grid; gap: 8px; margin-top: 16px; }
.history-artifact { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; text-align: left; }
.history-artifact span, .history-artifact small { color: #64748b; font-size: 11px; }
.history-artifact b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-run-summary { display: flex; gap: 14px; margin: 11px 0; overflow: hidden; }
.history-run-summary span { position: relative; color: #697386; font-size: 10px; font-weight: 700; }
.history-run-summary span + span::before { content: "·"; position: absolute; left: -9px; color: #b5b8c1; }
.history-card-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: auto; }
.archive-open { width: 100%; }
.archive-delete { padding: 0 13px; border: 1px solid rgba(159,78,57,.24); border-radius: 10px; background: #fff; color: var(--danger,#9f4e39); font-size: 11px; font-weight: 750; cursor: pointer; }
.archive-delete:hover { border-color: rgba(159,78,57,.5); background: #fff3ef; }
.archive-delete:focus-visible { outline: 3px solid rgba(159,78,57,.18); outline-offset: 2px; }
.archive-detail { max-width: 1120px; margin: 0 auto; }
.archive-detail-head { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; margin-bottom: 16px; padding: 30px 32px; overflow: hidden; border: 1px solid #e6ddd5; border-radius: 24px; background: linear-gradient(135deg,#fff 0%,#fffaf6 54%,#eef7f2 100%); }
.archive-detail-head::after { content: ""; position: absolute; right: -42px; bottom: -68px; width: 190px; height: 190px; border: 34px solid rgba(129,178,154,.12); border-radius: 50%; pointer-events: none; }
.archive-detail-copy { position: relative; z-index: 1; max-width: 820px; }
.archive-detail-head h1 { max-width: 760px; margin: 14px 0 8px; color: #3d405b; font-size: clamp(28px,3vw,42px); line-height: 1.12; letter-spacing: -.04em; }
.archive-detail-head p { max-width: 760px; margin: 0; color: #697386; font-size: 13px; line-height: 1.7; }
.archive-detail-head > button { position: relative; z-index: 1; flex: 0 0 auto; }
.archive-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.archive-detail-meta span { padding: 6px 10px; border: 1px solid #e7ded7; border-radius: 999px; color: #5c6373; background: rgba(255,255,255,.78); font-size: 10px; font-weight: 750; }
.archive-readonly-badge { display: inline-flex; padding: 7px 11px; border-radius: 999px; background: #111827; color: white; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.archive-notice { display: flex; gap: 14px; align-items: center; padding: 14px 18px; margin-bottom: 18px; border: 1px solid #dbe4ef; border-radius: 14px; background: #f8fafc; color: #475569; font-size: 12px; }
.archive-notice b { color: #0f172a; white-space: nowrap; }
.archive-original-brief { margin-bottom: 18px; border: 1px solid #e7e0da; border-radius: 14px; background: rgba(255,255,255,.72); }
.archive-original-brief summary { padding: 13px 17px; color: #5d8e76; font-size: 11px; font-weight: 800; cursor: pointer; }
.archive-original-brief div { max-height: 320px; margin: 0 17px 17px; padding: 16px; overflow: auto; border-radius: 10px; color: #596173; background: #f8f6f3; font-size: 11px; line-height: 1.75; white-space: pre-wrap; }
.archive-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.archive-tab { flex: 0 0 auto; padding: 9px 14px; border: 1px solid #dbe4ef; border-radius: 999px; background: white; color: #475569; font-weight: 700; cursor: pointer; }
.archive-tab.active { border-color: #111827; background: #111827; color: white; }
.archive-document { min-height: 360px; padding: 34px 40px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow-sm); }
.archive-deck, .archive-files { margin-top: 24px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.archive-deck > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.archive-deck h2, .archive-files h2 { margin: 4px 0 0; font-size: 18px; }
.archive-deck > header > span { padding: 5px 9px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 11px; font-weight: 700; }
.archive-deck iframe { display: block; width: 100%; height: min(72vh, 760px); border: 1px solid #dbe4ef; border-radius: 12px; background: #f8fafc; }
.archive-preview-link { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 18px 20px; border: 1px solid #cfe4d9; border-radius: 16px; background: linear-gradient(135deg,#eef7f2,#fff); }
.archive-preview-link[hidden] { display: none; }
.archive-preview-link span { display: block; color: #5d8e76; font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.archive-preview-link b { display: block; margin-top: 4px; color: #3d405b; font-size: 14px; }
.archive-preview-link a { overflow: hidden; color: #c45d46; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.archive-preview-link i { font-style: normal; }
@media (max-width: 720px) {
  .archive-detail-head { flex-direction: column; }
  .archive-document { padding: 24px 18px; }
  .archive-deck { padding: 12px; }
  .archive-deck iframe { height: 58vh; }
  .archive-preview-link { align-items: flex-start; flex-direction: column; }
  .archive-preview-link a { width: 100%; white-space: normal; word-break: break-all; }
}
.projects-search {
  flex: 1;
  min-width: 200px;
}
.projects-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.82);
  font-size: 13px;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.projects-search input:focus {
  outline: none;
  border-color: rgba(44,99,214,.4);
  box-shadow: 0 0 0 4px rgba(44,99,214,.1);
}
.projects-filters {
  display: flex;
  gap: 10px;
}
.projects-filters select {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.82);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .2s;
}
.projects-filters select:focus {
  outline: none;
  border-color: rgba(44,99,214,.4);
}

/* 新建项目按钮 */
#newProjectBtn {
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── 项目卡片网格 ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 16px;
}

.project-card {
  position: relative;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #fbf7f1);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.project-card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 状态标识 */
.project-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.project-status.completed {
  background: var(--green-soft);
  color: var(--green);
}
.project-status.in_progress {
  background: var(--blue-soft);
  color: var(--blue);
}
.project-status.interrupted {
  background: #fde8e2;
  color: var(--danger);
}
.project-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 行业标签 */
.project-industry {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(237,106,67,.08);
  color: var(--orange-deep);
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* 阶段进度指示器 */
.project-stages {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.project-stage-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.project-stage-step.done {
  background: var(--green);
}
.project-stage-step.active {
  background: var(--blue);
}

/* 时间信息 */
.project-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

/* ── 项目详情面板 ── */
.project-detail {
  margin-top: 8px;
}
.project-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.project-detail-actions {
  display: flex;
  gap: 10px;
}
.project-detail-actions .danger {
  color: var(--danger);
  border-color: rgba(159,78,57,.3);
}
.project-detail-actions .danger:hover {
  background: #fde8e2;
}
.project-detail-body {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.4fr);
  gap: 24px;
}

/* 详情：基本信息 */
.project-detail-info {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #fbf7f1);
}
.project-detail-info h3 {
  font-size: 14px;
  margin: 0 0 16px;
  color: var(--ink);
}
.project-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.project-info-row:last-child {
  border-bottom: none;
}
.project-info-label {
  color: var(--muted);
  font-weight: 600;
}
.project-info-value {
  color: var(--ink);
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* 详情：产物树 */
.project-detail-artifacts {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #fbf7f1);
}
.project-detail-artifacts h3 {
  font-size: 14px;
  margin: 0 0 16px;
  color: var(--ink);
}
.artifact-stage {
  margin-bottom: 18px;
}
.artifact-stage-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}
.artifact-stage-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.artifact-stage-status.completed {
  background: var(--green-soft);
  color: var(--green);
}
.artifact-stage-status.in_progress {
  background: var(--blue-soft);
  color: var(--blue);
}
.artifact-stage-status.pending {
  background: #f0ece4;
  color: var(--muted);
}
.artifact-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-left: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.6);
  font-size: 11px;
  margin-bottom: 6px;
}
.artifact-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}
.artifact-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.artifact-file-actions {
  display: flex;
  gap: 6px;
}
.artifact-file-actions button {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.artifact-file-actions button:hover {
  color: var(--ink);
  border-color: var(--muted);
}

/* 响应式 */
@media (max-width: 900px) {
  .project-detail-body {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .projects-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .projects-filters {
    flex-direction: column;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .history-run { height: 330px; min-height: 330px; grid-template-columns: 104px minmax(0,1fr); }
  .project-detail-head {
    flex-direction: column;
    align-items: stretch;
  }
  .project-detail-actions {
    flex-direction: column;
  }
}
