/* vcs — product components. Built on design/system/components/bundle.css (ui-*);
   every value reads a token from design/system/tokens.json. Prefix: vcs-. */

/* App shell: sidebar + main column (system layout.md) */
.vcs-shell { display: flex; height: 100%; background: var(--bg); }
.vcs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vcs-topbar { height: var(--touch); flex-shrink: 0; padding: 0 var(--space-12) 0 var(--space-16); }
.vcs-topbar .ui-crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-body { flex: 1; min-height: 0; overflow: hidden; }
.vcs-page { max-width: var(--content-max); margin: 0 auto; padding: var(--space-28) var(--space-40) var(--space-48); display: flex; flex-direction: column; gap: var(--space-16); }
.vcs-page.is-wide { max-width: none; }
.vcs-row-hint { flex-shrink: 0; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }

/* Page heading: title + meta line */
.vcs-title { margin: 0; font: var(--font-page-title); color: var(--text); }
.vcs-title .vcs-num { color: var(--text-faint); font-weight: 400; }
.vcs-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-8); font-size: 13px; color: var(--text-muted); }
.vcs-meta b { font-weight: 500; color: var(--text); }
.vcs-desc { margin: 0; font: var(--font-body); color: var(--text-body); }

/* Toolbar line above a list or a file */
.vcs-bar { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }
.vcs-bar .ui-grow { flex: 1; }
.vcs-stat { display: inline-flex; align-items: center; gap: var(--space-4); font-size: 13px; color: var(--text-muted); text-decoration: none; }
.vcs-stat b { font-weight: 500; color: var(--text); }
.vcs-stat svg { width: 16px; height: 16px; }
.vcs-picker { display: inline-flex; align-items: center; gap: var(--space-6); min-height: var(--control-sm); padding: 0 var(--space-8); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg); color: var(--text); font: var(--font-ui); font-family: var(--font-mono); }
.vcs-picker svg { width: 14px; height: 14px; color: var(--text-muted); }
.vcs-picker .vcs-caret { font-family: var(--font-sans); font-size: 10px; color: var(--text-muted); }

/* Status mark: icon + word; icon carries colour, word stays text */
.vcs-state { display: inline-flex; align-items: center; gap: var(--space-4); font-size: 12px; }
.vcs-state svg { width: 16px; height: 16px; }
.vcs-ok { color: var(--status-ok); }
.vcs-fail { color: var(--error); }
.vcs-run { color: var(--accent); }
.vcs-wait { color: var(--text-faint); }

