* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: #f5f6fa; color: #333; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: #fff; padding: 40px; border-radius: 8px; width: 360px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.login-card h2 { margin-bottom: 24px; text-align: center; }
.login-card input { width: 100%; padding: 10px; margin-bottom: 14px; border: 1px solid #dcdfe6; border-radius: 4px; }
.login-card button { width: 100%; padding: 10px; border: none; border-radius: 4px; background: #409eff; color: #fff; font-size: 15px; cursor: pointer; }
.error { color: #f56c6c; font-size: 13px; margin-top: 8px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar input { padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; width: 240px; }
.toolbar input.id-input { width: 130px; }
button { padding: 8px 14px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; cursor: pointer; }
button.primary { background: #0669ff; border-color: #0669ff; color: #fff; }
button.link-btn { border: none; background: none; color: #0669ff; padding: 0 4px; }
button.link-btn.danger { color: #f56c6c; }
button:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px; border-bottom: 1px solid #ebeef5; text-align: left; }
th { background: #fafafa; }
/* 发现列表：问题标题单行省略（完整内容进 title 悬浮展示），修复状态/报告时间格不换行 */
.finding-title { display: inline-block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.finding-nowrap { white-space: nowrap; }
/* 分页：上一页/页码列表/下一页 + 页码输入跳转（js/pager.js 渲染） */
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pager button { padding: 6px 10px; font-size: 13px; }
.pager .pager-num { min-width: 32px; padding: 6px 6px; }
.pager .pager-num.active { background: #0669ff; border-color: #0669ff; color: #fff; }
.pager-ellipsis { color: #909399; font-size: 13px; padding: 0 2px; }
.pager-info { color: #8aa0b4; font-size: 13px; margin-left: 8px; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; color: #8aa0b4; font-size: 13px; margin-left: 8px; }
.pager-jump input { width: 64px; padding: 5px 4px; border: 1px solid #dcdfe6; border-radius: 4px; text-align: center; }

dialog { border: none; border-radius: 8px; padding: 24px; width: 420px; margin: auto; }
dialog::backdrop { background: rgba(0,0,0,.3); }
dialog label { display: block; margin-bottom: 12px; font-size: 14px; }
dialog input, dialog textarea, dialog select { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #dcdfe6; border-radius: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
/* 作者样式 dialog label{display:block} 会覆盖 UA 的 [hidden]，显式兜底 */
dialog [hidden] { display: none !important; }

/* 仓库编辑弹窗：加宽两列布局；评审重点整行占满并加高 */
#repo-dialog { width: 820px; max-width: 94vw; max-height: 90vh; overflow-y: auto; }
.repo-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; align-items: start; }
.repo-form .form-span { grid-column: 1 / -1; }
.repo-form h3 { margin: 0 0 16px; }
.repo-form label { margin-bottom: 12px; }
.repo-form .hints-field textarea { min-height: 170px; resize: vertical; line-height: 1.6; font-family: inherit; }
.hints-head { display: flex; justify-content: space-between; align-items: baseline; }
.char-count { color: #909399; font-size: 12px; font-weight: normal; }
.repo-enable-field { padding-top: 24px; }

/* ===== 后台布局 ===== */
.topbar { display: flex; justify-content: space-between; align-items: center; height: 56px; padding: 0 20px; background: #1f2d3d; color: #fff; }
.topbar-title { font-size: 16px; font-weight: bold; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar-user .link-btn { color: #cfd8e3; }
.topbar-user .link-btn:hover { color: #fff; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 220px; flex-shrink: 0; background: #263445; color: rgba(255,255,255,.65); }
.menu-title { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; cursor: pointer; font-size: 14px; color: rgba(255,255,255,.85); }
.menu-title:hover { background: rgba(255,255,255,.06); }
.menu-arrow { font-size: 12px; transition: transform .2s; }
.menu-group.open .menu-arrow { transform: rotate(180deg); }
.menu-sub { display: none; }
.menu-group.open .menu-sub { display: block; }
.menu-item { padding: 12px 18px 12px 32px; cursor: pointer; font-size: 14px; }
.menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-item.active { background: #0669ff; color: #fff; }

.content { flex: 1; padding: 16px 20px; min-width: 0; }
.breadcrumb { font-size: 13px; color: #999; margin-bottom: 12px; }
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.placeholder-tip { color: #999; text-align: center; padding: 60px 0; font-size: 14px; }
.empty-cell { text-align: center; color: #999; padding: 24px 0; }
/* 只读态/功能关闭提示（如 app.agent.enabled=false 时任务页的说明） */
.hint { color: #909399; font-size: 13px; margin: 0 0 12px; }
/* 全局提示弹窗 */
.msg-title { margin: 0 0 12px; color: #f55f4e; font-size: 16px; }
.msg-text { margin: 0 0 8px; font-size: 14px; line-height: 1.7; word-break: break-all; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 3px; font-size: 12px; }
.tag-on { color: #46db7a; background: rgba(70,219,122,.1); }
.tag-off { color: #f55f4e; background: rgba(245,95,78,.1); }
.tag-doing { color: #e6a23c; background: rgba(230,162,60,.12); }
dialog .checkbox-label input { width: auto; margin-right: 6px; }
/* 用户弹窗较宽：容纳仓库权限范围两列勾选（其余弹窗保持 420 紧凑） */
#create-dialog, #edit-dialog { width: 560px; max-width: 92vw; }
/* 仓库权限范围多选框：纵向滚动列表，选项按可用宽度自适应排布 */
.repo-scope-box { max-height: 140px; overflow-y: auto; border: 1px solid #dcdfe6; border-radius: 4px; padding: 6px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 12px; }
.repo-scope-box label.checkbox-label { display: flex; align-items: center; min-width: 0; font-weight: normal; }
.repo-scope-box label.checkbox-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 评审报告详情信息表（两列布局：每行左右各一组字段） */
.info-table { width: 100%; table-layout: fixed; }
.info-table td { padding: 4px 10px; vertical-align: top; }
.info-table .info-label { width: 90px; color: #8aa0b4; white-space: nowrap; }
.info-table .info-value { word-break: normal; overflow-wrap: break-word; }
/* 左值列定宽收纳短字段（仓库/分支/引擎等），剩余宽度全给右值列的长文本（提交说明等）——
   均分 50% 会让只有短值的左侧大片留白 */
.info-table .info-value:nth-child(2) { width: 300px; }

/* 报告详情·评审发现表：固定布局列定宽，问题标题吃剩余宽度——
   auto 布局下长标题会抢走全部空间，把右侧短列挤成表头/标签逐字换行 */
.detail-findings { table-layout: fixed; }
.detail-findings th { white-space: nowrap; }
.detail-findings th:nth-child(1), .detail-findings td:nth-child(1) { width: 44px; }
.detail-findings th:nth-child(3), .detail-findings td:nth-child(3),
.detail-findings th:nth-child(4), .detail-findings td:nth-child(4) { width: 100px; }
.detail-findings th:nth-child(5), .detail-findings td:nth-child(5),
.detail-findings th:nth-child(6), .detail-findings td:nth-child(6) { width: 104px; }
.detail-findings th:nth-child(7), .detail-findings td:nth-child(7) { width: 110px; }
.detail-findings th:nth-child(8), .detail-findings td:nth-child(8) { width: 136px; }
.detail-findings td:nth-child(n+3) { white-space: nowrap; }

/* 评审发现展开行 */
.finding-detail-cell { background: #f6f9fc; padding: 10px 14px; font-size: 13px; color: #556; }
.finding-detail-block { margin: 4px 0; line-height: 1.7; }
.finding-detail-label { display: inline-block; color: #8aa0b4; margin-right: 10px; }
/* 缺陷说明分区块 */
.desc-blocks { margin-top: 4px; }
.desc-block { display: flex; align-items: flex-start; gap: 8px; background: #fff; border: 1px solid #e4ecf3; border-left: 3px solid #4a90d9; border-radius: 4px; padding: 8px 12px; margin: 6px 0; }
.desc-tag { flex: none; background: #eaf2fb; color: #3a76b8; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 3px; line-height: 1.8; }
.desc-body { flex: 1; word-break: break-all; line-height: 1.7; color: #445; }
.desc-empty { color: #999; }

/* 首页 */
.home-welcome h2 { margin: 4px 0 6px; }
.home-sub { color: #8aa0b4; }
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 14px; }
.stat-card { background: #fff; border: 1px solid #e4ecf3; border-radius: 6px; padding: 18px 16px; }
.stat-card[onclick] { cursor: pointer; }
.stat-card[onclick]:hover { border-color: #0669ff; }
.stat-num { font-size: 26px; font-weight: 600; }
.stat-label { color: #8aa0b4; margin-top: 4px; font-size: 13px; }
.stat-red .stat-num { color: #f55f4e; }
.stat-amber .stat-num { color: #e6a23c; }
.stat-green .stat-num { color: #46db7a; }

/* Agent 评审任务 */
.tag-neutral { color: #909399; background: rgba(144,147,153,.12); }
.log-box { max-height: 420px; overflow: auto; background: #14161a; color: #d5d9e0; padding: 12px; font-family: Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; border-radius: 6px; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; color: #8a94a6; }

/* 全局加载遮罩（长耗时接口，如管理员"全部评审"全仓扫描）：覆盖全屏阻断重复点击 */
.loading-mask { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); }
.loading-mask[hidden] { display: none; }
.loading-box { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 8px; padding: 18px 26px; box-shadow: 0 6px 24px rgba(0,0,0,.2); font-size: 14px; color: #445; max-width: 70vw; }
.loading-spinner { width: 22px; height: 22px; flex: none; border: 3px solid #cfe0ff; border-top-color: #0669ff; border-radius: 50%; animation: loading-spin .8s linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }

/* 首页图表 */
.chart-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.chart-card h3 { margin: 0 0 8px; font-size: 14px; color: #445; }
.chart-box { width: 100%; height: 300px; }
@media (max-width: 1200px) { .chart-grid { grid-template-columns: 1fr; } }

/* 仓库分支配置弹窗 */
#branch-dialog { min-width: 640px; }
.branch-table { width: 100%; }
.branch-table td, .branch-table th { padding: 6px 8px; }
.branch-add-bar { margin-top: 12px; }
.branch-add-bar input[type=text] { width: 240px; }
