/* CodeFlow · 明亮简洁设计系统 — 组件层 (基础变量见 base.css) */

/* ---------- 顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border-soft); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 60px;
  display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 16px; letter-spacing: -.2px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--acc); color: #fff; }
.brand-mark .ic { stroke-width: 2.2; }
.topnav { display: flex; gap: 2px; }
.topnav a { color: var(--muted); padding: 6px 12px; border-radius: var(--radius-sm); font-weight: 500; }
.topnav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--bg-muted); }
.top-search { flex: 1; max-width: 360px; position: relative; }
.top-search input { padding-left: 32px; background: var(--bg-soft); border-color: var(--border-soft); height: 34px; }
.top-search input:focus { background: #fff; }
.top-search .ic { position: absolute; left: 10px; top: 9px; color: var(--faint); }
.topbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn { position: relative; width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center;
  color: var(--muted); background: transparent; border: 1px solid transparent; cursor: pointer; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); border-color: var(--border-soft); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 8px; height: 8px; border-radius: 8px;
  background: var(--acc); border: 2px solid #fff; }

/* ---------- 下拉菜单 ---------- */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: #fff;
  border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; z-index: 80; display: none; }
.dropdown.open .menu { display: block; animation: pop .12s ease; }
.menu a, .menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px;
  border-radius: var(--radius-sm); color: var(--text); background: none; border: none; font: 14px var(--sans);
  cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--bg-soft); text-decoration: none; }
