/* Design tokens of the GitHub-like interface (REQ-599), the one place for colours,
   fonts and the few measures the shell shares. Light is the base; dark follows the
   system unless the account menu has set data-theme on <html> (shell.js).
   Tokens sit on :root and carry no page scope: they are only read by ui-*.css.
   The font tokens are called --ui-font and --ui-mono because Clay owns --font. */

:root {
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --ui-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
  --fg-default: #1f2328;
  --fg-muted: #59636e;
  --fg-subtle: #818b98;
  --canvas-default: #ffffff;
  --canvas-subtle: #f6f8fa;
  --canvas-inset: #f6f8fa;
  --border-default: #d1d9e0;
  --border-muted: #d1d9e0b3;
  --neutral-muted: #818b982e;
  --neutral-emphasis: #59636e;
  --accent-fg: #0969da;
  --accent-emphasis: #0969da;
  --accent-subtle: #ddf4ff;
  --accent-muted: #54aeff66;
  --tab-accent: #0969da;
  --success-fg: #1a7f37;
  --success-emphasis: #1f883d;
  --success-subtle: #dafbe1;
  --success-muted: #4ac26b66;
  --danger-fg: #d1242f;
  --danger-emphasis: #cf222e;
  --danger-subtle: #ffebe9;
  --danger-muted: #ff818266;
  --attention-fg: #9a6700;
  --attention-emphasis: #9a6700;
  --attention-subtle: #fff8c5;
  --attention-muted: #d4a72c66;
  --done-fg: #8250df;
  --done-emphasis: #8250df;
  --done-subtle: #fbefff;
  --done-muted: #c297ff66;
  --btn-bg: #f6f8fa;
  --btn-hover: #eff2f5;
  --btn-active: #e6eaef;
  --btn-border: #d1d9e0;
  --btn-pri-bg: #1f883d;
  --btn-pri-hover: #1c8139;
  --btn-pri-border: #1f232826;
  --header-bg: #f6f8fa;
  --row-hover: #f6f8fa;
  --shadow-pop: 0 8px 24px #949ea340;
  --logo: #0969da;
  /* Active tab card: soft side shadow and the 6 px fillet under both corners. */
  --tab-shade: rgb(31 35 40 / .07);
  --fr: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fg-default: #f0f6fc;
    --fg-muted: #9198a1;
    --fg-subtle: #656c76;
    --canvas-default: #0d1117;
    --canvas-subtle: #151b23;
    --canvas-inset: #010409;
    --border-default: #3d444d;
    --border-muted: #3d444db3;
    --neutral-muted: #656c7633;
    --neutral-emphasis: #656c76;
    --accent-fg: #4493f8;
    --accent-emphasis: #1f6feb;
    --accent-subtle: #388bfd1a;
    --accent-muted: #388bfd66;
    --tab-accent: #4493f8;
    --success-fg: #3fb950;
    --success-emphasis: #238636;
    --success-subtle: #2ea04326;
    --success-muted: #2ea04366;
    --danger-fg: #f85149;
    --danger-emphasis: #da3633;
    --danger-subtle: #f851491a;
    --danger-muted: #f8514966;
    --attention-fg: #d29922;
    --attention-emphasis: #9e6a03;
    --attention-subtle: #bb800926;
    --attention-muted: #bb800966;
    --done-fg: #ab7df8;
    --done-emphasis: #8957e5;
    --done-subtle: #a371f726;
    --done-muted: #a371f766;
    --btn-bg: #212830;
    --btn-hover: #262c36;
    --btn-active: #2a313c;
    --btn-border: #3d444d;
    --btn-pri-bg: #238636;
    --btn-pri-hover: #2ea043;
    --btn-pri-border: #f0f6fc1a;
    --header-bg: #151b23;
    --row-hover: #151b23;
    --shadow-pop: 0 8px 24px #01040966;
    --logo: #4493f8;
    --tab-shade: rgb(1 4 9 / .45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fg-default: #f0f6fc;
  --fg-muted: #9198a1;
  --fg-subtle: #656c76;
  --canvas-default: #0d1117;
  --canvas-subtle: #151b23;
  --canvas-inset: #010409;
  --border-default: #3d444d;
  --border-muted: #3d444db3;
  --neutral-muted: #656c7633;
  --neutral-emphasis: #656c76;
  --accent-fg: #4493f8;
  --accent-emphasis: #1f6feb;
  --accent-subtle: #388bfd1a;
  --accent-muted: #388bfd66;
  --tab-accent: #4493f8;
  --success-fg: #3fb950;
  --success-emphasis: #238636;
  --success-subtle: #2ea04326;
  --success-muted: #2ea04366;
  --danger-fg: #f85149;
  --danger-emphasis: #da3633;
  --danger-subtle: #f851491a;
  --danger-muted: #f8514966;
  --attention-fg: #d29922;
  --attention-emphasis: #9e6a03;
  --attention-subtle: #bb800926;
  --attention-muted: #bb800966;
  --done-fg: #ab7df8;
  --done-emphasis: #8957e5;
  --done-subtle: #a371f726;
  --done-muted: #a371f766;
  --btn-bg: #212830;
  --btn-hover: #262c36;
  --btn-active: #2a313c;
  --btn-border: #3d444d;
  --btn-pri-bg: #238636;
  --btn-pri-hover: #2ea043;
  --btn-pri-border: #f0f6fc1a;
  --header-bg: #151b23;
  --row-hover: #151b23;
  --shadow-pop: 0 8px 24px #01040966;
  --logo: #4493f8;
  --tab-shade: rgb(1 4 9 / .45);
}
/* "Kurz erklärt": die Einordnung vor dem Originaltext. Ruhige Fläche mit
   Akzentkante; welche Herkunft der Text hat, steht klein in der Kopfzeile. */
:is(.g2) {
  & .ex { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; padding: 12px 16px; min-width: 0; background: var(--canvas-subtle); border: 1px solid var(--border-default); border-left: 3px solid var(--accent-emphasis); border-radius: 6px; }
  & .ex-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  & .ex-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--fg-default); }
  & .ex-mark { font-size: 12px; color: var(--fg-muted); white-space: nowrap; }
  & .ex-text { margin: 0; line-height: 1.55; color: var(--fg-default); overflow-wrap: anywhere; }
  & .ex-from { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin: 0; min-width: 0; }
  & .ex-from > * { min-width: 0; overflow-wrap: anywhere; }
  & .ex-proj { font-weight: 600; color: var(--fg-muted); }
  & .ex-k { color: var(--fg-muted); }
  & .ex-from code { font-size: .875em; padding: 1px 6px; border-radius: 8px; background: var(--neutral-muted); }
  & .coord-attention-card .ex { padding: 8px 12px; margin: 4px 0 8px; }
  & .coord-attention-card .ex-text { font-size: 13px; }
}
/* Primitives of the GitHub-like interface: reset, icons, avatars, buttons,
   labels, boxes, menus, fields, prose. The accepted mock is git-native-v2
   (gh.css, gh5.css); this file is its base with the class names of the app
   (gbtn, gav, gfield). Everything is scoped to the pages in the new look
   (.g2), the header (.gh-header), the repository and organisation band
   (.rband) and the footer (.gt-foot), so pages that are still in the Clay
   look are not touched. Colours come from ui-tokens.css. */