/* Bordered list (files, commits, PRs, issues, runs) */
.vcs-list { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.vcs-list-head { display: flex; align-items: center; gap: var(--space-8); min-height: 40px; padding: 0 var(--space-12); background: var(--bg-sidebar); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-muted); }
.vcs-list-head .ui-grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-list-head b { font-weight: 500; color: var(--text); }
.vcs-item { display: flex; align-items: center; gap: var(--space-10); min-height: var(--tree-row); padding: var(--space-4) var(--space-12); border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--text); text-decoration: none; }
.vcs-item:last-child { border-bottom: none; }
.vcs-item:hover { background: var(--bg-soft); color: var(--text); }
.vcs-item > svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); }
.vcs-item .vcs-name { width: 220px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-item .vcs-msg { flex: 1; min-width: 0; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-item .vcs-time { flex-shrink: 0; font-size: 12px; color: var(--text-faint); }
.vcs-item.is-two { align-items: flex-start; min-height: 56px; padding: var(--space-10) var(--space-12); }
.vcs-item.is-two > svg { margin-top: 1px; }
.vcs-two { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.vcs-two > b { font-weight: 400; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-two > span { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-side { flex-shrink: 0; display: flex; align-items: center; gap: var(--space-10); font-size: 12px; color: var(--text-faint); }
.vcs-side svg { width: 14px; height: 14px; }
.vcs-sha { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); padding: 1px var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.vcs-pr-open svg { color: var(--status-ok); }
.vcs-pr-merged svg { color: var(--tag-purple-text); }

/* Rendered Markdown (README, comments) */
.vcs-md { padding: var(--space-20) var(--space-28) var(--space-24); font: var(--font-body); color: var(--text-body); }
.vcs-md h2 { margin: 0 0 var(--space-8); font: var(--font-dialog-title); color: var(--text); }
.vcs-md h3 { margin: var(--space-20) 0 var(--space-6); font: var(--font-block-title); color: var(--text); }
.vcs-md p { margin: 0 0 var(--space-10); }
.vcs-md ul { margin: 0 0 var(--space-10); padding-left: var(--space-20); }
.vcs-md code { font-family: var(--font-mono); font-size: 13px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--code-inline); border-radius: var(--radius-sm); padding: 0 var(--space-4); }
.vcs-pre { margin: 0 0 var(--space-10); padding: var(--space-12) var(--space-14); background: var(--bg-soft); border-radius: var(--radius-md); font: 13px/1.6 var(--font-mono); color: var(--text); white-space: pre; overflow: hidden; }

/* Syntax colours: the system's syn-* tokens */
.syn-kw { color: var(--syn-kw); } .syn-fn { color: var(--syn-fn); } .syn-type { color: var(--syn-type); }
.syn-str { color: var(--syn-str); } .syn-num { color: var(--syn-num); } .syn-cmt { color: var(--syn-cmt); }
.syn-mac { color: var(--syn-macro); }

/* File view: gutter + code */
.vcs-blob { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.vcs-lines { font: 12.5px/20px var(--font-mono); padding: var(--space-8) 0; }
.vcs-ln { display: flex; }
.vcs-ln > i { width: 52px; flex-shrink: 0; padding-right: var(--space-12); box-sizing: border-box; text-align: right; font-style: normal; color: var(--text-faint); user-select: none; }
.vcs-ln > span { flex: 1; min-width: 0; white-space: pre; padding-right: var(--space-16); color: var(--text); }
.vcs-ln.is-picked { background: var(--accent-faint); box-shadow: inset 2px 0 0 var(--accent); }
.vcs-ln.is-picked > i { color: var(--accent); }

/* Diff */
.vcs-diff { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.vcs-diff + .vcs-diff { margin-top: var(--space-16); }
.vcs-diff-head { display: flex; align-items: center; gap: var(--space-8); min-height: 40px; padding: 0 var(--space-8) 0 var(--space-6); background: var(--bg-sidebar); border-bottom: 1px solid var(--line); font-size: 13px; }
.vcs-diff-head .vcs-path { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-plus { color: var(--diff-added-text); font-family: var(--font-mono); font-size: 12px; }
.vcs-minus { color: var(--diff-removed-text); font-family: var(--font-mono); font-size: 12px; }
.vcs-dl { display: flex; font: 12.5px/20px var(--font-mono); }
.vcs-dl > i { width: 44px; flex-shrink: 0; padding-right: var(--space-8); box-sizing: border-box; text-align: right; font-style: normal; color: var(--text-faint); user-select: none; }
.vcs-dl > s { width: 16px; flex-shrink: 0; text-decoration: none; text-align: center; color: var(--text-faint); user-select: none; }
.vcs-dl > span { flex: 1; min-width: 0; white-space: pre; color: var(--text); }
.vcs-dl.is-add { background: var(--diff-added); }
.vcs-dl.is-add > s, .vcs-dl.is-add > i { color: var(--diff-added-text); }
.vcs-dl.is-del { background: var(--diff-removed); }
.vcs-dl.is-del > s, .vcs-dl.is-del > i { color: var(--diff-removed-text); }
.vcs-dl ins { text-decoration: none; background: var(--diff-added-word); border-radius: var(--radius-xs); }
.vcs-dl del { text-decoration: none; background: var(--diff-removed-word); border-radius: var(--radius-xs); }
.vcs-dl.is-hunk { background: var(--accent-faint); color: var(--text-muted); }
.vcs-dl.is-hunk > span { color: var(--text-muted); }
.vcs-dl.is-picked { box-shadow: inset 2px 0 0 var(--accent); }
.vcs-inline { padding: var(--space-10) var(--space-12) var(--space-12) 104px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg); font-family: var(--font-sans); }

/* Files changed: file list beside the diff */
.vcs-split { display: flex; gap: var(--space-24); align-items: flex-start; }
.vcs-tree { width: 248px; flex-shrink: 0; }
.vcs-tree .ui-row-name { font-family: var(--font-mono); font-size: 12px; }
.vcs-grow { flex: 1; min-width: 0; }

/* Comment (conversation, inline review) */
.vcs-comment { display: flex; gap: var(--space-10); }
.vcs-comment-body { flex: 1; min-width: 0; }
.vcs-comment-head { display: flex; align-items: center; gap: var(--space-6); font-size: 13px; }
.vcs-comment-head b { font-weight: 600; }
.vcs-comment-head .vcs-time { font-size: 12px; color: var(--text-faint); }
.vcs-comment-text { margin-top: var(--space-4); font: var(--font-comment); color: var(--text-body); }
.vcs-card { border: 1px solid var(--line); border-radius: var(--radius-lg); }
.vcs-card > .vcs-md { padding: var(--space-14) var(--space-16) var(--space-16); font-size: 14px; }
.vcs-card-head { display: flex; align-items: center; gap: var(--space-8); min-height: 40px; padding: 0 var(--space-12) 0 var(--space-16); border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--text-muted); }
.vcs-card-head b { font-weight: 600; color: var(--text); }
.vcs-card-head .ui-grow { flex: 1; }

/* Timeline of a PR / issue */
.vcs-timeline { display: flex; flex-direction: column; gap: var(--space-16); position: relative; }
.vcs-event { display: flex; align-items: center; gap: var(--space-10); min-height: var(--control-sm); padding-left: var(--space-4); font-size: 13px; color: var(--text-muted); }
.vcs-event > .vcs-dot { width: var(--avatar-md); height: var(--avatar-md); flex-shrink: 0; border-radius: var(--radius-full); background: var(--bg-soft); display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.vcs-event > .vcs-dot svg { width: 14px; height: 14px; }
.vcs-event b { font-weight: 500; color: var(--text); }
.vcs-event .vcs-time { font-size: 12px; color: var(--text-faint); }

/* Merge box: checks + merge action */
.vcs-checks .vcs-item { min-height: 36px; }
.vcs-merge { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-14) var(--space-16); border-top: 1px solid var(--line); }
.vcs-merge .ui-grow { flex: 1; min-width: 0; font-size: 13px; color: var(--text-body); }
.vcs-merge .ui-grow b { display: block; font-weight: 500; color: var(--text); }
.vcs-merge .ui-grow span { font-size: 12px; color: var(--text-muted); }

/* Right rail with properties (PR / issue) */
.vcs-with-rail { display: flex; gap: var(--space-32); align-items: flex-start; }
.vcs-rail { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; }
.vcs-prop { padding: var(--space-12) 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: var(--space-8); }
.vcs-prop:first-child { padding-top: 0; }
.vcs-prop > .ui-sb-label { padding: 0; min-height: 0; }
.vcs-prop-val { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-6); font-size: 13px; color: var(--text); }
.vcs-prop-val.is-empty { color: var(--text-faint); }

/* Pipeline run: jobs + log */
.vcs-jobs { width: 248px; flex-shrink: 0; }
.vcs-log { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.vcs-step { display: flex; align-items: center; gap: var(--space-8); min-height: 36px; padding: 0 var(--space-12); border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.vcs-step .ui-grow { flex: 1; }
.vcs-step .vcs-time { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }
.vcs-step svg { width: 16px; height: 16px; }
.vcs-step .vcs-chev { width: 10px; height: 10px; color: var(--text-muted); }
.vcs-step.is-open .vcs-chev { transform: rotate(90deg); }
.vcs-loglines { padding: var(--space-8) 0; background: var(--bg-sidebar); border-bottom: 1px solid var(--line-soft); font: 12px/19px var(--font-mono); }
.vcs-loglines .vcs-ln > i { width: 48px; }
.vcs-loglines .vcs-ln > span { color: var(--text-body); }

/* Clone popover */
.vcs-clone { width: 360px; padding: var(--space-12); display: flex; flex-direction: column; gap: var(--space-10); }
.vcs-clone .ui-tabs-sm { margin: calc(var(--space-4) * -1) 0 0; }
.vcs-copy { display: flex; gap: var(--space-6); }
.vcs-copy .ui-btn { flex-shrink: 0; white-space: nowrap; }
.vcs-copy .ui-input { font-family: var(--font-mono); font-size: 12px; background: var(--bg-sidebar); }

/* Empty repository */
.vcs-empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-xl); padding: var(--space-24) var(--space-28); display: flex; flex-direction: column; gap: var(--space-12); }
.vcs-empty h2 { margin: 0; font: var(--font-block-title); color: var(--text); }
.vcs-empty p { margin: 0; font-size: 13px; color: var(--text-muted); }

/* Form rows on the new-repository page */
.vcs-form { display: flex; flex-direction: column; gap: var(--space-20); max-width: 560px; }
.vcs-field { display: flex; flex-direction: column; gap: var(--space-6); font-size: 13px; }
.vcs-field > span { font-weight: 500; }
.vcs-field > small { font-size: 12px; color: var(--text-muted); }
.vcs-inline-inputs { display: flex; align-items: center; gap: var(--space-8); }
.vcs-choice { display: flex; gap: var(--space-10); padding: var(--space-12); border: 1px solid var(--line); border-radius: var(--radius-lg); font-size: 13px; }
.vcs-choice.is-on { border-color: var(--accent); background: var(--accent-faint); }
.vcs-choice svg { width: 16px; height: 16px; color: var(--text-muted); margin-top: 1px; }
.vcs-choice b { display: block; font-weight: 500; }
.vcs-choice span { font-size: 12px; color: var(--text-muted); }
.vcs-radio { width: 16px; height: 16px; flex-shrink: 0; box-sizing: border-box; border-radius: var(--radius-full); border: 1px solid var(--line-strong); background: var(--bg); margin-top: 1px; }
.vcs-choice.is-on .vcs-radio { border: 5px solid var(--accent); }

/* Home: activity feed */
.vcs-feed .vcs-item { align-items: flex-start; padding: var(--space-12); }
.vcs-feed .ui-avatar { margin-top: 1px; }

/* Mobile */
.vcs-m-top { display: flex; align-items: center; gap: var(--space-2); min-height: var(--touch); padding: 0 var(--space-4); border-bottom: 1px solid var(--line); }
.vcs-m-top .ui-crumb { min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-m-body { padding: var(--space-16) var(--space-20) var(--space-24); display: flex; flex-direction: column; gap: var(--space-14); }
.vcs-m-title { margin: 0; font: var(--font-mobile-title); color: var(--text); }
.vcs-m-body .vcs-item { min-height: var(--mobile-row); font-size: 15px; padding: 0 var(--space-12); }
.vcs-m-body .vcs-item > svg { width: 20px; height: 20px; }
.vcs-m-body .vcs-item.is-two { min-height: 64px; padding: var(--space-12); }
.vcs-m-body .vcs-two > b { font-size: 15px; }
.vcs-m-body .ui-btn, .vcs-m-body .vcs-picker { min-height: var(--touch); font-size: 15px; }
.vcs-m-tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--line); padding: 0 var(--space-12); }
.vcs-m-tabs .ui-tab { min-height: var(--touch); font-size: 15px; }
.vcs-m-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: var(--space-8); padding: var(--space-10) var(--space-16) var(--space-24); background: var(--bg); border-top: 1px solid var(--line); }
.vcs-m-bar .ui-input { flex: 1; min-width: 0; min-height: var(--touch); font-size: 16px; }
.vcs-m-bar .ui-btn { flex-shrink: 0; min-height: var(--touch); font-size: 15px; padding: 0 var(--space-16); }
.vcs-m-diff .vcs-dl { font-size: 12px; line-height: 20px; }
.vcs-m-diff .vcs-dl > i { width: 34px; }

/* Tab row under the top bar (repository, organization, profile), GitHub-style */
.vcs-tabsbar { flex-shrink: 0; padding: 0 var(--space-16); }
.vcs-tabsbar .ui-tab svg { color: var(--text-muted); }
.vcs-m-scroll { overflow: hidden; white-space: nowrap; }

/* Pinned repository cards (organization overview, profile) */
.vcs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-12); }
.vcs-repo-card { padding: var(--space-12) var(--space-14); display: flex; flex-direction: column; gap: var(--space-8); }
.vcs-repo-card svg { color: var(--text-muted); }
.vcs-repo-name { font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcs-repo-card p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); min-height: 18px; }
.vcs-people { display: flex; flex-wrap: wrap; gap: var(--space-6); }