.menu .ic { color: var(--muted); }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.menu-sep { height: 1px; background: var(--border-soft); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- 头像 ---------- */
.avatar { width: 24px; height: 24px; border-radius: 50%; flex: none; display: inline-flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 600; color: #fff; vertical-align: middle;
  overflow: hidden; background-size: cover; background-position: center; box-shadow: 0 0 0 1px rgba(31,35,40,.08); }
.avatar.org { border-radius: 6px; }
.avatar.xs { width: 18px; height: 18px; font-size: 9px; }
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
.avatar.md { width: 32px; height: 32px; font-size: 13px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.avatar.xl { width: 260px; height: 260px; max-width: 100%; font-size: 96px; }
.avatar.xxl { width: 96px; height: 96px; font-size: 38px; }

/* ---------- 卡片 / 盒子 ---------- */
.card { background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; }
.card.flat { padding: 0; overflow: hidden; }
.card.hover { transition: border-color .15s, box-shadow .15s; }
.card.hover:hover { border-color: var(--border); box-shadow: var(--shadow-sm), 0 4px 14px rgba(31,35,40,.06); text-decoration: none; }
.box { border: 1px solid var(--border-soft); border-radius: var(--radius); background: #fff; overflow: hidden; }
.box + .box { margin-top: 16px; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px;
  background: var(--bg-soft); border-bottom: 1px solid var(--border-soft); font-weight: 600; flex-wrap: wrap; }
.box-head.plain { background: #fff; }
.box-body { padding: 16px; }
.box-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border-soft); }
.box-row:first-child { border-top: none; }
.box-row:hover { background: #fafaf8; }
.box-row.clickable { cursor: pointer; }
.box-row .grow { flex: 1; min-width: 0; }
.section-title { font-size: 16px; font-weight: 600; margin: 0 0 12px; }

/* ---------- 徽章 / 标签 ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; line-height: 18px;
  padding: 0 8px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); background: #fff; white-space: nowrap; }
.badge.green { color: var(--green); border-color: rgba(26,127,55,.3); background: var(--green-soft); }
.badge.purple { color: var(--purple); border-color: rgba(130,80,223,.3); background: var(--purple-soft); }
.badge.blue { color: var(--acc); border-color: rgba(59,91,219,.3); background: var(--acc-soft); }
.badge.red { color: var(--danger); border-color: rgba(207,34,46,.3); background: var(--danger-soft); }
.badge.yellow { color: var(--warn); border-color: rgba(154,103,0,.3); background: var(--warn-soft); }
.counter { display: inline-block; min-width: 20px; padding: 0 6px; font-size: 12px; font-weight: 500; line-height: 18px;
  text-align: center; border-radius: 20px; background: var(--bg-muted); color: var(--text); }
.label-pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; line-height: 20px;
  padding: 0 9px; border-radius: 20px; white-space: nowrap; border: 1px solid transparent; }
.topic { display: inline-block; font-size: 12px; font-weight: 500; line-height: 22px; padding: 0 10px;
  border-radius: 20px; background: var(--acc-soft); color: var(--acc); }
.topic:hover { background: var(--acc); color: #fff; text-decoration: none; }
.state-pill { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 30px; border-radius: 20px;
  color: #fff; font-weight: 500; font-size: 14px; }
.state-pill.open { background: var(--green); }
.state-pill.closed { background: var(--danger); }
.state-pill.merged { background: var(--purple); }
.state-pill.draft { background: var(--faint); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.status-dot.success { background: var(--green); }
.status-dot.failure { background: var(--danger); }
.status-dot.running { background: #d39b00; animation: pulse 1.1s infinite; }
.status-dot.pending { background: var(--faint); }
.status-dot.cancelled { background: #c4cbd3; }
@keyframes pulse { 50% { opacity: .35; } }
.st-success { color: var(--green); } .st-failure { color: var(--danger); } .st-running { color: #b07d00; }
.st-pending, .st-cancelled { color: var(--faint); }
.pill-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 分段切换 ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 30px; color: var(--muted);
  font: 500 13.5px var(--sans); background: none; border: none; border-left: 1px solid var(--border); cursor: pointer; }
.seg a:first-child, .seg button:first-child { border-left: none; }
.seg a:hover, .seg button:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.seg a.active, .seg button.active { background: var(--bg-muted); color: var(--text); font-weight: 600; }

/* ---------- 代码 / Diff ---------- */
.code-block { background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius);
  overflow: auto; font: 13px/1.6 var(--mono); padding: 14px 16px; white-space: pre; color: var(--text); }
.file-box { border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; background: #fff; }
.file-box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 8px 16px;
  background: var(--bg-soft); border-bottom: 1px solid var(--border-soft); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.file-view { overflow: auto; font: 12.5px/20px var(--mono); }
.file-view .loc { display: flex; }
.file-view .loc:hover { background: #f4f4f1; }
.file-view .loc.hl { background: #fff8c5; }
.file-view .ln { color: var(--faint); text-align: right; padding: 0 12px 0 16px; user-select: none; min-width: 56px; flex: none; cursor: pointer; }
.file-view .ln:hover { color: var(--acc); }
.file-view .lc { padding: 0 16px; white-space: pre; }
.diff-view { font: 12px/20px var(--mono); }
.diff-file { border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; background: #fff; }
.diff-head { background: var(--bg-soft); padding: 8px 16px; font-weight: 600; border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; gap: 10px; position: sticky; top: 60px; z-index: 2; }
.diff-head .stat { font-weight: 500; font-size: 12px; }
.diff-head .stat .a { color: var(--green); } .diff-head .stat .d { color: var(--danger); }
.diff-body { overflow-x: auto; }
.diff-line { display: flex; white-space: pre; min-width: max-content; }
.diff-line .dln { width: 50px; text-align: right; padding: 0 10px; color: var(--faint); user-select: none; flex: none; }
.diff-line .dtxt { padding: 0 12px; flex: 1; }
.diff-line.add { background: #e6ffec; } .diff-line.add .dln { background: #ccffd8; }
.diff-line.add .dtxt::before { content: "+"; color: var(--green); margin-right: 8px; }
.diff-line.del { background: #ffebe9; } .diff-line.del .dln { background: #ffd7d5; }
.diff-line.del .dtxt::before { content: "-"; color: var(--danger); margin-right: 8px; }
.diff-line.ctx .dtxt::before { content: " "; margin-right: 8px; }
.diff-line.hunk { background: #eaf3f8; color: var(--muted); } .diff-line.hunk .dln { background: #d5e7f1; }

/* ---------- 表格 ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 10px 16px;
  background: var(--bg-soft); border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
table.list td { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tr.rowlink { cursor: pointer; }
table.list tr.rowlink:hover td { background: #f4f4f1; }
table.files td { padding: 8px 16px; }
table.files td.msg { color: var(--muted); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.files td.age { color: var(--muted); text-align: right; white-space: nowrap; width: 120px; }
.file-icon { margin-right: 10px; display: inline-flex; vertical-align: -3px; }
.file-icon.dir { color: #5b8fd6; } .file-icon.dir .ic { fill: #5b8fd6; fill-opacity: .25; }
.file-icon.file { color: var(--faint); }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 12.5px; } .xsmall { font-size: 12px; }
.bold { font-weight: 600; } .nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-muted { color: var(--muted); } .link-muted:hover { color: var(--acc); text-decoration: none; }
.link-plain { color: var(--text); font-weight: 600; } .link-plain:hover { color: var(--acc); text-decoration: none; }

/* ---- 行级评论 ---- */
.diff-line.cmt .diff-cmt-btn { visibility: hidden; margin: 0 6px 0 auto; align-self: center; }
.diff-line.cmt:hover .diff-cmt-btn { visibility: visible; }
.diff-cmt-btn { background: none; border: none; color: var(--muted, #666); cursor: pointer; padding: 2px; border-radius: 4px; }
.diff-cmt-btn:hover { color: var(--primary, #1a7f37); background: rgba(0,0,0,.06); }
.diff-threads { border-left: 3px solid var(--border-soft, #d0d7de); margin: 2px 0 2px 100px; display: grid; gap: 6px; }
.diff-thread { background: var(--card-2, #f6f8fa); border: 1px solid var(--border-soft, #d0d7de); border-radius: 8px; padding: 8px 10px; }
.diff-thread.resolved { opacity: .6; }
.diff-thread-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }

/* ---- Blame 视图 ---- */
.blame-row { display: flex; align-items: baseline; white-space: pre; }
.blame-meta { display: inline-flex; gap: 8px; width: 220px; flex: none; padding: 0 10px; color: var(--muted, #57606a); text-decoration: none; border-right: 1px solid var(--border-soft, #d0d7de); overflow: hidden; }
.blame-meta:hover { color: var(--primary, #1a7f37); background: rgba(0,0,0,.04); }
.blame-user { overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.blame-ln { width: 50px; text-align: right; padding: 0 10px; color: var(--faint, #8c959f); user-select: none; flex: none; }
.blame-txt { padding: 0 12px; flex: 1; }