:is(.g2, .gh-header, .rband, .gt-foot, .pcard) {
  &, & *, & *::before, & *::after { box-sizing: border-box; }
  & a { color: var(--accent-fg); text-decoration: none; }
  & a:hover { text-decoration: underline; }
  & h1, & h2, & h3, & p { margin: 0; }
  & [hidden] { display: none !important; }
  & button { font: inherit; color: inherit; }
  & :focus-visible { outline: 2px solid var(--accent-emphasis); outline-offset: 2px; }
  /* app.css gives every form control a padding, a margin and a border. */
  & input, & select, & textarea, & button { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; font: inherit; color: inherit; }

  /* Utilities */
  & .mono { font-family: var(--ui-mono); font-size: 12px; }
  & .muted { color: var(--fg-muted); }
  & .subtle { color: var(--fg-subtle); }
  & .nw { white-space: nowrap; }
  & .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  & .sp { flex: 1; }
  & .ok { color: var(--success-fg); }
  & .warn { color: var(--attention-fg); }
  & .bad { color: var(--danger-fg); }
  & .don { color: var(--done-fg); }
  & .ng { color: var(--fg-muted); font-style: italic; }
  & .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  & .wrap { max-width: 1600px; margin: 0 auto; padding: 0 20px; }

  /* Icons */
  & .i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: text-bottom; }
  & .i.l { width: 20px; height: 20px; }

  /* Avatars: person (initials or picture), agent (harness mark, owner badge), gardener, system */
  & .gav { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 20px; overflow: visible; border-radius: 50%; background: var(--canvas-subtle); border: 1px solid var(--border-default); color: var(--fg-muted); font-size: 9px; font-weight: 600; line-height: 1; letter-spacing: .02em; vertical-align: middle; }
  & .gav.lg { width: 32px; height: 32px; font-size: 12px; }
  & .gav.xl { width: 40px; height: 40px; font-size: 14px; }
  & .gav .i { width: 12px; height: 12px; }
  & .gav.lg .i { width: 18px; height: 18px; }
  & .gav.xl .i { width: 22px; height: 22px; }
  /* Chromium does not clip a replaced element to its rounding while overflow is visible */
  & img.gav { padding: 0; overflow: clip; object-fit: cover; background: var(--canvas-subtle); }
  /* The tints are see-through in dark mode; the canvas under them keeps lines behind an avatar hidden */
  & .gav.hc-0 { background: linear-gradient(var(--accent-subtle), var(--accent-subtle)), var(--canvas-default); border-color: var(--accent-muted); color: var(--accent-fg); }
  & .gav.hc-1 { background: linear-gradient(var(--done-subtle), var(--done-subtle)), var(--canvas-default); border-color: var(--done-muted); color: var(--done-fg); }
  & .gav.hc-2 { background: linear-gradient(var(--success-subtle), var(--success-subtle)), var(--canvas-default); border-color: var(--success-muted); color: var(--success-fg); }
  & .gav.hc-3 { background: linear-gradient(var(--attention-subtle), var(--attention-subtle)), var(--canvas-default); border-color: var(--attention-muted); color: var(--attention-fg); }
  & .gav.hc-4 { --tint: color-mix(in srgb, var(--accent-fg) 45%, var(--success-fg)); background: linear-gradient(color-mix(in srgb, var(--tint) 15%, transparent), color-mix(in srgb, var(--tint) 15%, transparent)), var(--canvas-default); border-color: color-mix(in srgb, var(--tint) 40%, transparent); color: var(--tint); }
  & .gav.hc-5 { background: var(--canvas-subtle); color: var(--fg-muted); }
  & .gav.agent { position: relative; border: none; border-radius: 6px; color: #fff; }
  & .gav.agent .i { color: #fff; }
  & .gav.agent .i.brand { width: 62%; height: 62%; }
  & .gav.a-claude { background: #d97757; }
  & .gav.a-codex { background: #000; }
  & .gav.a-gardener { background: #1a7f37; }
  & .gav.a-system { background: var(--accent-emphasis); }
  /* Owner badge in the corner of an agent's logo: an opaque disc in the owner's tint, a ring in the card colour, 20 px instead of 15 so two letters read at 1x and 2x. A picture replaces the letters. */
  & .gav.agent .own { position: absolute; right: -7px; bottom: -7px; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; font-weight: 700; letter-spacing: -.02em; line-height: 1; display: flex; align-items: center; justify-content: center; background: var(--canvas-default); color: var(--fg-muted); border: 1px solid var(--border-default); box-shadow: 0 0 0 2px var(--canvas-default); object-fit: cover; padding: 0; box-sizing: border-box; }
  & .gav.agent.lg .own { width: 20px; height: 20px; }
  & .gav.agent.xl .own { width: 22px; height: 22px; font-size: 11px; right: -8px; bottom: -8px; }
  & .gav.agent img.own { border: none; }
  & .gav.agent .own.hc-0 { background: linear-gradient(var(--accent-subtle), var(--accent-subtle)), var(--canvas-default); border-color: var(--accent-muted); color: var(--accent-fg); }
  & .gav.agent .own.hc-1 { background: linear-gradient(var(--done-subtle), var(--done-subtle)), var(--canvas-default); border-color: var(--done-muted); color: var(--done-fg); }
  & .gav.agent .own.hc-2 { background: linear-gradient(var(--success-subtle), var(--success-subtle)), var(--canvas-default); border-color: var(--success-muted); color: var(--success-fg); }
  & .gav.agent .own.hc-3 { background: linear-gradient(var(--attention-subtle), var(--attention-subtle)), var(--canvas-default); border-color: var(--attention-muted); color: var(--attention-fg); }
  & .gav.agent .own.hc-4 { --tint: color-mix(in srgb, var(--accent-fg) 45%, var(--success-fg)); background: linear-gradient(color-mix(in srgb, var(--tint) 15%, transparent), color-mix(in srgb, var(--tint) 15%, transparent)), var(--canvas-default); border-color: color-mix(in srgb, var(--tint) 40%, transparent); color: var(--tint); }
  & .gav.agent .live { position: absolute; left: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--success-emphasis); box-shadow: 0 0 0 2px var(--canvas-default); animation: gpulse 1.8s ease-out infinite; }
  & .gav.lg.agent .live, & .gav.xl.agent .live { width: 11px; height: 11px; left: -4px; top: -4px; }

  /* A person stands in running text: the baseline is the one of the text, not of the picture. */
  & .person { display: inline-flex; align-items: baseline; gap: 6px; color: var(--fg-default); font-weight: 600; }
  & .person:hover { color: var(--accent-fg); text-decoration: none; }
  & .person > .gav, & .person > img, & .person > svg { align-self: center; }
  & .person.actor > a { color: inherit; }
  & .person .botmark { align-self: center; padding: 0 5px; font-size: 11px; line-height: 16px; }
  & .person .actor-d { color: var(--fg-muted); font-weight: 400; }

  /* Buttons */
  & .gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px; font: 500 14px/20px var(--ui-font); color: var(--fg-default); background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: 6px; cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: 0 1px 0 #1f23280a; }
  & .gbtn:hover { background: var(--btn-hover); text-decoration: none; }
  & .gbtn:active { background: var(--btn-active); }
  & .gbtn .i { color: var(--fg-muted); }
  & .gbtn.sm { height: 28px; padding: 0 10px; font-size: 13px; gap: 6px; }
  & .gbtn.pri { background: var(--btn-pri-bg); border-color: var(--btn-pri-border); color: #fff; }
  & .gbtn.pri:hover { background: var(--btn-pri-hover); }
  & .gbtn.pri .i { color: #fff; }
  & .gbtn.danger { background: transparent; border-color: transparent; color: var(--danger-fg); box-shadow: none; }
  & .gbtn.danger:hover { background: var(--danger-subtle); }
  & .gbtn.link { background: transparent; border-color: transparent; color: var(--accent-fg); box-shadow: none; }
  & .gbtn.link:hover { background: var(--neutral-muted); }
  & .gbtn.quiet { background: transparent; border-color: transparent; color: var(--fg-muted); box-shadow: none; }
  & .gbtn.quiet:hover { background: var(--neutral-muted); }
  & .gbtn.icon { width: 32px; padding: 0; }
  & .gbtn.sm.icon { width: 28px; }
  & .gbtn.blk { width: 100%; }
  & .gbtn[disabled] { opacity: .5; cursor: not-allowed; }
  & .btn-group { display: inline-flex; }
  & .btn-group > .gbtn { border-radius: 0; margin-left: -1px; position: relative; }
  & .btn-group > .gbtn:first-child, & .btn-group > .dd:first-child > .gbtn { border-radius: 6px 0 0 6px; margin-left: 0; }
  & .btn-group > .gbtn:last-child, & .btn-group > .dd:last-child > .gbtn { border-radius: 0 6px 6px 0; }
  & .btn-group > .gbtn:hover { z-index: 1; }
  & .btn-group > .gbtn.pri + .gbtn.pri, & .btn-group > .gbtn.pri + .dd > .gbtn.pri { border-left-color: #ffffff40; }
  & .btn-group > .dd > .gbtn { margin-left: -1px; }
  & .btn-group > .dd:first-child > .gbtn { margin-left: 0; }
  & .counter { display: inline-block; min-width: 20px; padding: 0 6px; font-size: 12px; font-weight: 500; line-height: 18px; text-align: center; color: var(--fg-default); background: var(--neutral-muted); border: 1px solid transparent; border-radius: 2em; }
  & .counter.att { color: #fff; background: var(--accent-emphasis); font-weight: 600; }

  /* Labels, states, chips */
  & .lb { display: inline-block; padding: 0 7px; font-size: 12px; font-weight: 500; line-height: 18px; border: 1px solid transparent; border-radius: 2em; white-space: nowrap; vertical-align: middle; }
  & a.lb:hover { text-decoration: none; filter: brightness(.94); }
  & .lb.out { color: var(--fg-muted); border-color: var(--border-default); background: transparent; }
  & .lb.warn { color: var(--attention-fg); background: var(--attention-subtle); border-color: var(--attention-muted); }
  & .lb.acc { color: var(--accent-fg); background: var(--accent-subtle); border-color: var(--accent-muted); }
  & .lb.ok { color: var(--success-fg); background: var(--success-subtle); border-color: var(--success-muted); }
  & .lb.dan { color: var(--danger-fg); background: var(--danger-subtle); border-color: var(--danger-muted); }
  & .lb.don { color: var(--done-fg); background: var(--done-subtle); border-color: var(--done-muted); }
  & .lb.neu { color: var(--fg-muted); background: var(--neutral-muted); }
  & .lb .i { width: 12px; height: 12px; margin-right: 3px; vertical-align: -2px; }
  & .state { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; font-size: 14px; font-weight: 500; color: #fff; border-radius: 2em; white-space: nowrap; }
  & .state .i { color: #fff; }
  & .state.open { background: var(--success-emphasis); }
  & .state.done { background: var(--done-emphasis); }
  & .state.gray { background: var(--neutral-emphasis); }
  & .state.bad { background: var(--danger-emphasis); }
  & .state.warn { background: var(--attention-emphasis); }
  & .state.sm { height: 22px; padding: 0 8px; font-size: 12px; }
  & .state.sm .i { width: 12px; height: 12px; }
  & .chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; font: 12px/18px var(--ui-mono); border-radius: 6px; vertical-align: middle; white-space: nowrap; }
  & .chip .i { width: 12px; height: 12px; }
  & a.chip.sha { color: var(--accent-fg); background: var(--neutral-muted); }
  & a.chip.sha:hover { text-decoration: none; background: var(--accent-subtle); }
  & .chip.test { color: var(--fg-muted); background: var(--neutral-muted); }
  & a.chip.test { color: var(--fg-default); }
  & a.chip.test:hover { text-decoration: none; background: var(--accent-subtle); }
  & .chip.br { color: var(--accent-fg); background: var(--accent-subtle); }
  & .chip.pr { color: var(--done-fg); background: var(--done-subtle); }
  & a.chip.pr:hover { text-decoration: none; background: var(--done-muted); }
  & .ganch { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; vertical-align: middle; }
  & a.chip.br:hover { text-decoration: none; background: var(--accent-muted); }
  & .chip.noproof { font-family: var(--ui-font); color: var(--attention-fg); background: var(--attention-subtle); border: 1px solid var(--attention-muted); }
  & kbd { display: inline-block; padding: 0 5px; font: 11px/18px var(--ui-mono); color: var(--fg-muted); background: var(--canvas-subtle); border: 1px solid var(--border-default); border-bottom-width: 2px; border-radius: 4px; }
  & .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success-emphasis); flex: none; }
  & .dot.idle { background: var(--fg-subtle); }
  & .dot.att { background: var(--attention-fg); }
  & .dot.bad { background: var(--danger-emphasis); }
  & .chip.test .dot { width: 8px; height: 8px; }
  & .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }

  /* Boxes and sections */
  & .box { background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; }
  & .box-h { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; background: var(--canvas-subtle); border-bottom: 1px solid var(--border-default); font-size: 14px; font-weight: 600; }
  & .box-h:first-child { border-radius: 6px 6px 0 0; }
  /* A small button in the head must not make it taller than the others, and its text ends where the counters end */
  & .box-h:has(> .gbtn.sm) { padding-block: 5px; }
  & .box-h > .gbtn.sm.quiet:last-child { margin-right: -10px; }
  & .box-h .t { font-weight: 600; color: var(--fg-default); font-size: 14px; }
  & .box-h .i { color: var(--fg-muted); }
  & .box-r { padding: 8px 16px; }
  & .box > .box-r + .box-r { border-top: 1px solid var(--border-muted); }
  & .box > .row + .row, & .box > details + details { border-top: 1px solid var(--border-muted); }
  /* a row that only says the list is empty: the same inset as a filled row */
  & .row.erow { padding: 12px 16px; }
  & .box > .row:hover { background: var(--row-hover); }
  & .box > :last-child { border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }
  /* Empty state: one line and, if there is something to do, one action. */
  & .box-empty, & .empty { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 16px; padding: 16px; color: var(--fg-muted); text-align: center; }
  & .empty { border-top: 1px solid var(--border-muted); }
  & .box-h + .empty, & .box-h + .box-empty, & .box-empty:first-child, & .box > .empty:first-child { border-top: 0; }
  & .fsec { margin-top: 16px; }
  & .sec { display: flex; align-items: center; gap: 8px; margin: 24px 0 8px; }
  & .sec h2 { font-size: 16px; font-weight: 600; }
  & .sec:first-child { margin-top: 0; }
  & .morelink { display: block; padding: 8px 16px; font-size: 14px; border-top: 1px solid var(--border-muted); }
  & .box > a.morelink:hover { background: var(--row-hover); text-decoration: none; }

  /* Menus: details.dd opens without script, div.dd with data-dd (ui-shell.js) */
  & .dd { position: relative; display: inline-block; }
  & details.dd > summary { list-style: none; cursor: pointer; }
  & details.dd > summary::-webkit-details-marker { display: none; }
  & .pop { position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; display: none; min-width: 200px; max-width: calc(100vw - 32px); max-height: min(420px, calc(100vh - 32px)); overflow-y: auto; padding: 8px 0; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 12px; box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 400; color: var(--fg-default); }
  & .pop.r { left: auto; right: 0; }
  & .dd.open > .pop, & details.dd[open] > .pop { display: block; }
  & .pop .ph { padding: 4px 16px 8px; font-size: 12px; font-weight: 600; color: var(--fg-muted); border-bottom: 1px solid var(--border-muted); margin-bottom: 4px; }
  & .pop .opt { display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 0 8px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--fg-default); text-align: left; cursor: pointer; font-size: 14px; text-decoration: none; }
  & .pop .opt:hover { background: var(--neutral-muted); text-decoration: none; }
  & .pop .opt:focus-visible { background: var(--neutral-muted); outline: 2px solid var(--accent-fg); outline-offset: -2px; text-decoration: none; }
  & .pop .opt small { margin-left: auto; color: var(--fg-muted); font-size: 12px; }
  & .pop .opt .chk { display: inline-flex; width: 16px; color: var(--fg-default); }
  & .pop .opt .chk.off { visibility: hidden; }
  & .pop hr { border: 0; border-top: 1px solid var(--border-muted); margin: 8px 0; }
  & .pop .opt.cur, & .pop .opt[aria-current] { font-weight: 600; }
  & .pop .opt .i { color: var(--fg-muted); }
  & .pop a.opt .i { color: var(--accent-fg); }
  & .pop .opt.acc { color: var(--accent-fg); }
  & .pop .who { display: flex; align-items: center; gap: 8px; padding: 4px 16px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border-muted); }
  & .pop .who b { display: block; line-height: 1.2; }
  & .pop .who span { font-size: 12px; color: var(--fg-muted); }
  & .tog { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; user-select: none; }
  & .tog input { position: absolute; opacity: 0; pointer-events: none; }
  & .tog .tr { position: relative; width: 40px; height: 24px; border: 1px solid var(--border-default); border-radius: 12px; background: var(--btn-bg); transition: background .12s; }
  & .tog .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--fg-muted); transition: transform .12s, background .12s; }
  & .tog input:checked + .tr { background: var(--accent-emphasis); border-color: var(--accent-emphasis); }
  & .tog input:checked + .tr::after { transform: translateX(16px); background: #fff; }
  & .tog input:focus-visible + .tr { outline: 2px solid var(--accent-emphasis); outline-offset: 2px; }

  /* Fields */
  & .gfield { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; color: var(--fg-muted); min-width: 0; }
  & .gfield:focus-within { border-color: var(--accent-emphasis); box-shadow: inset 0 0 0 1px var(--accent-emphasis); }
  & .gfield input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg-default); font: 14px/20px var(--ui-font); }
  /* One frame on focus: the field itself (border plus inner line), never the global outline on top of it */
  & :is(input, select, textarea).gfield:focus-visible { outline: 0; }
  /* A field the server did not accept (ui-flash.js sets aria-invalid until the next keystroke). */
  & :is(input, select, textarea)[aria-invalid="true"], & .cx:has([aria-invalid="true"]) { border-color: var(--danger-emphasis); }
  & :is(input, select, textarea)[aria-invalid="true"]:focus, & .cx:has([aria-invalid="true"]:focus) { box-shadow: inset 0 0 0 1px var(--danger-emphasis); }
  & .gfield input::placeholder, & input.gfield::placeholder, & textarea.gfield::placeholder { color: var(--fg-muted); opacity: 1; }
  /* Checkbox, radio and file button in the colours of the interface, not the browser's grey */
  & input[type="checkbox"], & input[type="radio"] { appearance: none; display: inline-grid; place-content: center; flex: none; width: 16px; height: 16px; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 4px; cursor: pointer; }
  & input[type="radio"] { border-radius: 50%; }
  & input[type="checkbox"]:checked, & input[type="radio"]:checked { background: var(--accent-emphasis); border-color: var(--accent-emphasis); }
  & input[type="checkbox"]:checked::after { content: ""; width: 8px; height: 4px; margin-top: -2px; border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff; transform: rotate(-45deg); }
  & input[type="radio"]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
  & input[type="checkbox"]:disabled, & input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }
  & input[type="file"] { color: var(--fg-muted); font-size: 13px; }
  & input[type="file"]::file-selector-button { height: 28px; margin-right: 8px; padding: 0 10px; font: 500 13px var(--ui-font); color: var(--fg-default); background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: 6px; cursor: pointer; }
  & input[type="file"]::file-selector-button:hover { background: var(--btn-hover); }
  /* The browser's own clear cross is heavy and white in dark mode; Escape clears a search field too */
  & input[type="search"]::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
  /* Typed text and placeholder share font, size and line: the placeholder does not sit higher than the text.
     A search or filter field is prose, not code: the interface font (P46); code stands in code boxes and chips. */
  & .gfield.mono-in input, & .gfield.mono-in input::placeholder { font-family: var(--ui-font); font-size: 14px; line-height: 20px; }
  & input.gfield, & select.gfield { padding: 0 12px; color: var(--fg-default); }
  & select.gfield { color-scheme: inherit; }

  /* Text from Markdown */
  & .prose { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
  & .prose > :last-child { margin-bottom: 0; }
  & .prose p, & .prose ul, & .prose blockquote { margin: 0 0 16px; }
  & .prose ul { padding-left: 2em; }
  & .prose code { padding: .2em .4em; font-family: var(--ui-mono); font-size: 85%; background: var(--neutral-muted); border-radius: 6px; }
  & .prose pre { margin: 0 0 16px; padding: 12px; overflow-x: auto; background: var(--canvas-subtle); border-radius: 6px; font: 85% var(--ui-mono); }
  & .prose blockquote { padding: 0 1em; color: var(--fg-muted); border-left: .25em solid var(--border-default); }
  & .prose h2 { margin: 24px 0 16px; padding-bottom: .3em; font-size: 20px; font-weight: 600; border-bottom: 1px solid var(--border-muted); }
  & .prose h2:first-child { margin-top: 0; }
  & .callout { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; padding: 12px 16px; background: var(--attention-subtle); border: 1px solid var(--attention-muted); border-radius: 6px; }
  & .callout > .i { color: var(--attention-fg); margin-top: 2px; }
  & .callout .k { font-size: 12px; color: var(--fg-muted); }
  & .callout .tt { font-weight: 600; }
  & .callout > div { min-width: 0; }
  & .callout .tt { overflow-wrap: anywhere; }
  & .callout.neu { background: var(--canvas-subtle); border-color: var(--border-default); }
  & .callout.neu > .i { color: var(--fg-muted); }
  & .callout.done { background: var(--done-subtle); border-color: var(--done-muted); align-items: center; }
  & .callout.done > .i { color: var(--done-fg); margin-top: 0; }
  & .callout .mono { font-family: var(--ui-mono); }
  /* Message tones: green = it worked, red = it failed (.is-danger), grey = plain note (.neu), yellow = take care (default). */
  & .callout.ok { background: var(--success-subtle); border-color: var(--success-muted); }
  & .callout.ok > .i { color: var(--success-fg); }
  & .callout.is-danger { background: var(--danger-subtle); border-color: var(--danger-muted); }
  & .callout.is-danger > .i { color: var(--danger-fg); }
  & .callout.ok .tt, & .callout.is-danger .tt { font-weight: 400; }
  & .toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px); padding: 8px 8px 8px 16px; background: var(--fg-default); color: var(--canvas-default); border-radius: 6px; box-shadow: var(--shadow-pop); font-size: 14px; }
}

