/* ===== 全局 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f4f6f9;
  color: #333;
  font-size: 14px;
}
.hidden { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 20px; color: #d94f3d; }
.topbar nav { display: flex; gap: 8px; flex: 1; }
.nav-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
  color: #555;
  transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}
.nav-btn:hover { background: #f0f2f5; }
.nav-btn.active { background: #d94f3d; color: #fff; box-shadow: 0 2px 8px rgba(217,79,61,.25); }

/* ===== 按钮 ===== */
.btn {
  padding: 7px 16px;
  border: 1px solid #d0d5dd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.btn:hover { border-color: #d94f3d; color: #d94f3d; }
.btn-primary {
  background: #d94f3d;
  border-color: #d94f3d;
  color: #fff;
}
.btn-primary:hover { background: #c2402f; color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-danger:hover { border-color: #e02424; color: #e02424; }

/* ===== 视图容器 ===== */
.view { padding: 20px 24px; max-width: 1280px; margin: 0 auto; }
.view-wide { max-width: 1720px; }

/* ===== 视图切换动画 ===== */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-animate-in {
  animation: viewFadeIn .25s ease-out both;
}

/* Bug 列表：左侧项目栏 + 右侧列表（两列等高拉伸，底部对齐） */
.view-with-sidebar { display: flex; gap: 16px; align-items: stretch; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-main .pager { margin-top: auto; }
.list-main .bug-table { margin-bottom: 12px; }

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.filter-bar input, .filter-bar select {
  padding: 7px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: #d94f3d; }
#fKeyword { width: 220px; }
#fAssignee { width: 120px; }

/* ===== 表格 ===== */
.bug-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.bug-table th, .bug-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eef0f3;
}
.bug-table th { background: #fafbfc; font-weight: 600; color: #555; white-space: nowrap; }
.bug-table tbody tr { height: 43px; }
.bug-table tbody tr:hover { background: #fdf6f5; }
.bug-table tbody tr.filler-row:hover, .bug-table tbody tr.empty-row:hover { background: transparent; }
.empty-row td { text-align: center; color: #999; }
.bug-title-cell { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seq-col { width: 56px; text-align: center; color: #888; }
.empty-tip { text-align: center; color: #999; padding: 40px 0; }

/* ===== 分页栏 ===== */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  margin-top: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.pager-total { color: #888; font-size: 13px; margin-right: auto; }
.pager-size {
  padding: 5px 8px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.pager-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #d0d5dd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #444;
  transition: all .15s;
}
.pager-btn:hover:not(:disabled) { border-color: #d94f3d; color: #d94f3d; }
.pager-btn.active { background: #d94f3d; border-color: #d94f3d; color: #fff; }
.pager-btn:disabled { color: #bbb; cursor: not-allowed; background: #f7f8fa; }
.pager-ellipsis { color: #999; padding: 0 2px; }

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
}
.sev-CRITICAL { background: #fde8e8; color: #c81e1e; }
.sev-HIGH     { background: #fef3e2; color: #c2710c; }
.sev-MEDIUM   { background: #e8f1fd; color: #1a56db; }
.sev-LOW      { background: #eef2f5; color: #64748b; }

.pri-URGENT { background: #fde8e8; color: #c81e1e; }
.pri-HIGH   { background: #fef3e2; color: #c2710c; }
.pri-MEDIUM { background: #e8f1fd; color: #1a56db; }
.pri-LOW    { background: #eef2f5; color: #64748b; }

.st-NEW         { background: #e8f1fd; color: #1a56db; }
.st-IN_PROGRESS { background: #fef3e2; color: #c2710c; }
.st-RESOLVED    { background: #e6f6ec; color: #05803c; }
.st-CLOSED      { background: #eef2f5; color: #64748b; }

.proj-tag   { background: #f3e8fd; color: #7e22ce; }
.proj-count { background: #e8f1fd; color: #1a56db; font-weight: 600; }
.proj-count.zero { background: #eef2f5; color: #94a3b8; font-weight: 400; }

/* 文档库：分类标签配色 */
.doc-cat-REQUIREMENT { background: #e8f1fd; color: #1a56db; }
.doc-cat-DESIGN      { background: #f3e8fd; color: #7e22ce; }
.doc-cat-TEST        { background: #e6f7ee; color: #05803c; }
.doc-cat-MANUAL      { background: #fef3e2; color: #c2710c; }
.doc-cat-MEETING     { background: #fdf0e8; color: #b45309; }
.doc-cat-OTHER       { background: #eef2f5; color: #64748b; }

/* 版本历史：最新版本标记与弹窗内表格 */
.doc-latest { background: #e6f7ee; color: #05803c; font-size: 12px; }
.doc-his-table { margin-top: 12px; }

/* 测试用例：执行状态标签配色 */
.cs-NOT_RUN { background: #eef2f5; color: #64748b; }
.cs-PASS    { background: #e6f7ee; color: #05803c; }
.cs-FAIL    { background: #fde8e8; color: #c81e1e; }
.cs-BLOCKED { background: #fef3e2; color: #c2710c; }

/* 测试用例：优先级标签配色 */
.cp-P0 { background: #fde8e8; color: #c81e1e; }
.cp-P1 { background: #fdf0e8; color: #e8705f; }
.cp-P2 { background: #e8f1fd; color: #1a56db; }
.cp-P3 { background: #eef2f5; color: #94a3b8; }

/* 需求管理：状态标签 */
.rs-DRAFT      { background: #eef2f5; color: #64748b; }
.rs-REVIEWING  { background: #fef3e2; color: #c2710c; }
.rs-APPROVED   { background: #e8f1fd; color: #1a56db; }
.rs-IN_PROGRESS{ background: #f3e8fd; color: #7e22ce; }
.rs-COMPLETED  { background: #e6f7ee; color: #05803c; }
.rs-REJECTED   { background: #fde8e8; color: #c81e1e; }

/* ===== 用例导入弹窗 ===== */
.import-steps p { margin-bottom: 12px; color: #444; line-height: 1.8; }
.import-steps .btn-sm { margin-left: 8px; }
.import-steps input[type="file"] { display: block; margin-top: 6px; font-size: 13px; }
.import-preview { max-height: 320px; overflow: auto; border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px; margin-top: 4px; }
.import-preview .bug-table td { white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.import-row-error td { background: #fde8e8; }
.import-error-text { color: #c81e1e; }

/* ===== 用例详情弹窗：与新建表单一致的展现 ===== */
.detail-field { display: block; margin-bottom: 12px; font-weight: 600; color: #444; font-size: 14px; }
.detail-field-box {
  margin-top: 5px;
  padding: 8px 10px;
  border: 1px solid #e3e7ee;
  border-radius: 6px;
  background: #f8f9fa;
  font-size: 14px;
  font-weight: 400;
  color: #333;
  min-height: 36px;
}
.detail-field-multi { white-space: pre-wrap; min-height: 64px; }
.detail-section-title {
  margin: 18px 0 12px;
  padding-top: 14px;
  border-top: 1px dashed #e0e3e8;
  font-weight: 600;
  font-size: 13px;
  color: #d94f3d;
}

/* ===== 左侧项目栏 ===== */
.proj-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
}
.proj-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #eef0f3;
  font-weight: 600;
  color: #555;
}
.proj-add-btn {
  width: 24px;
  height: 24px;
  border: 1px dashed #d0d5dd;
  border-radius: 6px;
  background: transparent;
  color: #888;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
}
.proj-add-btn:hover { border-color: #d94f3d; color: #d94f3d; }
.proj-list { list-style: none; padding: 8px; overflow-y: auto; flex: 1; }
.proj-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: #444;
  transition: background .15s;
}
.proj-item:hover { background: #f5f6f8; }
.proj-item.active { background: #fdeeec; color: #d94f3d; font-weight: 600; }
.proj-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-item-count {
  font-size: 12px;
  background: #e8f1fd;
  color: #1a56db;
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 600;
  flex-shrink: 0;
}
.proj-item-count.zero { background: #eef2f5; color: #94a3b8; font-weight: 400; }
/* 悬停时计数换成编辑/删除操作 */
.proj-item-ops { display: none; gap: 2px; flex-shrink: 0; }
.proj-item:hover .proj-item-count { display: none; }
.proj-item:hover .proj-item-ops { display: flex; }
.proj-item-ops button {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #888;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.proj-item-ops button:hover { background: #fff; color: #d94f3d; }
.proj-list-empty { padding: 14px 10px; color: #aaa; font-size: 13px; text-align: center; list-style: none; }

/* 侧栏分页（固定贴底，与右侧分页栏底部对齐） */
.proj-pager {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #eef0f3;
  margin-top: auto;
}
.proj-pager select {
  flex: 1;
  min-width: 0;
  padding: 4px 4px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  color: #555;
}
.proj-pager button {
  width: 24px;
  height: 24px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #555;
  line-height: 1;
  transition: all .15s;
}
.proj-pager button:hover:not(:disabled) { border-color: #d94f3d; color: #d94f3d; }
.proj-pager button:disabled { color: #ccc; cursor: not-allowed; }
#projPageInfo { font-size: 12px; color: #777; min-width: 28px; text-align: center; }

/* ===== 操作列 ===== */
.op-cell { white-space: nowrap; display: flex; gap: 6px; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}
.modal-mask.modal-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.modal-mask.modal-visible .modal {
  transform: scale(1);
  opacity: 1;
}
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  transform: scale(.92);
  opacity: 0;
  transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .25s ease;
}
.modal-sm { width: 400px; }
.modal-lg { width: 760px; }
.modal-lg textarea { min-height: 120px; }
.modal h2 { font-size: 17px; margin-bottom: 16px; }
.modal label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: #444;
}
.modal input[type=text], .modal textarea, .modal select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  outline: none;
}
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: #d94f3d; }
.form-row { display: flex; gap: 14px; }
.form-row label { flex: 1; }
.form-row .detail-field { flex: 1; }
.required { color: #e02424; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.trans-info { margin-bottom: 14px; color: #666; }

/* ===== 图片上传区 ===== */
.image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.image-add-box {
  width: 96px;
  height: 96px;
  border: 2px dashed #d0d5dd;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  transition: all .15s;
  user-select: none;
}
.image-add-box:hover { border-color: #d94f3d; color: #d94f3d; }
.image-add-icon { font-size: 26px; line-height: 1; font-weight: 300; }
.image-add-text { font-size: 12px; margin-top: 4px; font-weight: 400; }
.image-item {
  position: relative;
  width: 96px;
  height: 96px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafbfc;
  overflow: hidden;
}
/* 缩略图按原始宽高比完整展示，不裁切 */
.image-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}
.image-item.uploading::after {
  content: '上传中…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.75);
  font-size: 12px;
  color: #666;
}
.image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
.image-remove:hover { background: #e02424; }

/* 大图预览：按原比例完整展示 */
.img-preview-large {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 8px;
  cursor: zoom-out;
  background: #fff;
}

/* ===== Bug 详情 ===== */
.detail-row {
  display: flex;
  margin-bottom: 12px;
  font-size: 14px;
}
.detail-label {
  width: 90px;
  flex-shrink: 0;
  color: #888;
  font-weight: 600;
}
.detail-value { color: #333; word-break: break-all; }
.detail-desc {
  white-space: pre-wrap;
  background: #f8f9fa;
  border: 1px solid #eef0f2;
  border-radius: 6px;
  padding: 10px 12px;
  line-height: 1.6;
  max-height: 220px;
  overflow-y: auto;
}
.detail-empty { color: #aaa; }

/* ===== 统计看板 ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-card .num { font-size: 28px; font-weight: 700; }
.stat-card .label { color: #777; margin-top: 4px; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.chart-box {
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.chart-box h3 { font-size: 15px; margin-bottom: 14px; color: #444; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bar-label { width: 70px; text-align: right; color: #666; font-size: 13px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #f0f2f5; border-radius: 4px; height: 20px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #e8705f, #d94f3d);
  border-radius: 4px;
  transition: width .4s;
  min-width: 2px;
}
.bar-fill.zero { background: transparent; }
.bar-count { width: 36px; font-size: 13px; color: #444; }

/* ===== 项目 Bug 汇总分析（可折叠，默认收起避免撑高页面） ===== */
.proj-summary { margin-top: 16px; }
.proj-summary > summary {
  font-size: 15px;
  color: #444;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  list-style: none;
}
.proj-summary > summary::-webkit-details-marker { display: none; }
.proj-summary > summary::before { content: '▸'; margin-right: 8px; color: #999; transition: transform .15s; display: inline-block; }
.proj-summary[open] > summary::before { transform: rotate(90deg); }
.proj-summary > summary:hover { color: #1a56db; }
.proj-summary .summary-hint { font-size: 12px; font-weight: 400; color: #aaa; margin-left: 10px; }
.proj-summary[open] > summary { margin-bottom: 12px; }
.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.stack-fill {
  display: flex;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  min-width: 2px;
}
.chart-empty { color: #aaa; text-align: center; padding: 20px 0; font-size: 13px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: rgba(40,40,40,.9);
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  z-index: 200;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.error { background: rgba(200,30,30,.92); }
