/* simplehub's stylesheet: a Primer (github.com) approximation. Design tokens
   and component names follow GitHub's so the UI reads the same - State pills,
   UnderlineNav, Box, Counter, timeline - in both color schemes. Self-contained;
   nothing is fetched from the layers below. */

:root {
  --canvas: #ffffff;
  --canvas-subtle: #f6f8fa;
  --canvas-inset: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --border: #d1d9e0;
  --border-muted: #d8dee4;
  --accent: #0969da;
  --accent-emphasis: #0969da;
  --success-fg: #1a7f37;
  --success-emphasis: #1f883d;
  --danger-fg: #cf222e;
  --danger-emphasis: #cf222e;
  --done-fg: #8250df;
  --done-emphasis: #8250df;
  --attention-fg: #9a6700;
  --neutral-muted: rgba(175, 184, 193, 0.2);
  --add-bg: #e6ffec;
  --del-bg: #ffebe9;
  --hunk-bg: #ddf4ff;
  --header-bg: #f6f8fa;
  --shadow: 0 1px 0 rgba(31, 35, 40, 0.04);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0d1117;
    --canvas-subtle: #151b23;
    --canvas-inset: #010409;
    --fg: #f0f6fc;
    --fg-muted: #9198a1;
    --border: #3d444d;
    --border-muted: #30363d;
    --accent: #4493f8;
    --accent-emphasis: #1f6feb;
    --success-fg: #3fb950;
    --success-emphasis: #238636;
    --danger-fg: #f85149;
    --danger-emphasis: #da3633;
    --done-fg: #ab7df8;
    --done-emphasis: #8957e5;
    --attention-fg: #d29922;
    --neutral-muted: rgba(110, 118, 129, 0.4);
    --add-bg: rgba(46, 160, 67, 0.15);
    --del-bg: rgba(248, 81, 73, 0.15);
    --hunk-bg: rgba(56, 139, 253, 0.15);
    --header-bg: #010409;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 12px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.dim { color: var(--fg-muted); }
.small { font-size: 12px; }
.inline { display: inline; }
.narrow { max-width: 640px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.octicon { vertical-align: text-bottom; flex-shrink: 0; }
.c-open { color: var(--success-fg); }
.c-closed { color: var(--danger-fg); }
.c-merged { color: var(--done-fg); }
.c-done { color: var(--done-fg); }

/* ---- app header -------------------------------------------------------- */
.AppHeader {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-muted);
}
.AppHeader-logo { color: var(--fg); display: flex; }
.AppHeader-logo .mark { width: 32px; height: 32px; }
.AppHeader-context { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.AppHeader-context a { color: var(--fg); }
.crumb-sep { color: var(--fg-muted); }
.crumb-strong { font-weight: 600; }
.AppHeader-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.btn-invisible {
  background: none; border: none; color: var(--fg-muted); cursor: pointer;
  font: inherit; font-size: 12px; padding: 0;
}
.btn-invisible:hover { color: var(--accent); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 600; line-height: 1;
  vertical-align: middle; flex-shrink: 0;
}

.site-footer {
  max-width: 1216px; margin: 40px auto 0; padding: 24px 32px;
  color: var(--fg-muted); font-size: 12px; border-top: 1px solid var(--border-muted);
  display: flex; align-items: center; gap: 8px;
}
.site-footer .mark { width: 20px; height: 20px; }

/* ---- underline nav ------------------------------------------------------ */
.UnderlineNav {
  display: flex; gap: 4px; align-items: center;
  padding: 0 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-muted);
  overflow-x: auto;
}
.UnderlineNav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: -1px;
  color: var(--fg); font-size: 14px; line-height: 30px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.UnderlineNav-item:hover { text-decoration: none; border-bottom-color: var(--border); }
.UnderlineNav-item.selected { font-weight: 600; border-bottom-color: #fd8c73; }
.Counter {
  display: inline-block; min-width: 20px; padding: 0 6px;
  font-size: 12px; font-weight: 500; line-height: 18px; text-align: center;
  background: var(--neutral-muted); border-radius: 2em; color: var(--fg);
}

.container { max-width: 1216px; margin: 0 auto; padding: 24px 32px; }
.page-title { font-size: 20px; }
.section-title { font-size: 16px; margin: 24px 0 8px; }
.section-title.danger { color: var(--danger-fg); }

/* ---- Box ---------------------------------------------------------------- */
.Box { border: 1px solid var(--border); border-radius: 6px; background: var(--canvas); }
.Box-header {
  padding: 8px 16px; background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0;
  font-weight: 600;
}
.Box-body { padding: 16px; }
.Box-danger { border-color: var(--danger-fg); }
.Box > :last-child { border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }

.blankslate { padding: 48px 32px; text-align: center; }
.blankslate h2 { font-size: 20px; margin-bottom: 4px; }

.flash-error {
  border: 1px solid var(--danger-fg); border-radius: 6px; padding: 12px 16px;
  color: var(--danger-fg); margin: 12px 0;
}

/* ---- buttons & forms ------------------------------------------------------- */
.btn, button.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 16px; min-height: 32px;
  font: inherit; font-weight: 500; line-height: 20px;
  color: var(--fg); background: var(--canvas-subtle);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--border-muted); text-decoration: none; }