@keyframes gpulse { 0% { box-shadow: 0 0 0 2px var(--canvas-default), 0 0 0 2px var(--success-muted); } 70% { box-shadow: 0 0 0 2px var(--canvas-default), 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 2px var(--canvas-default), 0 0 0 2px transparent; } }
@media (prefers-reduced-motion: reduce) { :is(.g2, .gh-header, .rband) .gav.agent .live { animation: none; } }

/* Touch targets on the phone: 44 px */
@media (max-width: 767px) {
  :is(.g2, .gh-header, .rband, .gt-foot) {
    & .wrap { padding: 0 16px; }
    & .gbtn, & .gbtn.sm { height: 44px; min-height: 44px; }
    & .gbtn.icon, & .gbtn.sm.icon { width: 44px; }
    & .pop .opt { min-height: 44px; }
    & .tog { min-height: 44px; }
    & .gfield { height: 44px; }
    & .gfield input, & input.gfield, & select.gfield { font-size: 16px; }
  }
}

/* The page keeps the room of the scrollbar, so it does not jump sideways when a page grows past the window (P45). */
html { scrollbar-gutter: stable; }
/* Shell of the GitHub-like interface: header with one search field, the band
   of a repository or organisation with its tabs (active tab = borderless folder
   card, overflow variant C), the page frame and the footer. Mock: git-native-v2
   gh.css (r3), gh5.css. */

/* Page frame */
body.ui.gt { margin: 0; background: var(--canvas-default); color: var(--fg-default); font: 14px/1.5 var(--ui-font); -webkit-text-size-adjust: 100%; }
body.ui.gt .shell { display: flex; flex-direction: column; min-height: 100vh; padding: 0; }
.shell-main:has(> main.g2) { flex: 1; max-width: none; padding: 0; }
.shell-main > main.g2 { max-width: none; padding: 0; background: var(--canvas-default); color: var(--fg-default); font: 14px/1.5 var(--ui-font); }
.shell-main > main.g2 > .wrap { padding-top: 24px; padding-bottom: 48px; }
:is(.g2, .gh-header) .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Header */
.gh-header { position: relative; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 12px 20px; background: var(--header-bg); border-bottom: 1px solid var(--border-default); font: 14px/1.5 var(--ui-font); color: var(--fg-default); }
.gh-header .shell-brand { display: inline-flex; margin: 0; color: var(--logo); font-size: 0; line-height: 0; text-decoration: none; }
.gh-header .shell-brand svg { width: 32px; height: 32px; }
.gh-header .hcrumb { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; font-size: 14px; }
.gh-header .hcrumb a, .gh-header .hcrumb .cur { color: var(--fg-default); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-header .hcrumb a.org { font-weight: 400; }
.gh-header .hcrumb a.scope { font-weight: 400; }
.gh-header .hcrumb .sl { color: var(--fg-muted); }
.gh-header .hcrumb .sl::before { content: "/"; }
.gh-header .hcrumb a:hover { color: var(--accent-fg); text-decoration: none; }
.gh-header .hs { position: relative; min-width: 0; }
.gh-header .hsf { margin: 0; }
.gh-header .hsearch { width: 272px; }
.gh-header .hsearch:focus-within { width: 400px; }
.gh-header .hsearch .i { color: var(--fg-muted); }
.gh-header .hsearch input::-webkit-search-cancel-button { display: none; }
/* The list under a search field (ui-suggest.js): the object a number names, the qualifier being typed, the search for all of it. */
.sg-host { position: relative; }
.sg-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; box-sizing: border-box; width: 100%; min-width: 320px; max-width: calc(100vw - 32px); margin: 0; padding: 4px; list-style: none; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 12px; box-shadow: var(--shadow-pop); }
.sg-list[hidden] { display: none; }
.sg-list .sg { display: flex; align-items: center; gap: 8px; min-width: 0; border-radius: 6px; cursor: pointer; }
.sg-list .sg[aria-selected="true"], .sg-list .sg:hover { background: var(--accent-subtle); }
.sg-list .sg-a { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 6px 8px; color: var(--fg-default); text-decoration: none; }
.sg-list .sg-q { justify-content: space-between; padding: 6px 8px; }
.sg-list .sg-k { font: 13px/20px var(--ui-mono); color: var(--fg-default); }
.sg-list .sg-l { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--fg-muted); white-space: nowrap; }
.sg-list .sg-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-list .hm { display: inline-flex; color: var(--fg-muted); }
.sg-list .sg + .sg-all { margin-top: 4px; border-top: 1px solid var(--border-muted); border-radius: 0 0 6px 6px; }
.gh-header .hright { display: flex; align-items: center; gap: 8px; }
.gh-header .iconbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; color: var(--fg-muted); background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: 6px; cursor: pointer; }
.gh-header .iconbtn:hover { background: var(--btn-hover); text-decoration: none; }
.gh-header .iconbtn.on { background: var(--btn-active); color: var(--fg-default); }
.gh-header .iconbtn .top-count { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; min-width: 0; padding: 0; overflow: hidden; border: 2px solid var(--header-bg); border-radius: 50%; background: var(--accent-emphasis); color: transparent; font-size: 0; line-height: 0; }
.gh-header .hplus > summary.iconbtn { width: auto; padding: 0 8px; gap: 2px; list-style: none; }
.gh-header .hplus > summary::-webkit-details-marker { display: none; }
.gh-header .hplus .pop { min-width: 200px; }
.gh-header .hplus .opt svg.i { color: var(--fg-muted); }
.gh-header .me { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; }
.gh-header .me .gav { width: 32px; height: 32px; font-size: 12px; }
/* The menu is as high as its content and at most as high as the window below the header, so a
   window of 600 px shows it whole, "Sign out" included. The five entries stand in two columns, the
   host sits in the head, light/dark and sign out share a row, and a long list of organizations
   scrolls in itself (three rows high) instead of the whole menu. */
.gh-header .account-menu { min-width: 280px; max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); }
.gh-header .account-menu .shell-nav { display: grid; grid-template-columns: 1fr 1fr; }
.gh-header .account-menu .shell-nav .opt { width: auto; margin: 0 4px; padding-inline: 8px; }
.gh-header .account-menu .org-list { max-height: 104px; overflow-y: auto; }
.gh-header .account-menu :is(.theme-pick, .lang-pick) { display: flex; gap: 2px; margin: 4px 8px; padding: 2px; background: var(--neutral-muted); border-radius: 8px; }
.gh-header .account-menu :is(.theme-pick, .lang-pick) .opt { flex: 1 1 0; width: auto; min-width: 0; margin: 0; padding: 4px 6px; justify-content: center; gap: 4px; font-size: 13px; }
.gh-header .account-menu :is(.theme-pick, .lang-pick) .opt span { flex: 0 1 auto; }
.gh-header .account-menu :is(.theme-pick .opt[aria-checked="true"], .lang-pick .opt[aria-pressed="true"]) { background: var(--canvas-default); box-shadow: 0 0 0 1px var(--border-default); font-weight: 600; }
.gh-header .account-menu .theme-pick .opt[aria-checked="true"] svg.i { color: var(--fg-default); }
.gh-header .account-menu .account-foot { display: flex; margin: 0 8px; }
.gh-header .account-menu .account-foot > .opt, .gh-header .account-menu .account-foot > form { flex: 1 1 0; min-width: 0; margin: 0; }
.gh-header .account-menu .account-foot .opt { width: 100%; margin: 0; }
.gh-header .account-menu hr { margin: 4px 0; }
.gh-header .account-menu .opt svg.i { color: var(--fg-muted); }
.gh-header .account-menu .opt span { flex: 1; min-width: 0; }
.gh-header .account-menu .ph { border-bottom: 0; padding-bottom: 4px; }
.gh-header .account-menu form { margin: 0; }
.gh-header .account-menu .opt span.ck { flex: none; display: inline-flex; margin-left: auto; }
.gh-header .account-menu .opt span.ck svg.i { color: var(--success-fg); }
.gh-header .account-menu .shell-badge { display: inline-block; min-width: 20px; margin-left: auto; padding: 0 6px; border-radius: 2em; background: var(--neutral-muted); color: var(--fg-default); font-size: 12px; font-weight: 500; line-height: 18px; text-align: center; }
.gh-header .account-menu .who .shell-host { display: block; margin: 0; color: var(--fg-subtle); }
.gh-header .account-menu .who .account-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.gh-header .account-menu .who .account-role { display: block; font-size: 12px; color: var(--fg-muted); }

/* Band of a repository or organisation: tabs only, no title row (the header
   carries the breadcrumb). */
.rband { background: var(--canvas-subtle); border-bottom: 1px solid var(--border-default); font: 14px/1.5 var(--ui-font); color: var(--fg-default); }
.rband.slim { padding-top: 8px; }
/* The band runs the full width of the header: its first tab (and the owner line of an organisation) stands on
   the same edge as the logo, not on the narrower content column below. */
.rband .wrap { display: flex; align-items: flex-end; gap: 16px; max-width: none; margin: 0; }
/* The row stands in a box. The nav inside is 12 px wider on each side (padding and
   negative margin cancel out) and 1 px taller at the bottom, so that the folder card
   of the open tab, its side shadow and its cover over the band line stay inside the
   scrolling row and are not cut off. */
.rband .utabs-box { position: relative; flex: 1 1 auto; min-width: 0; }
.rband .utabs-nav { position: relative; margin: 0 -12px -1px; padding: 0 12px 1px; }
.rband .band-ext { position: relative; z-index: 2; align-self: center; margin-bottom: 4px; flex: none; }
/* That open tasks wait for someone is a red dot behind the number of the Tasks tab; the names are in its title. No faces in the
   row of tabs: they are other people's, and the tabs need the room. */