/* Organization / profile header */
.vcs-head { display: flex; align-items: center; gap: var(--space-20); }
.vcs-avatar-profile { width: var(--avatar-profile); height: var(--avatar-profile); font-size: 32px; font-weight: 500; }
.vcs-head .vcs-avatar-profile { border-radius: var(--radius-xl); }
.vcs-profile { display: flex; gap: var(--space-32); align-items: flex-start; }
.vcs-profile-side { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; gap: var(--space-12); }
.vcs-profile-name { margin: 0; font: var(--font-dialog-title); color: var(--text); }
.vcs-profile-bio { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-body); }
.vcs-profile-meta { display: flex; flex-direction: column; gap: var(--space-6); }

/* Contribution graph: 53 weeks x 7 days */
.vcs-heat-card { padding: var(--space-14) var(--space-16) var(--space-12); display: flex; flex-direction: column; gap: var(--space-10); }
.vcs-heat-wrap { display: flex; gap: var(--space-6); }
.vcs-heat-days { display: grid; grid-template-rows: repeat(7, var(--space-10)); gap: var(--space-2); margin-top: 18px; font-size: 10px; line-height: var(--space-10); color: var(--text-faint); }
.vcs-heat-months { position: relative; height: 18px; font-size: 11px; color: var(--text-faint); }
.vcs-heat-months > span { position: absolute; top: 0; white-space: nowrap; }
.vcs-heat { display: grid; grid-template-rows: repeat(7, var(--space-10)); grid-auto-flow: column; grid-auto-columns: var(--space-10); gap: var(--space-2); }
.vcs-heat i, .vcs-heat-legend i { display: block; width: var(--space-10); height: var(--space-10); border-radius: var(--radius-xs); }
.vcs-heat-0 { background: var(--heat-0); } .vcs-heat-1 { background: var(--heat-1); } .vcs-heat-2 { background: var(--heat-2); }
.vcs-heat-3 { background: var(--heat-3); } .vcs-heat-4 { background: var(--heat-4); }
.vcs-heat-foot { display: flex; align-items: center; gap: var(--space-6); font-size: 11px; color: var(--text-faint); }
.vcs-heat-foot .ui-grow { flex: 1; }
.vcs-heat-legend { display: inline-flex; gap: var(--space-2); }