.btn-sm { padding: 3px 12px; min-height: 26px; font-size: 12px; }
.btn-primary, button.btn-primary {
  color: #fff; background: var(--success-emphasis); border-color: rgba(31, 35, 40, 0.15);
}
.btn-primary:hover { background: var(--success-fg); }
.btn-merge, button.btn-merge {
  color: #fff; background: var(--success-emphasis); border-color: rgba(31, 35, 40, 0.15);
}
.btn-merge:hover { background: var(--success-fg); }
.btn-danger, button.btn-danger { color: var(--danger-fg); }
.btn-danger:hover { color: #fff; background: var(--danger-emphasis); border-color: var(--danger-emphasis); }

input, textarea, select {
  padding: 5px 12px; min-height: 32px;
  font: inherit; color: var(--fg);
  background: var(--canvas); border: 1px solid var(--border); border-radius: 6px;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent-emphasis);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}
textarea { width: 100%; resize: vertical; font-family: inherit; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 12px; }
.form-stack input { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.repo-new { display: flex; gap: 8px; }

/* ---- State pills ---------------------------------------------------------- */
.State {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 2em;
  color: #fff; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.State--open { background: var(--success-emphasis); }
.State--closed { background: var(--danger-emphasis); }
.State--merged { background: var(--done-emphasis); }
.State--issue-closed { background: var(--done-emphasis); }
.Label {
  display: inline-block; padding: 0 7px; margin-left: 4px;
  font-size: 12px; font-weight: 500; line-height: 18px;
  border: 1px solid var(--border); border-radius: 2em; color: var(--fg-muted);
}
.Label-danger { color: var(--danger-fg); border-color: var(--danger-fg); }

/* ---- issue / repo list rows -------------------------------------------------- */
.list-filter { display: flex; gap: 16px; font-weight: 400; }
.list-filter a, .list-filter .on { color: var(--fg-muted); display: inline-flex; align-items: center; gap: 6px; }
.list-filter a.on, .list-filter .on { color: var(--fg); font-weight: 600; }

.issue-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 16px; border-bottom: 1px solid var(--border-muted);
}
.issue-row:last-child { border-bottom: none; }
.issue-row:hover { background: var(--canvas-subtle); }
.issue-row-icon { padding-top: 2px; }
.issue-row-main { flex: 1; min-width: 0; }
.issue-title { color: var(--fg); font-weight: 600; font-size: 16px; }
.issue-title:hover { color: var(--accent); text-decoration: none; }
.issue-row-comments { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding-top: 2px; }

/* ---- issue / PR detail -------------------------------------------------------- */
.gh-header { padding-bottom: 8px; border-bottom: 1px solid var(--border-muted); margin-bottom: 24px; }
.gh-header h1 { font-size: 26px; font-weight: 400; margin-bottom: 8px; }
.gh-header h1 .dim { font-weight: 300; }
.gh-header-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.timeline { position: relative; }
.timeline-item { display: flex; gap: 16px; margin-bottom: 16px; position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: 20px; top: 40px; bottom: -16px;
  width: 2px; background: var(--border-muted);
}
.timeline-item:last-child::before { display: none; }
.timeline-avatar { flex-shrink: 0; width: 40px; z-index: 1; }
.comment-box { flex: 1; min-width: 0; }
.comment-header { font-weight: 400; font-size: 13px; background: var(--canvas-subtle); }
.new-item { display: flex; gap: 16px; margin-top: 16px; }
.new-item .comment-box { flex: 1; }

.merge-box { flex: 1; }
.merge-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; color: #fff;
}
.merge-dot.ok { background: var(--success-emphasis); }
.merge-dot.bad { background: var(--attention-fg); }