.rband .band-wait { display: inline-flex; align-items: center; margin-left: 2px; }
.rband .band-wait .wdot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger-fg); }
.utabs-nav.scroll { overflow: auto hidden; scrollbar-width: none; overscroll-behavior-x: contain; scroll-padding-inline: 24px; scroll-snap-type: x mandatory; }
.utabs-nav.scroll .utabs > li { scroll-snap-align: start; }
.utabs-nav.scroll::-webkit-scrollbar { display: none; }
/* A scrolled row keeps no end padding of its own; this space after the last tab lets its focus ring show whole. Only with .scroll, so the fit check of ui-tabs.js never counts it. */
.utabs-nav.scroll .utabs::after { content: ""; flex: none; width: 4px; }
/* End of a scrolling row: a fade and, at the right, the number of tabs out of sight */
.utabs-fade { position: absolute; z-index: 3; top: 0; bottom: 0; display: flex; align-items: center; width: 96px; pointer-events: none; }
.utabs-fade[hidden] { display: none; }
.utabs-fade.l { left: -12px; width: 40px; background: linear-gradient(to right, var(--canvas-subtle) 30%, transparent); }
.utabs-fade.r { right: -12px; justify-content: flex-end; padding-right: 12px; background: linear-gradient(to left, var(--canvas-subtle) 60%, transparent); }
.rband .utabs-more { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--border-default); border-radius: 2em; background: var(--canvas-default); color: var(--fg-default); cursor: pointer; pointer-events: auto; }
.rband .utabs-more:hover { background: var(--neutral-muted); }
.utabs { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.utabs li { position: relative; padding: 8px 0; flex: none; }
.utabs li > a, .utabs li button { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; color: var(--fg-default); font-size: 14px; font-weight: 400; line-height: 30px; background: transparent; border: 0; border-radius: 6px; cursor: pointer; white-space: nowrap; }
/* The "More" at the end of a row that did not fit: it looks like a tab, its menu opens under it. */
.utabs li.tmore > details > summary { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 8px; color: var(--fg-muted); font-size: 14px; line-height: 30px; border-radius: 6px; cursor: pointer; list-style: none; white-space: nowrap; }
.utabs li.tmore > details > summary::-webkit-details-marker { display: none; }
.utabs li.tmore > details > summary:hover, .utabs li.tmore > details[open] > summary { background: var(--neutral-muted); color: var(--fg-default); }
.utabs li.tmore .pop { top: calc(100% + 6px); min-width: 180px; }
.utabs li.tmore .pop a.opt .i { color: var(--fg-muted); }
.utabs li > a:hover, .utabs li button:hover { background: var(--neutral-muted); text-decoration: none; }
.utabs li > a .i, .utabs li button .i { color: var(--fg-muted); }
.utabs li.sel > a { font-weight: 600; }
.utabs li.sel > a .i { color: var(--fg-default); }
.utabs li > a .counter { margin-left: 0; }
/* Behind the thin separator: the second group, with its names like the first, a little quieter */
.utabs li.tsep { align-self: center; width: 1px; height: 20px; padding: 0; margin: 0 2px; background: var(--border-default); }
.utabs li.aux > a { color: var(--fg-muted); }
.utabs li.aux.sel > a, .utabs li.aux.att > a { color: var(--fg-default); }
/* The label reserves the room of its bold form, so the neighbours do not move when a tab opens. */
.tl { display: inline-flex; flex-direction: column; align-items: center; }
.tl::after { content: attr(data-t); height: 0; overflow: hidden; visibility: hidden; font-weight: 600; white-space: nowrap; user-select: none; pointer-events: none; }

/* The active tab of a band is a borderless folder card: 2 px accent edge on top,
   elliptical corner radius, soft side shadow (light .07, dark .45) and a 6 px
   fillet under both lower corners. */
.rband .utabs li.sel { isolation: isolate; }
.rband .utabs li.sel > a { background: none; }
.rband .utabs li.sel::after {
  content: ""; position: absolute; z-index: -2; left: -4px; right: -4px; top: 3px; bottom: -1px;
  border: 0; border-top: 2px solid var(--tab-accent); border-radius: 8px 8px 0 0 / 10px 10px 0 0; background: var(--canvas-default);
}
.rband .utabs li.sel::before {
  content: ""; position: absolute; z-index: -3; pointer-events: none; left: -8px; right: -8px; top: 3px; bottom: -1px;
  background: linear-gradient(to left, var(--tab-shade), transparent) left / 4px 100% no-repeat,
              linear-gradient(to right, var(--tab-shade), transparent) right / 4px 100% no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent 4px, #000 12px, #000 calc(100% - var(--fr) - 10px), transparent calc(100% - var(--fr)));
          mask-image: linear-gradient(to bottom, transparent 4px, #000 12px, #000 calc(100% - var(--fr) - 10px), transparent calc(100% - var(--fr)));
}
.rband .utabs li.sel > a::before, .rband .utabs li.sel > a::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; bottom: -1px;
  width: var(--fr); height: calc(var(--fr) + 1px); box-sizing: border-box; border-bottom: 1px solid var(--border-default);
}
.rband .utabs li.sel > a::before { right: calc(100% + 4px); border-bottom-right-radius: var(--fr); box-shadow: calc(var(--fr) / 2) calc(var(--fr) / 2) 0 calc(var(--fr) / 2) var(--canvas-default); clip-path: inset(0 calc(var(--fr) * -1) -1px 0); }
.rband .utabs li.sel > a::after { left: calc(100% + 4px); border-bottom-left-radius: var(--fr); box-shadow: calc(var(--fr) / -2) calc(var(--fr) / 2) 0 calc(var(--fr) / 2) var(--canvas-default); clip-path: inset(0 0 -1px calc(var(--fr) * -1)); }

/* Tabs inside a page (write/preview of the composer, pull request, session): a plain
   underline under the open tab, as wide as the tab, 2 px accent, as on GitHub. It sits on
   the line of the row and covers it. */
.utabs-nav.plain .utabs li.sel::after, .cx-h .utabs li.sel::after, .subnav .utabs li.sel::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--tab-accent); border: 0; border-radius: 0; pointer-events: none; }

/* Footer */
.gt-foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 24px 20px 32px; border-top: 1px solid var(--border-muted); font: 12px/20px var(--ui-font); color: var(--fg-muted); }
.gt-foot a { color: var(--fg-muted); }
.gt-foot a:hover { color: var(--accent-fg); }
.gt-foot .sep { color: var(--fg-subtle); }

@media (max-width: 767px) {
  .gh-header { padding: 12px 16px; gap: 8px; }
  /* The search is one 44 px button with the magnifier; pressed, the field opens over the whole header. */
  .gh-header .hs { position: static; flex: none; }
  .gh-header .hsearch { display: flex; justify-content: center; gap: 0; width: 44px; height: 44px; padding: 0; background: var(--btn-bg); border-color: var(--btn-border); cursor: pointer; }
  .gh-header .hsearch input { flex: 0 0 0; width: 0; padding: 0; }
  .gh-header .hsearch:focus-within { position: absolute; z-index: 5; top: 12px; left: 16px; right: 16px; justify-content: flex-start; gap: 8px; width: auto; padding: 0 12px; background: var(--canvas-default); border-color: var(--accent-emphasis); cursor: text; }
  .gh-header .hsearch:focus-within input { flex: 1; width: auto; }
  .gh-header .hsearch kbd { display: none; }
  .gh-header .hsf.sg-host { position: static; }
  .gh-header .sg-list { position: fixed; top: 64px; left: 16px; right: 16px; width: auto; min-width: 0; max-width: none; }
  .gh-header .hcrumb { flex: 1 1 0; }
  /* "New …" stays: on a phone it is the only way to start an issue, an idea or a repository. Icon only, without the chevron. */
  .gh-header .hplus > summary.iconbtn { width: 44px; padding: 0; justify-content: center; }
  .gh-header .hplus > summary.iconbtn svg:nth-child(2) { display: none; }
  .gh-header .hcrumb .org, .gh-header .hcrumb .org + .sl { display: none; }
  .gh-header .sp { display: none; }
  .gh-header .shell-brand { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .gh-header .iconbtn { width: 44px; height: 44px; }
  .gh-header .me { min-width: 44px; min-height: 44px; }
  .rband .utabs li > a, .rband .utabs li button { height: 44px; }
  .rband .utabs-more { width: 44px; height: 44px; }
  .rband .wrap { padding: 0 16px; }
  .rband .band-ext { width: 44px; padding: 0; }
  .rband .band-ext .band-ext-t { display: none; }
}
@media (max-width: 1011px) {
  .rband .wrap { gap: 8px; }
}

/* Owner line above the tabs of an organization or a person (REQ-623). */
.rband .ohead { display: flex; align-items: center; gap: 16px; padding-top: 20px; padding-bottom: 12px; }
.rband .ohead h1 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.rband .ohead .ohead-pic { width: 48px; height: 48px; border-radius: 8px; border: 1px solid var(--border-default); object-fit: cover; background: var(--canvas-default); }
.rband .ohead .ohead-gh { display: inline-flex; align-items: center; gap: 4px; color: var(--fg-muted); font-size: 13px; }
.rband .ohead .ohead-gh .i { width: 14px; height: 14px; }

/* Language switcher DE | EN (REQ-715): a segmented control in the account menu and the profile, plain links in the sign-in footer. */
.lang-pick { display: inline-flex; gap: 2px; padding: 2px; background: var(--neutral-muted); border-radius: 8px; }
.lang-pick .opt { appearance: none; border: 0; background: transparent; color: var(--fg-default); font: inherit; font-size: 13px; line-height: 20px; padding: 4px 10px; border-radius: 6px; cursor: pointer; min-width: 40px; justify-content: center; text-align: center; }
.lang-pick .opt:hover { background: var(--canvas-subtle); }
.lang-pick .opt[aria-pressed="true"] { background: var(--canvas-default); box-shadow: 0 0 0 1px var(--border-default); font-weight: 600; }
.lang-pick .opt:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 1px; }
.gt-foot .lang-pick { background: transparent; padding: 0; gap: 0; }
.gt-foot .lang-pick .opt { color: var(--fg-muted); padding: 0 6px; min-width: 0; font-size: 12px; border-radius: 4px; }
.gt-foot .lang-pick .opt[aria-pressed="true"] { background: transparent; box-shadow: none; color: var(--fg-default); text-decoration: underline; text-underline-offset: 3px; }
.gt-foot .lang-pick .opt + .opt { border-left: 1px solid var(--border-muted); border-radius: 0 4px 4px 0; }
.pf .row .lang-pick { margin-left: auto; }
.gh-header .account-menu .lang-pick { display: flex; }
/* Components of the GitHub-like interface, one block each: reference pill,
   waiting stack, progress, list row, timeline entry, composer, reactions,
   hover card, copyable command block. Markup comes from components.html and
   components.go; mock: git-native-v2 gh.css, gh3.css, gh5.css. */