/* Contribution activity */
.vcs-acts { display: flex; flex-direction: column; gap: var(--space-14); }
.vcs-act { display: flex; gap: var(--space-10); }
.vcs-act > .vcs-dot { width: var(--avatar-md); height: var(--avatar-md); flex-shrink: 0; border-radius: var(--radius-full); background: var(--bg-soft); display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.vcs-act > .vcs-dot svg { width: 14px; height: 14px; }
.vcs-act-text { font-size: 13px; line-height: var(--avatar-md); color: var(--text); }
.vcs-act-bar { display: flex; align-items: center; gap: var(--space-10); margin-top: var(--space-6); font-size: 12px; }
.vcs-act-bar > a { width: 200px; flex-shrink: 0; }
.vcs-act-bar > .ui-faint { width: 72px; flex-shrink: 0; }
.vcs-act-bar > .ui-progress { max-width: 280px; }

/* Branches: ahead / behind, latest release card */
.vcs-ab { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.vcs-release { padding: var(--space-12) var(--space-14); display: flex; flex-direction: column; gap: var(--space-8); font-size: 13px; }
.vcs-release b { font-weight: 600; }
.vcs-release ul { margin: 0; padding-left: var(--space-20); color: var(--text-body); line-height: 1.7; }
.vcs-assets { margin: 0 calc(var(--space-14) * -1) calc(var(--space-12) * -1); border-top: 1px solid var(--line); }
.vcs-assets .vcs-item { font-size: 12px; }

/* Branch protection: rule list above the rule form */
.vcs-rules { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-20); }
.vcs-rules .ui-row { gap: var(--space-8); }