/* ---- markdown ------------------------------------------------------------------ */
.markdown-body { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2 {
  padding-bottom: 0.3em; border-bottom: 1px solid var(--border-muted);
  margin: 24px 0 16px; font-size: 1.5em;
}
.markdown-body h2 { font-size: 1.25em; }
.markdown-body h3 { margin: 24px 0 16px; font-size: 1em; }
.markdown-body code { background: var(--neutral-muted); border-radius: 6px; padding: 0.2em 0.4em; font-size: 85%; }
.markdown-body pre {
  background: var(--canvas-subtle); border-radius: 6px; padding: 16px; overflow: auto; line-height: 1.45;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { margin: 0 0 16px; padding: 0 1em; color: var(--fg-muted); border-left: 0.25em solid var(--border); }
.markdown-body table { border-collapse: collapse; margin-bottom: 16px; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 13px; }
.markdown-body img { max-width: 100%; }
.markdown-body ul, .markdown-body ol { padding-left: 2em; }
.markdown-body hr { height: 1px; border: 0; background: var(--border); margin: 24px 0; }
/* Tables scroll inside their own box rather than widening the page. */
.markdown-body table { display: block; width: max-content; max-width: 100%; overflow-x: auto; }
.markdown-body th { background: var(--neutral-muted); font-weight: 600; }
/* Headings are wrapped in their own anchor link (rehype-autolink-headings,
   behavior: wrap), so the heading text must not turn link-blue; the hover
   affordance is enough. */
.markdown-body h1 > a, .markdown-body h2 > a, .markdown-body h3 > a,
.markdown-body h4 > a, .markdown-body h5 > a, .markdown-body h6 > a {
  color: inherit; text-decoration: none;
}
.markdown-body h1 > a:hover, .markdown-body h2 > a:hover, .markdown-body h3 > a:hover,
.markdown-body h4 > a:hover, .markdown-body h5 > a:hover, .markdown-body h6 > a:hover {
  text-decoration: underline;
}
/* GFM task lists: no bullet, checkbox aligned with the text. */
.markdown-body li:has(> input[type="checkbox"]) { list-style: none; }
.markdown-body input[type="checkbox"] { margin: 0 0.35em 0 -1.4em; vertical-align: middle; }
/* GFM footnotes: a smaller, separated block at the end, as on GitHub. */
.markdown-body .footnotes { font-size: 12px; color: var(--fg-muted); border-top: 1px solid var(--border); margin-top: 24px; padding-top: 8px; }
.markdown-body .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- code pages -------------------------------------------------------------------- */
.repo-home { display: flex; gap: 24px; }
.repo-main { flex: 1; min-width: 0; }
.repo-sidebar { width: 296px; flex-shrink: 0; }
.repo-sidebar h2 { font-size: 16px; margin: 0 0 8px; }
.repo-sidebar h2 + p { margin-top: 0; }
.repo-sidebar .clone-url { width: 100%; font-family: var(--mono); font-size: 12px; }
.repo-about-head { position: relative; }
.repo-about-head > h2 { display: inline-block; }
.repo-about-edit {
  position: absolute; top: 0; right: 0;
  display: inline-flex; padding: 4px; border-radius: 6px;
  background: none; border: 0; cursor: pointer; color: var(--fg-muted);
}
.repo-about-edit:hover { background: var(--border-muted); }
.repo-about-desc { margin: 8px 0; }
.repo-sidebar h3 { font-size: 14px; margin: 20px 0 8px; display: flex; align-items: center; gap: 6px; }
.repo-topics { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.topic-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* Pill/tag editor inside the About dialog. */
.topic-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--canvas);
}
.topic-input:focus-within { border-color: var(--accent-emphasis); box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3); }
.topic-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.topic-pill-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1;
}
.topic-pill-x:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.topic-input-field {
  flex: 1; min-width: 120px; padding: 2px 4px; min-height: 24px;
  border: 0; background: none; box-shadow: none; font: inherit;
}
.topic-input-field:focus { outline: none; box-shadow: none; }
.repo-about-releases .release-latest { display: block; padding: 6px 0; }
.repo-about-releases .release-latest strong { display: block; }
.release-badge { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #fff; background: var(--success-emphasis); vertical-align: middle; }
.contributor-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.contributor-grid img { border-radius: 50%; }
.about-dialog {
  width: min(448px, 92vw); padding: 0; border: 1px solid var(--border);
  border-radius: 12px; background: var(--canvas); color: var(--fg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.about-dialog::backdrop { background: rgba(0,0,0,0.5); }
.about-dialog-form { display: flex; flex-direction: column; gap: 14px; padding: 16px; margin: 0; }
.about-dialog-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.about-dialog-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.about-dialog-form input { width: 100%; }
.about-dialog-error { margin: 0; }
.about-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.release-list { display: flex; flex-direction: column; gap: 12px; }
.release-row { padding: 16px; }
.release-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.release-row-title { font-size: 18px; font-weight: 600; }
.release-detail-head { margin-bottom: 16px; }
.release-detail-head .Label { margin-left: 6px; }
.release-assets-title { font-size: 14px; margin: 20px 0 8px; }

.tree-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.tree-header-right { margin-left: auto; display: flex; gap: 16px; }
.tree-header-right a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.path-crumb { font-size: 16px; }

.ref-picker { position: relative; }
.ref-picker summary { list-style: none; }
.ref-picker summary::-webkit-details-marker { display: none; }
.dropdown-caret {
  display: inline-block; width: 0; height: 0;
  border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px;
}
.ref-menu {
  position: absolute; top: 110%; left: 0; z-index: 10; min-width: 240px; max-height: 320px; overflow: auto;
  background: var(--canvas); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
}
.ref-menu a { display: block; padding: 6px 12px; color: var(--fg); border-bottom: 1px solid var(--border-muted); }
.ref-menu a:last-child { border-bottom: none; }
.ref-menu a:hover { background: var(--canvas-subtle); text-decoration: none; }
.ref-menu a.on { font-weight: 600; }

.latest-commit {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; margin-bottom: -1px;
  background: var(--canvas-subtle); border-radius: 6px 6px 0 0;
}
.latest-commit .commit-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest-commit .right { white-space: nowrap; }

/* table-layout:fixed so a long file name can be ellipsised: in an auto layout
   the name cell grows to fit its content and text-overflow never triggers.
   Fixed layout takes the column widths from the first row, so each of the
   three columns states its own - the name column is the only flexible one and
   absorbs the remainder. */
table.tree-list { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
table.tree-list td { padding: 8px 16px; border-bottom: 1px solid var(--border-muted); }
table.tree-list tr:last-child td { border-bottom: none; }
table.tree-list td.icon { width: 48px; padding-right: 0; text-align: center; }
table.tree-list td.size { width: 96px; text-align: right; white-space: nowrap; }
/* auto = whatever the two fixed columns leave. The link is a block so the
   ellipsis applies to it; the full name stays readable via its title. */
table.tree-list td.name { width: auto; }
table.tree-list td.name a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.tree-list a { color: var(--fg); }
table.tree-list a:hover { color: var(--accent); }
.octicon.dir { color: #54aeff; fill: #54aeff; }

.readme { margin-top: 16px; }

/* blob view */
.blob-header { display: flex; align-items: center; justify-content: space-between; font-weight: 400; }
table.blob { width: 100%; border-collapse: collapse; }
table.blob td { font-family: var(--mono); font-size: 12px; line-height: 20px; padding: 0 10px; }
td.lineno {
  width: 1%; min-width: 50px; text-align: right; color: var(--fg-muted);
  user-select: none; white-space: nowrap;
}
td.code { white-space: pre; }
.binary { padding: 32px; text-align: center; color: var(--fg-muted); }

/* highlight.js token colours, mapped to Primer-ish hues. Light values here;
   dark overrides below. Only the token classes hljs actually emits. */
.hljs-comment, .hljs-quote { color: #6e7781; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-type { color: #cf222e; }
.hljs-string, .hljs-meta .hljs-string, .hljs-regexp { color: #0a3069; }
.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable { color: #0550ae; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #8250df; }
.hljs-title.class_, .hljs-class .hljs-title { color: #953800; }
.hljs-attr, .hljs-attribute, .hljs-property { color: #0550ae; }
.hljs-built_in, .hljs-builtin-name, .hljs-symbol, .hljs-bullet { color: #953800; }
.hljs-meta, .hljs-tag { color: #116329; }
.hljs-name { color: #116329; }
.hljs-deletion { color: #82071e; background: #ffebe9; }
.hljs-addition { color: #116329; background: #e6ffec; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .hljs-comment, .hljs-quote { color: #8b949e; }
  .hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-type { color: #ff7b72; }
  .hljs-string, .hljs-meta .hljs-string, .hljs-regexp { color: #a5d6ff; }
  .hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable { color: #79c0ff; }
  .hljs-title, .hljs-title.function_, .hljs-section { color: #d2a8ff; }
  .hljs-title.class_, .hljs-class .hljs-title { color: #ffa657; }
  .hljs-attr, .hljs-attribute, .hljs-property { color: #79c0ff; }
  .hljs-built_in, .hljs-builtin-name, .hljs-symbol, .hljs-bullet { color: #ffa657; }
  .hljs-meta, .hljs-tag, .hljs-name { color: #7ee787; }
  .hljs-deletion { color: #ffdcd7; background: rgba(248,81,73,0.15); }
  .hljs-addition { color: #aff5b4; background: rgba(46,160,67,0.15); }
}
.code-box {
  background: var(--canvas-subtle); border: 1px solid var(--border); border-radius: 6px;
  padding: 16px; overflow: auto; text-align: left;
}
.token { font-family: var(--mono); background: var(--neutral-muted); padding: 4px 8px; border-radius: 6px; }

/* commits */
.commit-list .commit-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 16px; border-bottom: 1px solid var(--border-muted);
}
.commit-list .commit-row:last-child { border-bottom: none; }
.commit-title { color: var(--fg); font-weight: 600; }
.commit-title:hover { color: var(--accent); }
.sha-box {
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; font-size: 12px;
}
.sha-box a { color: var(--accent); }
.commit-banner { margin-bottom: 16px; }
.commit-subject { font-size: 18px; margin-bottom: 8px; }
.commit-desc { white-space: pre-wrap; margin: 0 0 8px; font-family: var(--mono); }

/* diffs */
.filediff { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 16px; overflow: hidden; }
.filehead {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--canvas-subtle); border-bottom: 1px solid var(--border);
}
.filehead .path { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.filehead .stat { margin-left: auto; font-size: 12px; }
.add { color: var(--success-fg); }
.del { color: var(--danger-fg); }
table.diff { width: 100%; border-collapse: collapse; }
table.diff td { font-family: var(--mono); font-size: 12px; line-height: 20px; padding: 0 8px; }
tr.hunk td { background: var(--hunk-bg); color: var(--fg-muted); padding: 4px 12px; }
td.mark { width: 1%; user-select: none; text-align: center; color: var(--fg-muted); }
tr.l-add td { background: var(--add-bg); }
tr.l-delete td { background: var(--del-bg); }
table.diff td.code { white-space: pre-wrap; overflow-wrap: anywhere; }

.compare-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; margin-bottom: 16px; }

/* ---- actions ---------------------------------------------------------------------- */
.run-status { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; }
.run-status.ok { background: var(--success-emphasis); }
.run-status.bad { background: var(--danger-emphasis); }
.run-status.busy { background: var(--attention-fg); }
.run-status.queued { background: var(--fg-muted); }
.run-status.cancelled { background: var(--fg-muted); }
.run-log {
  background: var(--canvas-inset); color: #e6edf3; border-radius: 6px;
  padding: 16px; min-height: 200px; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6;
}
@media (prefers-color-scheme: light) {
  .run-log { background: #24292f; }
}

/* ---- login / profile ----------------------------------------------------------------- */
.login-page { display: flex; justify-content: center; padding-top: 48px; }
.login-box { width: 340px; }
.profile { display: flex; gap: 32px; }
.profile-side { width: 256px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-side h1 { font-size: 24px; }
.profile-name { line-height: 1.25; word-break: break-word; }
.profile-login { font-size: 20px; font-weight: 400; margin: 0 0 8px; }
.profile-main { flex: 1; min-width: 0; }
.profile-tabs { margin-bottom: 16px; }
.new-repo { max-width: 720px; }
.new-repo-head { border-bottom: 1px solid var(--border-muted); padding-bottom: 16px; margin-bottom: 16px; }
.new-repo-form { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.new-repo-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.new-repo-form input[type="text"], .new-repo-form input[name="name"], .new-repo-form input[name="description"] { width: 100%; }
.new-repo-owner { display: flex; gap: 12px; align-items: flex-end; }
.new-repo-owner > label:first-child { flex-shrink: 0; }
.new-repo-owner > label:last-child { flex: 1; }
.new-repo-owner-fixed { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--canvas-inset); font-weight: 400; }
.new-repo-visibility { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.new-repo-radio { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
.new-repo-radio span { display: flex; flex-direction: column; }
.new-repo-radio.disabled { opacity: 0.6; }
.new-repo-actions { display: flex; gap: 8px; border-top: 1px solid var(--border-muted); padding-top: 20px; }
.settings-nav { margin: -8px 0 16px; }
.flash-ok { color: var(--success-fg); background: color-mix(in srgb, var(--success-emphasis) 12%, transparent); border: 1px solid var(--success-emphasis); border-radius: 6px; padding: 8px 12px; }
.secret-row { border-top: 1px solid var(--border-muted); padding: 12px 16px; }
.secret-row:first-child { border-top: 0; }
.webhook-url { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.package-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.package-list li { display: flex; align-items: center; gap: 6px; }
.package-page { display: flex; flex-direction: column; gap: 16px; }
.package-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; }
.package-install { font-family: var(--mono); font-size: 12px; margin-left: auto; }
/* The Languages block is an L1 fragment with its own scoped inline styles
   (embedded via lower.l1Fragment); L3 only spaces the wrapper. */
.repo-about-languages { margin-top: 20px; }

.profile-repo-stars { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

@media (max-width: 900px) {
  .repo-home, .profile { flex-direction: column; }
  .repo-sidebar, .profile-side { width: 100%; }
  .container { padding: 16px; }
}

/* ---- labels ---------------------------------------------------------------------- */
.IssueLabel {
  display: inline-block; padding: 0 8px; margin: 0 2px;
  font-size: 12px; font-weight: 500; line-height: 18px;
  border-radius: 2em; white-space: nowrap;
}
a.IssueLabel:hover { text-decoration: none; filter: brightness(1.1); }
.label-new { display: flex; gap: 8px; align-items: center; }
.label-new input[type='color'] { padding: 2px; width: 40px; }
.label-row { align-items: center; }
.label-desc { flex: 1; }
.toolbar-actions { display: flex; gap: 8px; }

/* ---- issue detail layout + sidebar -------------------------------------------------- */
.issue-layout { display: flex; gap: 24px; }
.issue-main { flex: 1; min-width: 0; }
.issue-sidebar { width: 240px; flex-shrink: 0; }
.issue-sidebar section { border-bottom: 1px solid var(--border-muted); padding: 12px 0; }
.issue-sidebar h3 { font-size: 12px; color: var(--fg-muted); margin-bottom: 8px; }
.sidebar-row { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0; }
.sidebar-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sidebar-add { display: flex; gap: 6px; margin-top: 8px; }
.sidebar-add select, .sidebar-add input { min-width: 0; flex: 1; font-size: 12px; min-height: 26px; }
.issue-row-side { display: flex; align-items: center; gap: 6px; }

/* timeline events (closed / merged) */
.timeline-event { display: flex; align-items: center; gap: 12px; margin: 16px 0 16px 8px; }
.timeline-badge { display: inline-flex; }
.timeline-badge > span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; color: #fff;
}
.badge-merged { background: var(--done-emphasis); }
.badge-closed { background: var(--danger-emphasis); }

/* ---- PR sub-navigation (tabnav) ------------------------------------------------------ */
.tabnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabnav-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; color: var(--fg-muted);
  border: 1px solid transparent; border-radius: 6px 6px 0 0; margin-bottom: -1px;
}
.tabnav-tab:hover { color: var(--fg); text-decoration: none; }
.tabnav-tab.selected {
  color: var(--fg); background: var(--canvas);
  border-color: var(--border) var(--border) var(--canvas);
}

/* ---- contributors -------------------------------------------------------------------- */
.contrib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.contrib-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.contrib-stats { margin-bottom: 8px; }
.contrib-bar { height: 8px; background: var(--canvas-subtle); border-radius: 4px; overflow: hidden; }
.contrib-bar span { display: block; height: 100%; background: var(--success-emphasis); border-radius: 4px; }

/* ---- actions layout -------------------------------------------------------------------- */
.actions-layout { display: flex; gap: 24px; }
.actions-side { width: 220px; flex-shrink: 0; }
.actions-side h3 { font-size: 12px; color: var(--fg-muted); margin-bottom: 8px; }
.actions-workflow { display: block; padding: 6px 8px; border-radius: 6px; color: var(--fg); }
.actions-workflow:hover { background: var(--canvas-subtle); text-decoration: none; }
.actions-workflow.on { background: var(--canvas-subtle); font-weight: 600; }
.actions-main { flex: 1; min-width: 0; }
.job-box .run-log { border-radius: 0 0 6px 6px; margin: 0; }
.settings-box { margin-bottom: 16px; }

/* ---- contribution calendar --------------------------------------------------------------- */
.heatmap-scroll { overflow-x: auto; }
.heat { fill: var(--canvas-subtle); stroke: rgba(27, 31, 35, 0.06); }
.heat-1 { fill: #9be9a8; }
.heat-2 { fill: #40c463; }
.heat-3 { fill: #30a14e; }
.heat-4 { fill: #216e39; }
@media (prefers-color-scheme: dark) {
  .heat { fill: #151b23; stroke: rgba(255, 255, 255, 0.05); }
  .heat-1 { fill: #0e4429; }
  .heat-2 { fill: #006d32; }
  .heat-3 { fill: #26a641; }
  .heat-4 { fill: #39d353; }
}

@media (max-width: 900px) {
  .issue-layout, .actions-layout { flex-direction: column; }
  .issue-sidebar, .actions-side { width: 100%; }
}

/* ---- auth (sign in / sign up), GitHub layout ------------------------------------------ */
.auth-page { display: flex; flex-direction: column; align-items: center; padding: 48px 16px; }
.auth-mark { width: 48px; height: 48px; margin-bottom: 20px; }
.auth-title { font-size: 24px; font-weight: 300; letter-spacing: -0.5px; margin-bottom: 16px; }
.auth-box { width: 340px; background: var(--canvas-subtle); }
.auth-box .Box-body { padding: 20px; }
.auth-box label { font-weight: 400; font-size: 14px; }
.auth-box input { background: var(--canvas); }
.auth-hint { font-weight: 400; }
.btn-block { width: 100%; justify-content: center; }
.auth-alt { width: 340px; margin-top: 16px; text-align: center; }
.auth-alt .Box-body { padding: 16px; }
.auth-flash { width: 340px; margin: 0 0 16px; }

/* ---- Actions run page: graph + step log ------------------------------------------------ */
.run-layout { display: flex; gap: 24px; }
.run-side { width: 220px; flex-shrink: 0; }
.run-side h3 { font-size: 12px; color: var(--fg-muted); margin-bottom: 8px; }
.run-side-job {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; color: var(--fg);
}
.run-side-job:hover { background: var(--canvas-subtle); text-decoration: none; }
.run-main { flex: 1; min-width: 0; }
.run-status.sm { width: 18px; height: 18px; }
.run-status.sm .octicon { width: 12px; height: 12px; }

.graph-box { margin-bottom: 16px; padding: 8px; overflow-x: auto; background: var(--canvas-subtle); }
.run-graph { position: relative; margin: 0 auto; }
.run-graph-edges { position: absolute; inset: 0; }
.run-graph-edges path { fill: none; stroke: var(--border); stroke-width: 2; }
.graph-node {
  position: absolute; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; background: var(--canvas);
  border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow); font-weight: 600; font-size: 13px;
}
.graph-node-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.job-panel { margin-bottom: 16px; overflow: hidden; }
.job-panel-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.job-panel-meta { margin-left: auto; font-weight: 400; }
.steps { background: var(--canvas-inset); color: #e6edf3; }
@media (prefers-color-scheme: light) {
  .steps { background: #24292f; }
}
.step summary {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer; list-style: none;
  font-family: var(--mono); font-size: 12px; color: #e6edf3;
}
.step summary::-webkit-details-marker { display: none; }
.step summary:hover { background: rgba(255, 255, 255, 0.08); }
.step-caret { border-top-color: #9198a1; transition: transform 0.1s; margin-top: 0; }
.step[open] > summary .step-caret { transform: rotate(0deg); }
.step:not([open]) > summary .step-caret { transform: rotate(-90deg); }
.step-name { font-weight: 600; }
.step-duration { margin-left: auto; color: #9198a1; }
.step-log {
  margin: 0; padding: 4px 0 8px;
  font-family: var(--mono); font-size: 12px; line-height: 20px;
  counter-reset: line; list-style: none;
}
.step-log li { padding: 0 12px 0 56px; position: relative; white-space: pre-wrap; overflow-wrap: anywhere; }
.step-log li::before {
  counter-increment: line; content: counter(line);
  position: absolute; left: 0; width: 44px; text-align: right;
  color: #767d86; user-select: none;
}
.step-log li:hover { background: rgba(255, 255, 255, 0.06); }
.step-log-empty { padding: 4px 12px 8px 56px; color: #767d86; }

@media (max-width: 900px) {
  .run-layout { flex-direction: column; }
  .run-side { width: 100%; }
}

/* ---- run summary: annotations + artifacts + narration ------------------------------ */
.annotations-box { margin-bottom: 16px; }
.annotation {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 16px; border-bottom: 1px solid var(--border-muted);
}
.annotation:last-child { border-bottom: none; }
.artifacts-box { margin-top: 16px; }
.artifact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--border-muted);
}
.artifact-row:last-child { border-bottom: none; }
.artifact-size { margin-left: auto; }
.narration-box { margin-top: 16px; }
.narration-box summary { cursor: pointer; }
.narration-box .run-log { border-radius: 0 0 6px 6px; margin: 0; min-height: 0; }
.run-side-job.on { background: var(--canvas-subtle); font-weight: 600; }
a.graph-node { color: var(--fg); }
a.graph-node:hover { text-decoration: none; border-color: var(--accent); }

/* ---- Code clone dropdown ------------------------------------------------------------ */
.code-dropdown { position: relative; }
.code-dropdown summary { list-style: none; }
.code-dropdown summary::-webkit-details-marker { display: none; }
.code-dropdown summary .dropdown-caret { border-top-color: #fff; }
.code-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 400px;
  background: var(--canvas); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2); padding: 12px;
}
.code-menu-title { font-weight: 600; margin-bottom: 8px; }
.code-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.code-row:last-child { margin-bottom: 0; }
.code-row-label {
  width: 84px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--fg-muted);
  text-align: right;
}
.code-row input {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px;
  background: var(--canvas-subtle); min-height: 28px; padding: 3px 8px;
}
.quick-setup { max-width: 800px; margin: 24px auto; }

/* ---- home ----------------------------------------------------------------------------- */
.home-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 24px; margin-bottom: 24px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--canvas-subtle);
}
.home-hero-mark { width: 56px; height: 56px; flex-shrink: 0; }
.home-hero h1 { font-size: 24px; margin-bottom: 4px; }
.home-hero p { margin: 0; max-width: 60ch; }
.home-hero-actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }

.repo-item {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 16px; border-bottom: 1px solid var(--border-muted);
}
.repo-item:last-child { border-bottom: none; }
.repo-item-main { flex: 1; min-width: 0; }
.repo-item-name { font-size: 18px; font-weight: 600; margin: 0 0 2px; }
.repo-item-name a { color: var(--accent); }
.repo-item-name .dim { font-weight: 400; }
.repo-item-name .Label { vertical-align: 2px; }
.repo-item-desc { margin: 0 0 8px; max-width: 72ch; }
.repo-item-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.repo-item-meta a { display: inline-flex; align-items: center; gap: 4px; }
.repo-item-meta a:hover { color: var(--accent); }
.repo-item-owner { flex-shrink: 0; margin-top: 4px; }

@media (max-width: 700px) {
  .home-hero { flex-direction: column; align-items: flex-start; }
  .home-hero-actions { margin-left: 0; }
  .code-menu { width: 320px; }
}

/* ---- account settings ------------------------------------------------------------- */
.settings { display: flex; gap: 24px; }
.settings-nav { width: 240px; flex-shrink: 0; }
.settings-nav-who { display: flex; align-items: center; gap: 8px; padding: 8px 0 12px; }
.settings-nav-item {
  display: block; padding: 6px 12px; border-radius: 6px; color: var(--fg); font-size: 14px;
}
.settings-nav-item:hover { background: var(--canvas-subtle); text-decoration: none; }
.settings-nav-item.on { background: var(--neutral-muted); font-weight: 600; }
.settings-main { flex: 1; min-width: 0; }
.settings-profile { display: flex; gap: 24px; }
.settings-card { flex: 1; }
.settings-profile-side { width: 160px; flex-shrink: 0; text-align: center; }
.settings-profile-side .avatar { border-radius: 50%; margin-bottom: 8px; }
.notice-ok { color: var(--success-fg); border: 1px solid var(--success-fg); border-radius: 6px; padding: 8px 12px; margin: 0 0 16px; }
.notice-fresh { border-color: var(--success-emphasis); margin-bottom: 16px; }

/* ---- header user menu -------------------------------------------------------------- */
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; display: flex; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-drop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px;
  background: var(--canvas); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2); padding: 4px 0;
}
.user-menu-who { padding: 8px 16px; border-bottom: 1px solid var(--border-muted); font-size: 12px; color: var(--fg-muted); }
.user-menu-drop a { display: block; padding: 6px 16px; color: var(--fg); font-size: 14px; }
.user-menu-drop a:hover { background: var(--canvas-subtle); text-decoration: none; }
.user-menu-signout {
  width: 100%; text-align: left; padding: 6px 16px; border: none; background: none;
  color: var(--danger-fg); cursor: pointer; font: inherit; border-top: 1px solid var(--border-muted); margin-top: 4px;
}
.user-menu-signout:hover { background: var(--canvas-subtle); }

/* ---- repo header + About stats ----------------------------------------------------- */
.repo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border-muted); flex-wrap: wrap;
}
.repo-head-title { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 400; margin: 0; }
.repo-head-title a { color: var(--accent); }
.repo-head-title .crumb-strong { font-weight: 600; }
.repo-head-actions .btn.starred { color: #e3b341; border-color: #e3b341; }
.repo-about-stats { list-style: none; padding: 0; margin: 12px 0 0; }
.repo-about-stats li { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--fg-muted); }
.repo-about-stats strong { color: var(--fg); }

/* ---- CI status marker on the latest-commit line ------------------------------------ */
.ci-status {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.ci-status .octicon { width: 13px; height: 13px; }
.ci-status.ok { color: var(--success-fg); }
.ci-status.bad { color: var(--danger-fg); }
.ci-status.busy { color: var(--attention-fg); }
.ci-status.queued { color: var(--fg-muted); }
.ci-status:hover { filter: brightness(1.1); }

/* ---- Re-run jobs split dropdown ---------------------------------------------------- */
.rerun-menu { position: relative; }
.rerun-menu summary { list-style: none; cursor: pointer; }
.rerun-menu summary::-webkit-details-marker { display: none; }
.rerun-drop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px;
  background: var(--canvas); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2); padding: 4px 0;
}
.rerun-item {
  display: block; width: 100%; text-align: left; padding: 6px 16px;
  border: none; background: none; color: var(--fg); font: inherit; cursor: pointer;
}
.rerun-item:hover:not(:disabled) { background: var(--canvas-subtle); }
.rerun-item:disabled { color: var(--fg-muted); cursor: not-allowed; }

/* ---- step states: skipped / pending, and folded log blocks ------------------------- */
.step-skipped > summary, .step-pending > summary { opacity: 0.6; }
.step-skipped .step-name, .step-pending .step-name { text-decoration: none; }
.run-status.sm.queued { background: var(--fg-muted); }
.log-fold { background: var(--canvas-inset); }
@media (prefers-color-scheme: light) { .log-fold { background: #24292f; } }
.log-fold > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 56px; cursor: pointer; list-style: none;
  color: #9198a1; font-family: var(--mono); font-size: 12px;
}
.log-fold > summary::-webkit-details-marker { display: none; }
.log-fold > summary:hover { background: rgba(255,255,255,0.08); color: #e6edf3; }