:is(.g2, .gh-header, .rband, .gt-foot, .pcard) {
  /* ---- Reference: icon + #nr, as plain short form (.ref) or as the pill (.ref.pill, with the title after it in the long form) ---- */
  & .ref { display: inline-flex; align-items: baseline; gap: 3px; font-family: inherit; font-size: inherit; color: var(--fg-muted); white-space: nowrap; text-decoration: none; }
  & .ref > svg, & .ref > .i { align-self: center; width: 14px; height: 14px; flex: none; }
  & .ref .num { font-variant-numeric: tabular-nums; }
  & .ref:hover .num { color: var(--accent-fg); text-decoration: underline; }
  & .ref.k-req svg { color: var(--success-fg); }
  & .ref.k-pain svg { color: var(--danger-fg); }
  & .ref.k-idea svg { color: var(--attention-fg); }
  & .ref.k-task svg { color: var(--accent-fg); }
  & .ref.k-know svg { color: var(--done-fg); }
  & .ref.k-feat svg { color: var(--done-fg); }
  & .ref.k-dec svg { color: var(--attention-fg); }
  & .ref.k-sess svg { color: var(--accent-fg); }
  & .ref.k-commit svg, & .ref.k-branch svg { color: var(--accent-fg); }
  & .ref.k-pr svg { color: var(--success-fg); }
  & .ref.k-pr.s-merged svg { color: var(--done-fg); }
  & .ref.k-pr.s-closed svg { color: var(--danger-fg); }
  & .ref.k-org svg, & .ref.k-machine svg, & .ref.k-url svg, & .ref.k-file svg, & .ref.k-lock svg { color: var(--fg-muted); }
  & .ref + .ref { margin-left: 6px; }
  /* The pill: one shape for every kind. The number is quiet, the title after it is the text; a name that is too long is cut with an ellipsis, the card says it whole. */
  & .ref.pill { box-sizing: border-box; align-items: baseline; max-width: 100%; min-width: 0; height: 20px; padding: 0 8px 0 6px; gap: 4px; font-size: 12px; font-weight: 500; line-height: 18px; color: var(--fg-default); background: var(--canvas-subtle); border: 1px solid var(--border-default); border-radius: 2em; vertical-align: baseline; }
  & .ref.pill > svg { width: 12px; height: 12px; align-self: center; }
  & a.ref.pill:hover { background: var(--btn-hover); text-decoration: none; }
  & a.ref.pill:hover .num { color: var(--accent-fg); text-decoration: none; }
  & .ref.pill .num { flex: none; min-width: 0; letter-spacing: .01em; }
  & .ref.pill .pt { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 400; color: var(--fg-default); }
  & .ref.pill .pt::before { content: ""; display: inline-block; width: 1px; height: 10px; margin-right: 6px; vertical-align: -1px; background: var(--border-default); }
  /* A pill without a title (a link, a bare number) lets its text shrink and ends it with an ellipsis, so it never outgrows a narrow side column. */
  & .ref.pill > .num:last-child { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
  & .ref.pill.mono .num { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; font-family: var(--ui-mono); font-weight: 400; letter-spacing: 0; }
  & .ref.pill + .ref.pill { margin-left: 4px; }
  & .rn { color: var(--fg-subtle); font-size: 14px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
  & a.rn:hover { color: var(--accent-fg); text-decoration: none; }

  /* ---- Waiting: one red outline around the whole stack that dips into the gaps, dot at the last avatar ---- */
  & .waits { display: inline-flex; position: relative; align-items: center; gap: 8px; margin-right: 6px; align-self: flex-start; width: max-content; }
  & .waits .wstack { position: relative; display: inline-flex; align-items: center; isolation: isolate; }
  & .waits .ring { position: relative; display: inline-flex; }
  & .waits .ring::before, & .waits .ring::after { content: ""; display: block; position: absolute; border-radius: 50%; pointer-events: none; }
  & .waits .ring::before { inset: -4px; z-index: 0; background: var(--danger-fg); }
  & .waits .ring::after { inset: -2px; z-index: 1; background: var(--canvas-default); }
  & .waits .ring .gav { position: relative; z-index: 2; width: 28px; height: 28px; font-size: 11px; box-shadow: none; border-color: transparent; }
  & .waits.multi .ring + .ring { margin-left: -5px; }
  & .waits.multi .ring:first-child .gav { z-index: 3; box-shadow: 0 0 0 2px var(--canvas-default); }
  & .waits .wstack::after { content: ""; position: absolute; z-index: 3; right: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger-fg); box-shadow: 0 0 0 2px var(--canvas-default); }
  & .waits .wn { display: none; font-size: 14px; color: var(--fg-default); }
  /* In a head line the name stands next to the ring on one line: centered with it, once (the name the stack keeps for small screens stays hidden there). */
  /* A pill with the person it waits for: they stay together when the line wraps */
  & .pair { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
  & .pair > .waits { margin-right: 4px; }
  & .person:has(> .waits) { align-items: center; gap: 8px; }
  & .dmeta .person > .waits { align-self: center; margin-right: 0; }
  & .dmeta .wl { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; }
  & .dmeta .wl .wl-age { color: var(--fg-muted); font-weight: 400; }
  & .dmeta .waits .wn { display: none; }

  /* ---- Progress ---- */
  & .prog { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-muted); white-space: nowrap; }
  & .bar { display: inline-block; width: 80px; height: 8px; border-radius: 6px; background: var(--neutral-muted); overflow: hidden; }
  & .bar i { display: block; height: 100%; background: var(--success-emphasis); border-radius: 6px; }
  & .prog.wide .bar { width: 160px; }
  & .prog.amber { color: var(--attention-fg); }
  & .prog.amber .bar i { background: var(--attention-fg); }
  & .prog.lead .pt { min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }
  & .box-h .prog { margin-left: auto; font-weight: 400; }

  /* ---- List row: state icon once, #nr muted, title; line two kind, short time, person;
          fixed columns on the right, the waiting ones left of the progress ---- */
  & .irow { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 0 8px; padding: 8px 16px; align-items: start; }
  & .irow:hover, & .irow:focus-within { background: var(--row-hover); }
  /* the icon sits in a box as high as the first title line, so its middle is the line's middle */
  & .irow > .st { display: inline-flex; align-items: center; height: 24px; }
  & .irow > div:nth-child(2) { min-width: 0; }
  & .st.open { color: var(--success-fg); }
  & .st.closed, & .st.merged, & .st.taken { color: var(--done-fg); }
  & .st.pain { color: var(--danger-fg); }
  & .st.idea { color: var(--attention-fg); }
  & .st.drop, & .st.gray { color: var(--fg-subtle); }
  /* number, title and labels run as text: a long title wraps under its number, and the labels follow the last word */
  & .irow .ti { line-height: 24px; }
  & .irow .ti a.title { font-size: 16px; font-weight: 600; color: var(--fg-default); overflow-wrap: anywhere; }
  & .irow .ti a.title:hover { color: var(--accent-fg); }
  & .irow .ti .rn { margin-right: 6px; color: var(--fg-muted); }
  & .irow .ti .lb { margin-left: 6px; vertical-align: 2px; }
  & .irow .xt { margin-top: 2px; font-size: 14px; line-height: 20px; color: var(--fg-muted); overflow-wrap: anywhere; }
  & .irow .xt + .meta { margin-top: 4px; }
  & .irow .rt-live:empty { display: none; }
  & .irow .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0 10px; margin-top: 2px; font-size: 12px; line-height: 20px; color: var(--fg-muted); }
  & .irow .meta a { color: var(--fg-muted); }
  & .irow .meta a:hover { color: var(--accent-fg); }
  & .irow .meta .art { color: var(--fg-default); font-weight: 600; }
  & .irow .meta .age { color: var(--fg-muted); }
  & .irow .meta .by { display: inline-flex; align-items: center; gap: 4px; }
  & .irow .meta .by .gav { width: 18px; height: 18px; font-size: 8px; }
  & .irow .meta .by .gav .i { width: 10px; height: 10px; }
  & .irow .meta .bn { display: inline-flex; align-items: center; gap: 4px; font: 12px var(--ui-mono); }
  & .irow .meta .bn .i { width: 12px; height: 12px; }
  & .irow .meta .ref.pill, & .irow .meta .ref.pill:hover { color: var(--fg-default); }
  & .irow .rt { display: flex; align-items: center; gap: 12px; align-self: center; min-height: 24px; font-size: 12px; color: var(--fg-muted); }
  & .irow .rt .rw { display: flex; justify-content: flex-end; min-width: 72px; }
  & .irow .rt .rp { display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 136px; }
  & .irow .rt .rp.wide { width: 184px; }
  & .irow .rt .waits { margin-right: 0; }
  & .irow .rt .waits .ring .gav { width: 24px; height: 24px; font-size: 10px; }
  & .irow .rt .rt-live { display: inline-flex; align-items: center; }
  & .irow .rt .rt-live .gav { width: 24px; height: 24px; }

  /* ---- Timeline: avatar on the line, small action icon beside the name ----
     The line is drawn in pieces, one per entry, from the middle of its avatar to the middle of the next
     one: it starts at the avatar of the first object, runs without a gap through every entry and ends at
     the last avatar (nothing runs on towards the composer). Avatars and circles are opaque and lie on it. */
  & .tlx { position: relative; margin-top: 16px; }
  & .tlx.tl0 { margin-top: 0; }
  & .tlx > .cmt { position: relative; }
  & .tlx > .cmt::before { content: ""; position: absolute; z-index: 0; left: 19px; top: 0; bottom: -16px; width: 2px; background: var(--border-default); pointer-events: none; }
  & .tlx > .cmt:first-child::before { top: 20px; }
  & .tlx > .cmt.tev:first-child::before { top: 16px; }
  & .tlx > .cmt:last-child::before { bottom: auto; height: 20px; }
  & .tlx > .cmt.tev:last-child::before { height: 16px; }
  & .tlx > .cmt:only-child::before { display: none; }
  & .tlx > .cmt > .gav, & .tlx .tav .gav { position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--canvas-default); }
  & .tlx > .cmt > .gav.agent .own, & .tlx .tav .gav.agent .own { box-shadow: 0 0 0 2px var(--canvas-default); }
  & .cmt { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; margin-bottom: 16px; scroll-margin-top: 16px; }
  & .tev .tav { display: flex; justify-content: center; align-items: flex-start; height: 32px; }
  /* The circle of an entry without a person: its tint lies over the page colour, so the line never shows through. */
  & .tev .tav .bd { --bdt: var(--neutral-muted); position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; box-sizing: content-box; width: 20px; height: 20px; margin-top: 2px; color: var(--fg-muted); background: linear-gradient(var(--bdt), var(--bdt)), var(--canvas-default); border: 4px solid var(--canvas-default); border-radius: 50%; }
  & .tev .tav .bd .i { width: 12px; height: 12px; }
  & .tev .tav .bd.ok { --bdt: var(--success-emphasis); color: #fff; }
  & .tev .tav .bd.warn { --bdt: var(--attention-subtle); color: var(--attention-fg); box-shadow: inset 0 0 0 1px var(--attention-muted); }
  & .tev .tav .bd.acc { --bdt: var(--accent-subtle); color: var(--accent-fg); box-shadow: inset 0 0 0 1px var(--accent-muted); }
  & .tev .tav .bd.don { --bdt: var(--done-emphasis); color: #fff; }
  & .tev-m { min-width: 0; }
  & .tev-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-height: 32px; padding: 4px 0; line-height: 24px; color: var(--fg-muted); font-size: 14px; }
  & .tev-s { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
  & .tev-h .ganch, & .tev-h .tev-r { margin-left: auto; }
  & .tev-r { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
  & .tev-r + .ganch { margin-left: 8px; }
  & .tev-h b, & .tev-h .person { color: var(--fg-default); font-weight: 600; }
  & .tev-h .tm { margin-left: 6px; font-size: 12px; color: var(--fg-muted); }
  & .tev-h .chip { vertical-align: 1px; margin: 0 2px; }
  & .tev-h .mono { font-size: 12px; }
  & .aic { display: inline-flex; vertical-align: -2px; margin: 0 4px 0 6px; color: var(--fg-muted); }
  & .aic .i { width: 14px; height: 14px; }
  & .aic.ok { color: var(--success-fg); }
  & .aic.warn { color: var(--attention-fg); }
  & .aic.acc { color: var(--accent-fg); }
  & .aic.don { color: var(--done-fg); }
  & .tev .bd2 { margin-top: 2px; padding: 8px 12px; min-width: 0; overflow-wrap: anywhere; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; color: var(--fg-default); }
  /* One proof: the thing as a pill, the words about it as plain grey text that wraps with the line. */
  & .pfx { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; max-width: 100%; min-width: 0; vertical-align: baseline; }
  & .pnote { flex: 1 1 14ch; min-width: 0; font-size: 12px; line-height: 18px; font-weight: 400; color: var(--fg-muted); overflow-wrap: anywhere; }
  & .pf > .pfx:has(.pnote) { flex: 1 1 260px; order: 1; }
  /* Words that are no short identifier: the icon of the kind, then grey text that wraps. */
  & .pfree { flex-wrap: nowrap; align-items: flex-start; gap: 6px; }
  & .pf > .pfx.pfree { flex: 1 1 100%; }
  & .pfree .pico { flex: none; display: inline-flex; align-items: center; height: 18px; color: var(--fg-muted); }
  & .pfree .pico .i { width: 12px; height: 12px; }
  /* Whatever chip a proof carries, it never grows wider than its line: the text is cut with an ellipsis. */
  & .pfx .chip, & .pf .chip, & .tev-h .chip { max-width: 100%; min-width: 0; }
  & .chip > .ct { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  & .bd2 .pfx { display: flex; margin-top: 4px; }
  & .bd2 .kn-body + .pfx, & .bd2 > .pfx:first-child { margin-top: 0; }

  /* ---- First object: one bubble with one head; its sections are parted by thin lines ---- */
  & .cmt.first .cbox > :not(.ch) + :not(.cf) { border-top: 1px solid var(--border-default); }
  & .cmt.first .cbox > .ch + * { border-top: 0; }
  & .cs-h { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 40px; padding: 8px 16px; background: var(--canvas-subtle); border-bottom: 1px solid var(--border-muted); font-size: 14px; font-weight: 600; color: var(--fg-default); }
  & .cs-h .i { color: var(--fg-muted); }
  & .cs-h .sp { flex: 1; }
  & .cs-h .cs-n { font-size: 12px; font-weight: 400; color: var(--fg-muted); }
  & .cs-b { padding: 12px 16px; min-width: 0; overflow-wrap: anywhere; }
  & .cs-b p { margin: 0; }
  & .cs-b p + p { margin-top: 8px; }
  & .cmt.first .ex { gap: 0; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; }
  & .cmt.first .ex-head { min-height: 40px; align-items: center; padding: 8px 16px; background: var(--canvas-subtle); border-bottom: 1px solid var(--border-muted); }
  & .cmt.first .ex-text { padding: 12px 16px; }

  & .cmt.tev:target .tev-m { box-shadow: 0 0 0 2px var(--accent-emphasis); border-radius: 6px; background: var(--accent-subtle); }
  /* A full comment: box with an arrow towards the avatar */
  & .cbox { position: relative; border: 1px solid var(--border-default); border-radius: 6px; background: var(--canvas-default); min-width: 0; }
  & .cbox::before { content: ""; position: absolute; top: 13px; left: -8px; width: 14px; height: 14px; background: var(--canvas-subtle); border-left: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); transform: rotate(45deg); }
  & .cbox .ch { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 40px; padding: 7px 16px; background: var(--canvas-subtle); border-bottom: 1px solid var(--border-default); border-radius: 6px 6px 0 0; color: var(--fg-muted); font-size: 14px; }
  & .cbox .ch b { color: var(--fg-default); }
  & .cbox .cb { padding: 16px; min-width: 0; }
  & .cbox .cf { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; }
  & .reqs + .cf { padding-top: 14px; }
  & .cmt:target > .cbox { border-color: var(--accent-emphasis); box-shadow: inset 0 0 0 1px var(--accent-emphasis); }
  & .cbox .ch .gbtn.icon { width: 24px; height: 24px; padding: 0; }
  & .cbox.gone .ch { border-bottom: 0; border-radius: 6px; }
  /* A comment that is being edited: the composer is the box's own body, no second frame. */
  & .cbox .cb:has(> form > .cx), & .cbox .cb:has(> .cx) { padding: 0; }
  & .cbox .cb .cx { border: 0; border-radius: 0 0 6px 6px; }
  & .cbox .cb .cx-h { border-radius: 0; }
  /* Earlier versions: set in from the edge, each one a quiet block with its own head. */
  & .chist { padding: 0 16px 12px; }
  & .chist > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; font-size: 12px; font-weight: 500; color: var(--fg-muted); cursor: pointer; }
  & .chist > summary { list-style: none; }
  & .chist > summary::-webkit-details-marker { display: none; }
  & .chist > summary::before { content: ""; width: 0; height: 0; border: 4px solid transparent; border-left: 6px solid currentColor; border-right: 0; }
  & .chist[open] > summary::before { transform: rotate(90deg); }
  & .chist > summary:hover { color: var(--fg-default); }
  & .chist[open] > summary { margin-bottom: 4px; }
  & .cver { margin-top: 8px; padding: 8px 12px; color: var(--fg-muted); background: var(--canvas-subtle); border: 1px solid var(--border-muted); border-radius: 6px; }
  & .cvh { margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--fg-muted); }
  & .cver .prose { font-size: 14px; }
  /* The file field: a button; the native field lies over it, invisible. */
  & .filepick { position: relative; max-width: 100%; min-width: 0; cursor: pointer; }
  & .filepick input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; font-size: 0; }
  & .filepick:focus-within { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
  & .filepick .fpt { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  & .filepick.has .fpt { color: var(--accent-fg); }
  /* Removing a comment asks first: the cross opens a small card under it. */
  & details.cdel { position: relative; }
  & details.cdel > summary { list-style: none; }
  & details.cdel > summary::-webkit-details-marker { display: none; }
  & details.cdel[open] > summary { background: var(--btn-active); }
  & .cdp { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; width: 260px; max-width: calc(100vw - 32px); padding: 12px; color: var(--fg-default); background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 8px; box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 400; }
  & .cdp p { margin: 0 0 12px; }
  & .cdp .cda { display: flex; justify-content: flex-end; gap: 8px; }
  & .cdp .cda form { display: flex; margin: 0; }
  & .gbtn.dzf { color: #fff; background: var(--danger-emphasis); border-color: var(--danger-emphasis); }

  /* ---- Reactions: "👍 3", blue when you reacted; add button is a round smiley with plus ---- */
  & .react { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--fg-muted); background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 2em; cursor: pointer; }
  & .react:hover { background: var(--btn-hover); }
  & .react .em { font-size: 14px; line-height: 1; }
  & .react.on { color: var(--accent-fg); background: var(--accent-subtle); border-color: var(--accent-muted); }
  & .react.add { position: relative; width: 28px; height: 28px; padding: 0; border-radius: 50%; justify-content: center; }
  & .react.add .i { width: 16px; height: 16px; color: var(--fg-muted); }
  & .react.add:hover .i { color: var(--accent-fg); }
  & span.react { cursor: default; }
  & span.react:hover { background: var(--canvas-default); }
  & span.react.on:hover { background: var(--accent-subtle); }
  & .reacts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  & .reacts form { display: flex; margin: 0; }
  & .reacts .react { font-family: inherit; }
  /* Picker of the add button: a details element, so it opens without script */
  & .rpick { position: relative; }
  & .rpick > summary { list-style: none; }
  & .rpick > summary::-webkit-details-marker { display: none; }
  & .rpick > summary:focus-visible, & .reacts .react:focus-visible, & .rc:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 1px; }
  & .rpick[open] > summary { background: var(--accent-subtle); border-color: var(--accent-muted); }
  & .rpick[open] > summary .i { color: var(--accent-fg); }
  & .rpop { position: absolute; z-index: 40; left: 0; top: calc(100% + 6px); display: flex; flex-wrap: wrap; gap: 2px; width: max-content; max-width: calc(100vw - 32px); padding: 4px; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 8px; box-shadow: var(--shadow-pop); }
  & .rc { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; font: inherit; background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
  & .rc .em { font-size: 18px; line-height: 1; }
  & .rc:hover { background: var(--btn-hover); }
  & .rc.on { background: var(--accent-subtle); border-color: var(--accent-muted); }
  & .reacts.busy { opacity: .6; pointer-events: none; }

  /* ---- Hover card of a number chip ---- */
  & .hc { position: relative; display: inline-flex; }
  & .nchip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; font: 12px/20px var(--ui-mono); color: var(--accent-fg); background: var(--neutral-muted); border-radius: 2em; }
  & .nchip:hover { text-decoration: none; background: var(--accent-subtle); }
  & .hcard { display: none; flex-direction: column; gap: 2px; position: absolute; z-index: 40; right: 0; top: calc(100% + 4px); width: 272px; padding: 10px 12px; text-align: left; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 8px; box-shadow: var(--shadow-pop); font-size: 12px; white-space: normal; }
  & .hcard::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
  & .hcard b { font-size: 13px; line-height: 1.35; color: var(--fg-default); }
  & .hcard span { color: var(--fg-muted); }
  & .hc:hover .hcard, & .hc:focus-within .hcard, & .hc.show .hcard { display: flex; }
  & .hc:hover, & .hc:focus-within { z-index: 41; }

  /* ---- Copyable command block with OS tabs (macOS, Linux) ---- */
  & .ostabs { margin-top: 4px; }
  & .ostl { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px -11px; }
  & .ostl button { height: 28px; padding: 0 10px; font: inherit; font-size: 12px; color: var(--fg-muted); background: none; border: 1px solid transparent; border-radius: 14px; cursor: pointer; }
  & .ostl button:hover { color: var(--fg-default); background: var(--neutral-muted); }
  & .ostl button[aria-selected="true"] { color: var(--fg-default); font-weight: 600; background: var(--canvas-default); border-color: var(--border-default); }
  & .ostl button:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 1px; }
  & .cmdc { position: relative; }
  & .cmd .u { color: var(--accent-fg); }
  & .cmd { display: block; min-height: 40px; margin: 0; padding: 9px 96px 9px 12px; overflow-x: auto; font: 13px/1.5 var(--ui-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-default); background: var(--canvas-subtle); border: 1px solid var(--border-muted); border-radius: 6px; }
  & .cmdc .gbtn { position: absolute; top: 50%; transform: translateY(-50%); right: 6px; }
  /* One copy button everywhere (template uicopy): icon, then the label; the tick and "Copied" take the
     place of both for a moment and never change the width of the button. */
  & .copy .i + .i { display: none; }
  & .copy.done .i:first-of-type { display: none; }
  & .copy.done .i + .i { display: inline-block; color: var(--success-fg); }
  & .copy .clb { display: inline-grid; justify-items: center; }
  & .copy .clb > span { grid-area: 1 / 1; }
  & .copy .clb > span + span { visibility: hidden; }
  & .copy.done .clb > span:first-child { visibility: hidden; }
  & .copy.done .clb > span + span { visibility: visible; }

  /* ---- Composer: write/preview, toolbar, text field, footer with hint left and buttons right ---- */
  & .cx { position: relative; min-width: 0; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; }
  & .cx-h { display: flex; align-items: stretch; gap: 8px; min-height: 44px; padding: 0 8px 0 4px; background: var(--canvas-subtle); border-bottom: 1px solid var(--border-default); border-radius: 6px 6px 0 0; }
  & .cx-h .utabs-nav { align-self: stretch; }
  & .cx-h .utabs { gap: 8px; }
  & .cx-h .utabs li { padding: 8px 0 0; }
  & .cx-h .utabs li.sel::after { bottom: -1px; }
  & .cx-h .wtools { display: flex; align-items: center; align-self: stretch; padding-top: 5px; }
  & .cx-h .wtools.off { opacity: .4; pointer-events: none; }
  & .cx-h .wtools .gbtn { width: 28px; padding: 0; }
  & .cx-b { padding: 12px 12px 0; }
  & .cx-w { position: relative; }
  /* The names an @ offers (mentions.js), in every editor that has the list. */
  & .comp-suggest { position: absolute; z-index: 40; left: 12px; bottom: calc(100% + 4px); min-width: 260px; margin: 0; padding: 4px; list-style: none; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 12px; box-shadow: var(--shadow-pop); }
  & .comp-suggest li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
  & .comp-suggest li[aria-selected="true"], & .comp-suggest li:hover { background: var(--accent-subtle); }
  & .comp-suggest small { color: var(--fg-muted); }
  & .cx textarea { display: block; width: 100%; min-height: 96px; resize: vertical; padding: 8px 12px; color: var(--fg-default); background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; font: 14px/1.5 var(--ui-font); }
  & .cx.tall textarea { min-height: 280px; }
  & .cx textarea:focus { outline: 0; border-color: var(--accent-emphasis); box-shadow: inset 0 0 0 1px var(--accent-emphasis); }
  & .cx textarea::placeholder { color: var(--fg-subtle); }
  /* The preview is the text field in reading form: same frame, radius and padding. It is at least as tall
     as the field (the script sets that when it switches) and grows with the text, whatever its length
     (REQ-705): nothing in it is cut at the bottom, the page scrolls. Only a wide table or diagram scrolls
     sideways inside it. */
  & .cx-pv { box-sizing: border-box; overflow-x: auto; min-height: 96px; padding: 8px 12px; color: var(--fg-default); background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; }
  /* The status row: every state the object can be in is one entry, the one it is in now carries a dot, the
     one that is chosen is filled. The words written above are the comment on the change. */
  & .cx-m { padding: 12px 12px 0; }
  & .cx-st { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
  & .cx-sl { font-size: 12px; font-weight: 600; color: var(--fg-muted); }
  /* Why an entry of the status row cannot be chosen, in words beside it. */
  & .cx-note { flex: 1 1 220px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--fg-muted); }
  & .cx-seg { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
  & .cx-opt { position: relative; display: inline-flex; cursor: pointer; }
  & .cx-opt.off { cursor: default; }
  & .cx-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
  & .cx-opt .sl { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font-size: 14px; line-height: 20px; color: var(--fg-default); background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: 6px; white-space: nowrap; }
  & .cx-opt:hover .sl { background: var(--btn-hover); }
  & .cx-opt input:checked + .sl { font-weight: 600; background: var(--accent-subtle); border-color: var(--accent-emphasis); box-shadow: inset 0 0 0 1px var(--accent-emphasis); }
  & .cx-opt input:focus-visible + .sl { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
  & .cx-opt.off .sl { color: var(--fg-subtle); background: none; border-style: dashed; }
  & .cx-opt .cdot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-muted); }
  & .cx-opt input:checked + .sl .cdot { background: var(--accent-fg); }
  & .cx-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  & .cx-m:not(:has(.cx-fl:not([hidden]))) { display: none; }
  & .cx-fl { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--fg-default); }
  & .cx-fl[hidden] { display: none; }
  & .cx-fl.wide { grid-column: 1 / -1; }
  & .cx-fl .gfield { font-weight: 400; color: var(--fg-default); }
  & .cx-fl .req::before { content: "*"; margin-left: 2px; color: var(--danger-fg); }
  /* Menu that ui-select.js puts in place of a native select */
  /* The hidden native select stays a form control but takes no room: width and height are capped,
     because a rule like ".fl select.gfield { width: 100% }" would otherwise stretch it past the window. */
  & select.gfield.selx-native { position: absolute; width: 1px; height: 1px; max-width: 1px; max-height: 1px; min-width: 0; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
  & .selx { display: flex; width: 100%; min-width: 0; }
  & .selx > .gbtn { flex: 1; justify-content: space-between; min-width: 0; font-size: 14px; font-weight: 400; }
  & .selx.sm > .gbtn { font-size: 13px; }
  & .selx > .gbtn .ddv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  & .selx > .gbtn .ddv.ph { color: var(--fg-muted); }
  & .selx > .pop { min-width: 100%; width: max-content; max-width: min(360px, calc(100vw - 32px)); }
  & .pop .pf { display: block; width: calc(100% - 16px); height: 28px; margin: 0 8px 4px; padding: 0 8px; color: var(--fg-default); background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; font: 13px/20px var(--ui-font); }
  & .pop .pf:focus { outline: 0; border-color: var(--accent-emphasis); box-shadow: inset 0 0 0 1px var(--accent-emphasis); }
  & .selx.is-quiet, & .invite .selx, & .lnew .selx, & .resolve-form .selx, & .save-f .selx, & .sbarrow .selx, & .ntools .selx { display: inline-flex; width: auto; flex: none; }
  & .invite .selx { min-width: 120px; }
  & .selx.is-quiet > .gbtn { flex: none; }
  & .cx-f { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px; }
  & .cx-f .dd > .gbtn { height: 32px; font-size: 14px; font-weight: 400; }
  & .cx-f .gbtn { flex: none; }
  & .ddl::after { content: ":"; }
  & .cx-hint { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; color: var(--fg-muted); }
  & .cx-hint .i { width: 16px; height: 16px; color: inherit; }
  & .gbtn.dangerf { background: var(--danger-emphasis); border-color: #1f232826; color: #fff; }
  & .gbtn.dangerf:hover { background: var(--danger-emphasis); filter: brightness(.92); }
  & .cx[data-mode="stop"] [data-submit] .i { color: #fff; }
  & .cmt.cx-cmt { align-items: start; }
  & .cx-cmt > .cx::before { content: ""; position: absolute; top: 14px; left: -8px; width: 14px; height: 14px; background: var(--canvas-subtle); border-left: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); transform: rotate(45deg); }
}

@media (max-width: 1011px) {
  :is(.g2) .irow .rt .rp { width: auto; }
}
@media (max-width: 767px) {
  :is(.g2, .gh-header, .rband, .gt-foot) {
    & .irow { grid-template-columns: 16px minmax(0, 1fr); }
    & .irow .rt { grid-column: 2; flex-wrap: wrap; gap: 4px 16px; min-height: 0; margin-top: 4px; align-self: start; }
    & .irow .rt .rw { min-width: 0; }
    & .irow .rt .rw:empty, & .irow .rt .rp:empty { display: none; }
    & .irow .rt .rp { width: auto; }
    & .irow .meta .mono { overflow-wrap: anywhere; }
    & .waits .wn { display: inline; }
    & .waits { min-height: 44px; }
    & .irow .rt .waits { min-height: 0; }
    & .react { min-height: 44px; min-width: 44px; }
    & .react.add { width: 44px; }
    & .rc { width: 40px; height: 40px; }
    & .cmt { grid-template-columns: minmax(0, 1fr); }
    & .cmt > .gav { display: none; }
    & .cbox::before { display: none; }
    & .tlx > .cmt::before { display: none; }
    & .tlx > .cmt.tev:has(+ .cmt.tev)::before { display: block; top: 0; bottom: -16px; height: auto; }
    & .cmt.tev { grid-template-columns: 40px minmax(0, 1fr); gap: 16px; }
    & .cmt.tev > .gav { display: inline-flex; }
    & .cx-h .wtools { display: none; }
    & .cx-grid { grid-template-columns: minmax(0, 1fr); }
    & .cx-f .gbtn:last-child { margin-left: auto; }
    & .cx-f .sp { display: none; }
    & .cx-cmt > .cx::before { display: none; }
    & .cmdc .cmd { padding: 9px 12px 52px; }
    & .cmdc .gbtn { top: auto; bottom: 8px; right: 8px; transform: none; }
  }
}

/* ---- Confirm: a destructive button asks first. The summary is the button that was there; the popover repeats the deed as a red button. ---- */
:is(.g2) {
  & details.cfm { position: relative; display: inline-block; }
  & details.cfm > summary { list-style: none; cursor: pointer; }
  & details.cfm > summary::-webkit-details-marker { display: none; }
  & details.cfm[open] > summary { background: var(--btn-active); }
  & details.cfm .cfp { position: absolute; z-index: 40; top: calc(100% + 4px); right: 0; width: 280px; max-width: calc(100vw - 32px); padding: 16px; background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 12px; box-shadow: var(--shadow-pop); text-align: left; }
  & details.cfm .cfp p { margin: 0 0 12px; font-size: 14px; color: var(--fg-default); }
  & details.cfm .cfp .gbtn { width: 100%; justify-content: center; }
  /* The role a button needs, beside the disabled button (REQ-704). */
  & .needrole { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 400; color: var(--fg-muted); }
  & .needrole svg { flex: none; width: 14px; height: 14px; }
}

/* What only works with script is not shown without it (the toolbar of the composer, the copy buttons). */
html:not(.js) .js-only { display: none; }

/* A choice with a line that says what it does: the label above, the line under it. */
.pop .opt .otx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pop .opt .otx small { margin-left: 0; white-space: normal; }

/* ---- Toast: what an action did. One corner of the window for every page (the outcome after a post, the answer in
   the inbox), above everything else, so it never covers the tabs or the card being read, and it leaves by itself.
   On the phone it spans the bottom edge. ---- */
body.gt .flash.fly, body.gt .ibtoast {
  position: fixed; z-index: 100; right: 24px; bottom: 24px; left: auto; top: auto; transform: none;
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(420px, calc(100vw - 32px)); margin: 0; padding: 10px 16px;
  font: 14px/1.5 var(--ui-font); color: var(--fg-default); background: var(--canvas-default);
  border: 1px solid var(--success-muted); border-radius: 6px; box-shadow: var(--shadow-pop);
  animation: gt-toast-in .18s ease-out, gt-toast-out .4s ease 10s forwards;
}
body.gt .flash.fly > .i { flex: none; color: var(--success-fg); }
body.gt .flash.fly > div, body.gt .ibtoast .tt { min-width: 0; overflow-wrap: anywhere; }
body.gt .ibtoast a { flex: none; font-weight: 600; }
body.gt .flash.fly:hover, body.gt .flash.fly:focus-within, body.gt .ibtoast:hover, body.gt .ibtoast:focus-within { animation-play-state: paused; }
@keyframes gt-toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes gt-toast-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { body.gt .flash.fly, body.gt .ibtoast { animation: gt-toast-out .01s linear 10s forwards; } }
@media (max-width: 767px) {
  body.gt .flash.fly, body.gt .ibtoast { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; }
}

/* ---- Popover anchored to its button: a caret points at the middle of the button (ui-parts.js sets --caret-x and
   data-side when it places the box), and the row the question belongs to stays marked while it is open, so the
   box does not read as a loose card over the neighbouring rows. ---- */
:is(.g2) {
  & details.cfm .cfp::before, & details.resolve > .resolve-form::before, & details.rvk > .rvp::before {
    content: ""; position: absolute; top: -6px; left: calc(var(--caret-x, calc(100% - 24px)) - 5px); width: 10px; height: 10px;
    background: var(--canvas-default); border-left: 1px solid var(--border-default); border-top: 1px solid var(--border-default); transform: rotate(45deg); pointer-events: none;
  }
  & :is(.cfp, .resolve-form, .rvp)[data-side="up"]::before { top: auto; bottom: -6px; transform: rotate(225deg); }
  & :is(.row, .trow, .crit, .lrow, .mrow, .prow):has(details.cfm[open], details.resolve[open], details.rvk[open]) { background: var(--canvas-subtle); }
}
@media (max-width: 767px) {
  :is(.g2.id) .resolve-form::before { display: none; }
}
/* Layout of the pages that already stand on the new base: inbox, issue list,
   issue page. Phase 2 adds the rules of the other pages here (or in files of
   their own named ui-<page>.css). Mock: git-native-v2 gh.css. */

:is(.g2) {
  /* ---- Inbox ---- */
  & .ntools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
  & .ntools .dd { position: relative; }
  & .nrow { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 0 12px; padding: 12px 16px; align-items: start; cursor: pointer; transition: opacity .3s; }
  & .nrow:hover, & .nrow:focus-within { background: var(--row-hover); }
  & .nrow > .gav { margin-top: 2px; }
  & .nrow .top2 { font-size: 12px; color: var(--fg-muted); line-height: 20px; }
  & .nrow .top2 b { color: var(--fg-default); font-weight: 600; }
  & .nrow .top2 .tmr { margin-left: 4px; }
  & .nrow .top2 .tmr.warn { color: var(--attention-fg); }
  & .nrow .t { margin-top: 2px; font-size: 14px; font-weight: 600; line-height: 20px; }
  & .nrow .t .ref { margin-right: 6px; font-weight: 400; }
  & .nrow .t .ib-num { margin-right: 6px; color: var(--fg-muted); font-weight: 400; }
  & .nrow .acts { display: flex; align-items: center; justify-content: flex-end; align-self: center; gap: 8px; }
  & .nrow form { display: inline-flex; margin: 0; }
  & .nrow .rt-live { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 8px; }
  & .nrow .rt-live .gav { width: 18px; height: 18px; }
  & .nrow .gav.mk { background: var(--canvas-subtle); color: var(--fg-muted); }
  & .nrow .gav.mk.ask { color: var(--accent-fg); }
  & .nrow .gav.mk .i { width: 16px; height: 16px; }
  & .gap { margin-top: 24px; }
  & h2.t { margin: 0; font-size: 14px; }

  /* ---- Lists: Issues | Ideas | Pains, search, header of the list ---- */
  & .seg { display: inline-flex; gap: 2px; max-width: 100%; padding: 2px; overflow-x: auto; background: var(--canvas-subtle); border: 1px solid var(--border-default); border-radius: 6px; }
  & .seg a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 4px; color: var(--fg-default); font-size: 14px; white-space: nowrap; }
  & .seg a:hover { background: var(--neutral-muted); text-decoration: none; }
  & .seg a:focus-visible, & .seg button:focus-visible { outline-offset: -2px; }
  & .seg a.on { background: var(--canvas-default); font-weight: 600; box-shadow: 0 0 0 1px var(--border-default); }
  & .seg a[data-seg=issue] .i { color: var(--success-fg); }
  & .seg a[data-seg=idea] .i { color: var(--attention-fg); }
  & .seg a[data-seg=pain] .i { color: var(--danger-fg); }
  & .seg .counter { margin-left: 2px; }
  /* A row of segments that does not fit scrolls; "+n" stays at its end (ui-tabs.js) and counts what is out of sight. */
  & .seg > .seg-more { position: sticky; right: -3px; flex: none; align-self: center; display: inline-flex; align-items: center; height: 24px; margin-left: -6px; padding: 0 8px; border: 1px solid var(--border-default); border-radius: 2em; background: var(--canvas-default); color: var(--fg-default); font: 600 12px/22px var(--ui-font); cursor: pointer; box-shadow: -14px 0 10px 4px var(--canvas-subtle); }
  & .seg > .seg-more[hidden] { display: none; }
  & .seg > .seg-more:hover { background: var(--neutral-muted); }
  & .segrow { margin-bottom: 16px; }
  & .sbar { display: flex; gap: 8px; margin-bottom: 16px; }
  & .sbar .gfield { flex: 1; }
  & .lh { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
  & .lh .tab { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-muted); font-weight: 400; }
  & .lh .tab:hover { color: var(--fg-default); text-decoration: none; }
  & .lh .tab.on { color: var(--fg-default); font-weight: 600; }
  & .lh .tab .i { color: inherit; }
  & .lh .tab.on .i { color: var(--fg-default); }
  & .lh .gfilters { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
  & .lh .gfilters .gbtn { color: var(--fg-muted); }
  & .lh .gfilters .gbtn:hover { color: var(--fg-default); }
  & .lh .gfilters .gbtn.on { color: var(--fg-default); font-weight: 600; }
  & .lh .gfilters .dd { position: relative; }

  /* ---- Detail pages: title, meta line, main column and sidebar ---- */
  & .dhead { padding-bottom: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--border-default); }
  & .dtitle { display: flex; align-items: flex-start; gap: 16px; }
  & .dtitle h1 { min-width: 0; font-size: 32px; line-height: 1.25; font-weight: 400; letter-spacing: 0; overflow-wrap: break-word; }
  & .dtitle h1 .n { font-weight: 300; color: var(--fg-muted); margin-left: 8px; }
  & .gacts { margin-left: auto; display: flex; gap: 8px; flex: none; padding-top: 2px; }
  & .callout .gacts { margin: 8px 0 0; padding: 0; }
  & .dmeta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; color: var(--fg-muted); font-size: 14px; }
  & .dmeta b, & .dmeta .person { color: var(--fg-default); font-weight: 600; }
  & .dgrid { display: grid; grid-template-columns: minmax(0, 1fr) 256px; gap: 24px; align-items: start; }
  & .dmain, & .side { min-width: 0; }
  /* What stands below the timeline of a page (pictures, workshop, a closing note) is set in like the
     boxes of the timeline: avatar column (40 px) plus its gap (16 px), the same space between all of them.
     The composer is already in this column. On the phone the timeline has no avatar column. */
  & .dmain > .tlx ~ :is(.box, .callout) { margin: 0 0 16px 56px; }
  /* A page without facts does not keep the column: no aside, or one with nothing in it */
  & .dgrid:not(:has(> .side *)) { grid-template-columns: minmax(0, 1fr); }
  & .side:not(:has(*)) { display: none; }
  & .side { font-size: 12px; }
  & .sblk { padding: 16px 0; border-bottom: 1px solid var(--border-muted); }
  & .sblk:first-child { padding-top: 0; }
  & .sblk h3 { margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--fg-muted); }
  & .sblk .v { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
  & .sblk .v > * { display: flex; align-items: center; gap: 8px; }
  & .sblk .v .sub, & .sblk .sub { font-size: 12px; color: var(--fg-muted); display: block; }
  & .sblk .origin { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
  /* "Built in": one session per row, the title above, who and when below it. */
  & .side .sblk .v > .sess { display: grid; flex-basis: 100%; gap: 2px; min-width: 0; align-items: start; }
  & .sess .st { min-width: 0; font-size: 14px; }
  & .sess .sm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-size: 12px; }
  & .sess .sm .gav { width: 16px; height: 16px; font-size: 8px; }
  & .sblk .v .waits { margin-right: 0; }
  & .sblk .v .dot.push { margin-left: auto; }
  & .live-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; background: var(--success-subtle); border: 1px solid var(--success-muted); border-radius: 6px; }
  & .livebar { margin-top: 12px; }
  & .livebar:empty { display: none; }
  & .live-av { display: inline-flex; flex: none; }
  & .live-tx { display: flex; flex-direction: column; min-width: 0; flex: 1 1 14rem; }
  & .live-tx small { font-size: 12px; overflow-wrap: anywhere; }
  & .side .live-side { padding-top: 0; }
  & .side .live-box { flex-direction: column; align-items: flex-start; gap: 8px; padding: 0; background: none; border: 0; }
  & .side .live-box .gbtn { align-self: stretch; }
  & .side .live-tx { flex: 0 1 auto; }
  & .rt-live { display: inline-flex; align-items: center; }

  /* ---- Requirements (criteria) ---- */
  & .crit { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px 12px; padding: 8px 16px; align-items: start; }
  & .crit.num { grid-template-columns: 20px 16px minmax(0, 1fr); }
  & .crit .tx { line-height: 20px; }
  /* A requirement is a line of words that may hold code or a link: the renderer's box takes no space of its own. */
  & .crit .tx .kn-body { font-size: inherit; line-height: inherit; }
  & .crit .tx .kn-body p, & .crit .tx .kn-body ul, & .crit .tx .kn-body ol { margin: 0; }
  & .crit .no { color: var(--fg-muted); font-size: 12px; line-height: 20px; text-align: right; font-variant-numeric: tabular-nums; }
  & .crit .no::after { content: "."; }
  & .crit .pf { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--fg-muted); }
  & .crit .pf .gav { width: 20px; height: 20px; }
  & .crit .pf .chip.sha { text-decoration: none; }
  & .crit.done .tx { color: var(--fg-default); }
  & .crit:target { background: var(--accent-subtle); }
  & .box > .crit + .crit { border-top: 1px solid var(--border-muted); }
  & .cbx { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-top: 2px; border: 1px solid var(--border-default); border-radius: 3px; background: var(--canvas-default); color: #fff; }
  & .cbx .i { width: 12px; height: 12px; stroke-width: 2; }
  & .cbx.on { background: var(--success-emphasis); border-color: var(--success-emphasis); }
  & .cbx.wip { border-color: var(--attention-fg); }
  & .cbx.wip::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--attention-fg); }
  & .cbx.waived { background: var(--neutral-muted); }
  & .cbx.waived::after { content: ""; width: 8px; height: 2px; border-radius: 1px; background: var(--fg-muted); }
  & .resolve { margin-top: 8px; }
  & .resolve > summary { list-style: none; display: inline-flex; cursor: pointer; }
  & .resolve > summary::-webkit-details-marker { display: none; }
  & .resolve-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
  & .resolve-form .gfield { height: 28px; padding: 0 8px; font: 13px/20px var(--ui-font); }
  & .resolve-form input.gfield { flex: 1 1 14rem; }
  & .lnew { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: var(--canvas-subtle); border-top: 1px solid var(--border-muted); }
  & .lnew .gfield { flex: 1; }
  /* The colour is a short hex value: a fixed width, with a dot that shows the colour */
  & .lnew .gfield.color { flex: 0 0 168px; }
  & .lnew label.gfield { margin: 0; }

  /* ---- Forms in panels (edit, move, complete, drop) ---- */
  & .newbox { margin-bottom: 16px; }
  & .newbox .cb { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
  & .panel:not([open]) { display: none; }
  & .panel > summary { list-style: none; border-bottom: 1px solid var(--border-default); }
  & .panel > summary::-webkit-details-marker { display: none; }
  & .panel .box-h { border-bottom: 0; }
  & .pform { display: flex; flex-direction: column; gap: 12px; }
  & .pfield { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
  & .pfield > span { color: var(--fg-default); }
  & .pfield .gfield { font-weight: 400; font-size: 14px; }
  & .pfield textarea { width: 100%; min-height: 8rem; padding: 8px 12px; color: var(--fg-default); background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 6px; font: 400 14px/1.5 var(--ui-font); resize: vertical; }
  & .pform .wf { display: flex; justify-content: flex-end; gap: 8px; }
  /* A line break in the text stays one (decision lines, "Question: … Decision: …") */
  & .kn-body p { white-space: pre-line; }
  & .prose .kn-body p { margin: 0 0 16px; }
  & .prose .kn-body > :last-child { margin-bottom: 0; }
  & .cbox .ex, & .cb > .ex { margin: 0 0 16px; }
}

@media (max-width: 1011px) {
  :is(.g2) .ilayout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  :is(.g2) {
    & .dgrid { grid-template-columns: minmax(0, 1fr); }
    & .side { order: 2; }
    & .dtitle h1 { font-size: 24px; }
    & .dtitle { flex-wrap: wrap; }
    & .dtitle h1 { flex: 1 1 100%; }
    & .dtitle .gacts { margin-left: 0; }
    & .dtitle .gacts { flex-wrap: wrap; max-width: 100%; }
    & .dtitle .gacts:has(.share) { flex-basis: 100%; margin-left: 0; }
    & .dtitle .share { flex-wrap: wrap; max-width: 100%; }
    & .hide-m { display: none !important; }
    & .nrow { grid-template-columns: 32px minmax(0, 1fr); }
    & .nrow .acts { grid-column: 2; margin-top: 8px; justify-content: flex-start; flex-wrap: wrap; align-self: start; }
    & .seg a { height: 44px; }
    & .lh .tab { min-height: 44px; }
    & .ntools .seg { width: 100%; }
  }
}

@media (max-width: 767px) {
  :is(.g2) .dmain > .tlx ~ :is(.box, .callout) { margin-left: 0; }
}
/* Markdown prose of the preview and the hover card of references. Mock:
   git-native-v2 gh6.css. The card sits on <body> (ui-refs.js), so .pcard is in
   the scope list of ui-base.css and ui-parts.css and gets the state pill, avatar
   and progress bar from there. */

:is(.g2, .pcard) {
  & .state.amber4 { background: var(--attention-emphasis); }
}

/* Prose beyond paragraph, list and quote */
:is(.g2) {
  & .inreply .cx .cx-pv { min-height: 72px; }
  & .prose h1, & .prose h2, & .prose h3 { line-height: 1.25; font-weight: 600; }
  & .prose h1 { margin: 24px 0 16px; padding-bottom: .3em; font-size: 24px; border-bottom: 1px solid var(--border-muted); }
  & .prose h3 { margin: 24px 0 16px; font-size: 16px; }
  & .prose h1:first-child, & .prose h3:first-child { margin-top: 0; }
  & .prose ol { margin: 0 0 16px; padding-left: 2em; }
  & .prose li + li { margin-top: .25em; }
  & .prose li > ul, & .prose li > ol { margin: .25em 0 0; }
  & .prose li > p { margin: 0 0 8px; }
  & .prose blockquote > :last-child { margin-bottom: 0; }
  & .prose pre { margin: 0 0 16px; padding: 12px 16px; overflow: auto; font: 12px/1.5 var(--ui-mono); color: var(--fg-default); background: var(--canvas-subtle); border-radius: 6px; }
  & .prose pre code { padding: 0; font-size: inherit; white-space: pre; background: none; border-radius: 0; }
  & .prose li.task { position: relative; list-style: none; }
  & .prose li.task > .cbx { position: absolute; left: -1.6em; top: 3px; margin: 0; }
  & .prose a[href^="http"]:not(.ref) { text-decoration: none; }
  & .prose a[href^="http"]:not(.ref):hover { text-decoration: underline; }
  & .prose .ref.pill { vertical-align: baseline; }
  & .prose .mention { padding: 0 4px; font-weight: 500; color: var(--accent-fg); background: var(--accent-subtle); border-radius: 6px; }
  & .prose :is(h4, h5, h6) { margin: 24px 0 16px; line-height: 1.25; font-weight: 600; font-size: 14px; }
  & .prose h4 { font-size: 15px; }
  & .prose h6 { color: var(--fg-muted); }
  & .prose :is(h2, h4, h5, h6):first-child { margin-top: 0; }
  & .prose :is(h1, h2, h3, h4, h5, h6)[id] { scroll-margin-top: 72px; }
  & .prose hr { height: 1px; margin: 24px 0; border: 0; background: var(--border-muted); }
  & .prose del { color: var(--fg-muted); }
  & .prose .tbl { max-width: 100%; margin: 0 0 16px; overflow-x: auto; }
  & .prose table { min-width: 100%; border-collapse: collapse; }
  & .prose :is(th, td) { min-width: 5em; padding: 6px 12px; border: 1px solid var(--border-default); text-align: left; overflow-wrap: normal; }
  & .prose th { font-weight: 600; background: var(--canvas-subtle); }
  & .prose tbody tr:nth-child(2n) td { background: color-mix(in srgb, var(--canvas-subtle) 50%, transparent); }
  & .prose :is(th, td).al-c { text-align: center; }
  & .prose :is(th, td).al-r { text-align: right; }
  /* Text of a person inside a note, a callout or a message: tighter than a page of prose */
  & :is(.bd2, .callout .tt, .cm-bubble, .ask-t) .kn-body :is(p, ul, ol, blockquote, pre, .tbl, hr) { margin-bottom: 8px; }
  & :is(.bd2, .callout .tt, .cm-bubble, .ask-t) .kn-body > :last-child { margin-bottom: 0; }
  & .bd2 .kn-body + .kn-body { margin-top: 8px; }
  & .bd2 .xtl { display: block; margin-bottom: 2px; }
}

/* Blocks of a text beyond plain Markdown (ui-md.js): the diagram, the section that opens and
   closes, the note box (the .callout of the page with the colour of its kind) and the image of an
   attachment. The diagram is an image of the SVG the frame drew (ui-mermaid.js); while it is drawn
   the box keeps its place and holds the source back, and when it cannot be drawn the source shows. */
:is(.g2, .pcard) {
  & .prose .mmd { margin: 0 0 16px; overflow-x: auto; }
  & .prose .mmd > pre { margin-bottom: 0; }
  & .prose .mmd[data-state="wait"] { min-height: 72px; background: var(--canvas-subtle); border-radius: 6px; }
  & .prose .mmd:is([data-state="wait"], [data-state="ok"]) > pre { display: none; }
  & .prose .mmd-img { display: block; max-width: 100%; height: auto; }
  & .prose .mmd-err { margin: 6px 0 0; font-size: 12px; color: var(--danger-fg); }
  & .prose .md-target { color: var(--fg-muted); font-size: 0.9em; }
  & .prose details.md-details { margin: 0 0 16px; }
  & .prose .md-details > summary { cursor: pointer; font-weight: 600; }
  & .prose .md-details[open] > summary { margin-bottom: 8px; }
  & .prose .md-details > :last-child { margin-bottom: 0; }
  & .prose .md-alert { margin: 0 0 16px; align-items: flex-start; }
  & .prose .md-alert > .i { margin-top: 2px; }
  & .prose .md-alert > div > :is(p, ul, ol, blockquote, pre, .tbl, hr, details) { margin-bottom: 8px; }
  & .prose .md-alert > div { color: var(--fg-default); }
  & .prose .md-alert > div > :last-child { margin-bottom: 0; }
  & .prose .md-alert-t { font-weight: 600; color: var(--attention-fg); }
  & .callout.note { background: var(--accent-subtle); border-color: var(--accent-muted); }
  & .callout.note > .i, & .md-alert.note .md-alert-t { color: var(--accent-fg); }
  & .md-alert.ok .md-alert-t { color: var(--success-fg); }
  & .md-alert.done .md-alert-t { color: var(--done-fg); }
  & .md-alert.is-danger .md-alert-t { color: var(--danger-fg); }
  /* A picture in a text is a block of its own, also in the middle of a sentence: the line does not get as
     tall as the picture (REQ-705). */
  & .prose .md-img { display: block; max-width: 100%; height: auto; margin: 8px 0; border-radius: 6px; }
}
/* The frame that draws the diagrams stays out of sight but keeps its size, so the text in it is measured. */
.mmd-frame { position: fixed; top: 0; left: -10000px; width: 1100px; height: 800px; border: 0; visibility: hidden; pointer-events: none; }

/* Hover card: one card, set next to the pill by the script */
.pcard { position: absolute; z-index: 60; display: flex; flex-direction: column; gap: 6px; width: 320px; max-width: calc(100vw - 16px); padding: 12px 14px; text-align: left; font: 12px/1.45 var(--ui-font); white-space: normal; color: var(--fg-default); background: var(--canvas-default); border: 1px solid var(--border-default); border-radius: 8px; box-shadow: var(--shadow-pop); }
.pcard[hidden] { display: none; }
/* Bridge: an invisible strip towards the pill, so the card stays open when the pointer crosses over */
.pcard::before { content: ""; position: absolute; }
.pcard[data-pos="b"]::before { left: 0; right: 0; top: -10px; height: 10px; }
.pcard[data-pos="t"]::before { left: 0; right: 0; bottom: -10px; height: 10px; }
.pcard[data-pos="r"]::before { top: 0; bottom: 0; left: -10px; width: 10px; }
.pcard[data-pos="l"]::before { top: 0; bottom: 0; right: -10px; width: 10px; }
:is(.pcard) {
  & .pc-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
  & .pc-k { display: inline-flex; align-items: center; gap: 6px; font: 12px/16px var(--ui-mono); color: var(--fg-muted); }
  & .pc-k .i { width: 14px; height: 14px; flex: none; }
  & .pc-k.k-req .i { color: var(--success-fg); }
  & .pc-k.k-pain .i { color: var(--danger-fg); }
  & .pc-k.k-idea .i { color: var(--attention-fg); }
  & .pc-k.k-task .i { color: var(--accent-fg); }
  & .pc-k.k-dec .i { color: var(--attention-fg); }
  & .pc-k.k-know .i, & .pc-k.k-feat .i, & .pc-k.k-pr.s-merged .i { color: var(--done-fg); }
  & .pc-k.k-pr .i { color: var(--success-fg); }
  & .pc-k.k-pr.s-closed .i { color: var(--danger-fg); }
  & .pc-k.k-commit .i, & .pc-k.k-branch .i { color: var(--accent-fg); }
  & .pc-t.mono { font: 600 13px/1.35 var(--ui-mono); }
  & .state { flex: none; }
  & .pc-t { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--fg-default); overflow-wrap: anywhere; }
  & .pc-b { color: var(--fg-muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  & .pc-x { color: var(--fg-default); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
  & .pc-x .k { font-weight: 600; color: var(--fg-muted); }
  & .pc-steps { margin: 0; padding: 0; list-style: none; counter-reset: pcs; color: var(--fg-default); }
  & .pc-steps li { counter-increment: pcs; display: flex; align-items: baseline; gap: 6px; padding: 1px 0; min-width: 0; }
  & .pc-steps li::before { content: counter(pcs) "."; flex: none; min-width: 14px; text-align: right; color: var(--fg-muted); }
  & .pc-steps .pcb { flex: none; align-self: center; width: 12px; height: 12px; border: 1px solid var(--border-default); border-radius: 3px; background: var(--canvas-default); }
  & .pc-steps span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  & .pc-steps li.more { color: var(--fg-muted); }
  & .pc-steps li.more::before { content: ""; min-width: 0; }
  & .pc-m { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; padding-top: 8px; color: var(--fg-muted); border-top: 1px solid var(--border-muted); }
  & .pc-by { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
  & .pc-by .gav { width: 16px; height: 16px; font-size: 7px; flex: none; }
  & .pc-by .gav .i { width: 10px; height: 10px; }
  & .prog { flex: none; }
  & .prog .bar { width: 72px; }
}
/* Rows of lists. The whole row opens its object: the link of the title (class rl)
   stretches over the row with ::after, so a click on the row, a middle click and
   the keyboard behave as on the link itself, and no script is needed. What has its own
   target (labels, pills, branch, buttons) lies above and keeps it. */

:is(.g2) {
  & :is(.row, .hit):has(.rl) { position: relative; cursor: pointer; }
  & :is(.row, .hit) .rl::after { content: ""; position: absolute; inset: 0; }
  & :is(.row, .hit):has(.rl) :is(a, button, summary, label, input, select, textarea, [data-ref], [data-pc]):not(.rl) { position: relative; z-index: 1; }
  & :is(.row, .hit):hover .rl { color: var(--accent-fg); text-decoration: none; }
  /* one sign of focus per row: the bar and the tint, not an outline around the title as well */
  & :is(.row, .hit) .rl:focus-visible { outline: none; }
  & :is(.row, .hit):has(.rl:focus-visible) { background: var(--row-hover); box-shadow: inset 3px 0 0 var(--tab-accent); }
  & .hit:hover { background: var(--row-hover); }

  /* a list narrowed to nothing: one line with the way back */
  & .box-empty[hidden] { display: none; }
}
