:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1c2128; --muted: #636c76; --line: #d8dee4;
  --accent: #1f6feb; --accent-text: #fff; --danger: #c62828; --ok: #1a7f37; --done: #8250df;
  --add: #e6ffec; --del: #ffebe9; --hunk: #ddf4ff; --code: #f3f4f6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419; --panel: #171c23; --text: #e3e8ee; --muted: #94a0ad; --line: #2c343d;
    --accent: #4c94ff; --accent-text: #0b1220; --danger: #ff7b72; --ok: #4ac26b; --done: #b392f0;
    --add: #12301c; --del: #3c1618; --hunk: #12283d; --code: #1f262e;
  }
}
/* Mobile first: everything below is the phone layout. The block at the end
   of this file adds what wider screens change. */
* { box-sizing: border-box; }
/* 16px: smaller text in a form field makes iOS zoom the page when it is tapped. */
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; overflow-wrap: break-word; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.3rem; margin: 0; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
main { max-width: 1040px; margin: 0 auto; padding: 1rem 14px 3rem; }
/* Header, as on a phone app: a menu button on the left, the hub's name in
   the middle, and a person icon on the right that opens your settings. The
   menu button is the label of a hidden checkbox, so the menu opens and
   closes with no JavaScript. */
.top { display: grid; grid-template-columns: 2.75rem 1fr 2.75rem; align-items: center; min-height: 3.25rem; padding: 0 6px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.title { grid-column: 2; grid-row: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .5rem; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.menu-toggle { position: absolute; width: 2.75rem; height: 2.75rem; margin: 0; opacity: 0; }
.menu-button, .me { display: flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; margin: 0; color: var(--text); border-radius: 8px; cursor: pointer; }
.menu-button { grid-column: 1; grid-row: 1; }
.me { grid-column: 3; grid-row: 1; }
.me .name { display: none; }
.menu-toggle:focus-visible + .menu-button { outline: 2px solid var(--accent); }
.menu-toggle:checked + .menu-button { background: var(--bg); }
.top nav { display: none; grid-column: 1 / -1; flex-direction: column; margin: 0 -6px; border-top: 1px solid var(--line); }
.menu-toggle:checked ~ nav { display: flex; }
.top nav a, .top nav .who, .top nav button.link { display: block; width: 100%; padding: .85rem 20px; text-align: left; border-bottom: 1px solid var(--line); }
.top nav .who { color: var(--muted); }
.top nav form { margin: 0; }
.top nav form button.link { border-bottom: 0; }
.muted { color: var(--muted); }
.right { margin-left: auto; }
.num { text-align: right; white-space: nowrap; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: 0 0 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; margin: 0 0 1rem; }
.card.narrow { max-width: 420px; margin: 1rem auto; }
.card.narrow.wide { max-width: 640px; margin: 1rem auto; }
.card.notice, .alert.notice { border-color: var(--ok); }
.alert { background: var(--panel); border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: .6rem .9rem; }
.alert.error { border-color: var(--danger); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.badge, .label, .state { display: inline-block; padding: 0 .5em; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; color: var(--muted); vertical-align: middle; }
details.menu { position: relative; display: inline-block; text-align: left; }
details.menu > summary { list-style: none; cursor: pointer; padding: 0 .6rem; border: 1px solid var(--line); border-radius: 6px; font-size: 1.15rem; line-height: 1.6; color: var(--muted); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { border-color: var(--accent); color: var(--accent); }
details.menu > .menu-panel { position: absolute; right: 0; z-index: 5; width: min(21rem, 86vw); margin-top: .3rem; padding: .9rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); font-size: 1rem; color: var(--text); white-space: normal; }
details.menu .menu-danger { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
a.pill { display: inline-block; margin: .1rem .1rem .1rem 0; padding: 0 .6em; border: 1px solid var(--accent); border-radius: 999px; font-size: .82rem; line-height: 1.5; color: var(--accent); text-decoration: none; white-space: nowrap; }
a.pill:hover { background: var(--accent); color: var(--accent-text); }
a.pill.add { border-style: dashed; border-color: var(--line); color: var(--muted); }
a.pill.add:hover { background: none; border-color: var(--accent); color: var(--accent); }
.badge.state-passed { color: var(--ok); border-color: var(--ok); }
.badge.state-failed, .badge.state-timed-out, .badge.state-could-not-start { color: var(--danger); border-color: var(--danger); }
.badge.state-running { color: var(--accent); border-color: var(--accent); }
.label { color: var(--accent); border-color: var(--accent); }
.state.open { color: var(--ok); border-color: var(--ok); }
.state.closed { color: var(--done); border-color: var(--done); }
.state.blocked { color: var(--danger); border-color: var(--danger); }

label { display: block; margin: 0 0 .8rem; font-weight: 600; }
label small { display: block; font-weight: 400; color: var(--muted); }
label.check { font-weight: 400; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; max-width: 100%; margin-top: .2rem; padding: .6rem .65rem; font: inherit; font-size: 1rem; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; vertical-align: -.15rem; }
button, .button { display: inline-block; padding: .6rem 1rem; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.danger { color: var(--danger); }
button.danger:not(.link), .button.danger { border-color: var(--danger); }
button.link { padding: .35rem 0; border: 0; background: none; color: var(--accent); }
button.link.danger { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.actions.sticky { position: sticky; bottom: 0; background: var(--panel); padding: .7rem 0; border-top: 1px solid var(--line); }
.pair { display: flex; gap: .6rem; align-items: end; }
.pair label:first-child { flex: 0 0 auto; }
.pair label:first-child select { width: auto; }
.pair label:last-child { flex: 1 1 auto; min-width: 0; }
.actions.picking { gap: .4rem; }
.actions.picking button { padding: .25rem .6rem; font-size: .85rem; }
ul.picks { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--line); }
ul.picks li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 .9rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
ul.picks label.check { margin: 0; min-width: 0; overflow-wrap: anywhere; }
ul.picks li > span { grid-column: 1; font-size: .85rem; padding-left: 1.6rem; overflow-wrap: anywhere; }
ul.picks details { grid-column: 2; grid-row: 1; font-size: .85rem; color: var(--muted); }
ul.picks details[open] { grid-column: 1 / -1; grid-row: auto; }
ul.picks details label { margin: .5rem 0 0; font-weight: 400; }
form.inline, .filters { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; }
form.inline label, .filters label { margin: 0; font-weight: 400; font-size: .85rem; color: var(--muted); }
form.inline select, form.inline input, .filters select, .filters input { width: auto; }
form.inline select { flex: 0 1 auto; min-width: 0; }
.filters label { flex: 1 1 8rem; }
.filters select, .filters input { width: 100%; }
.filters { margin: 0 0 1rem; }

/* Lists. On a phone a row is a block: its cells flow one after another and
   wrap, with no column headings; a cell that needs its heading carries it
   in data-label. Wider screens turn them back into tables (end of file). */
table.list { display: block; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin: 0 0 1rem; }
table.list thead { display: none; }
table.list tbody { display: block; }
table.list tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .9rem; padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
table.list tr:last-child { border-bottom: 0; }
table.list td { display: block; min-width: 0; padding: 0; text-align: left; }
table.list td:empty { display: none; }
table.list td.main { flex: 1 1 12rem; }
table.list td.wide { flex: 1 1 100%; }
table.list td.num { margin-left: auto; }
table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
.card table.list { border: 0; }
.card table.list tr { padding-left: 0; padding-right: 0; }
.dir { font-weight: 600; }
.sha, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

.repohead { margin: 0 0 1rem; }
.repohead p { margin: .2rem 0 .6rem; }
.clone { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0; }
.clone label { margin: 0; }
.clone input { margin: 0; flex: 1 1 12rem; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 0 1.15rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .55rem 0; color: var(--text); border-bottom: 2px solid transparent; }
.tabs a.on { border-color: var(--accent); font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: 1rem; }

pre { margin: 0 0 1rem; padding: .8rem; overflow-x: auto; background: var(--code); border: 1px solid var(--line); border-radius: 8px; font: .85rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.output { max-height: 24rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
/* A run that is still going: without the page's script the box opens at its
   newest lines by itself; with it (.following) the script keeps it there
   unless the reader has scrolled away. */
.output-live { display: flex; flex-direction: column-reverse; max-height: 24rem; overflow: auto; }
.output-live.following { display: block; }
.output-live pre.output { max-height: none; overflow: visible; flex: none; margin: 0; }
/* When each part of the output was written, minutes and seconds into the
   run, shown on request above the part. */
.piece::before { content: attr(data-t); display: none; color: var(--muted); font-size: .75rem; border-top: 1px dashed var(--line); margin: .15rem 0; }
.times-switch:checked ~ pre .piece::before, .times-switch:checked ~ .output-live .piece::before { display: block; }
.times-switch { margin: 0 .35rem .6rem 0; }
label.times-label { display: inline-block; margin: 0 0 .6rem; color: var(--muted); font-size: .9rem; font-weight: 400; }
pre.plain { border: 0; background: none; padding: 0; white-space: pre-wrap; }
.diff span { display: block; min-height: 1.45em; }
.diff .add { background: var(--add); }
.diff .del { background: var(--del); }
.diff .hunk { background: var(--hunk); color: var(--muted); }
.diff .file { font-weight: 700; margin-top: .8rem; }
.diff .meta { color: var(--muted); }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0 0 .8rem; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }
.markdown { overflow-wrap: anywhere; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown img { max-width: 100%; }
.markdown table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: .25rem .6rem; }
.markdown code { background: var(--code); padding: .1em .3em; border-radius: 4px; }
.markdown pre code { background: none; padding: 0; }
.comment header { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .6rem; }
/* An issue's links. On a phone the relation sits above the issue it names,
   with Remove at the end of that line. */
.links li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.links .rel { flex: 1 1 100%; color: var(--muted); font-size: .85rem; }
.links .rel::first-letter { text-transform: uppercase; }
.links .what { flex: 1 1 10rem; min-width: 0; }
.links ul { margin: 0 0 .8rem; }
.links form.inline label { flex: 1 1 8rem; }
.links form.inline select, .links form.inline input { width: 100%; }
.history { margin-top: 1.5rem; color: var(--muted); }
.history ul { padding-left: 1.2rem; }
.alert { white-space: pre-wrap; }
.clone form { margin: 0; }
.clone button { white-space: nowrap; }
.kind { display: inline-block; padding: 0 .5em; border-radius: 999px; font-size: .78rem; border: 1px solid var(--line); color: var(--muted); }
.kind.new { color: var(--ok); border-color: var(--ok); }
.kind.deleted, .kind.conflict { color: var(--danger); border-color: var(--danger); }
.kind.modified, .kind.renamed { color: var(--accent); border-color: var(--accent); }
textarea.editor { min-height: 60vh; white-space: pre; overflow-wrap: normal; overflow-x: auto; tab-size: 4; }
.worksync form { margin: 0; }
form.tooling { align-items: baseline; gap: .1rem .6rem; margin: 0 0 .6rem; font-size: .85rem; }
form.tooling button.link { padding: 0; font-size: inherit; }
.plainlist { list-style: none; padding: 0; margin: 0; }
[hidden] { display: none !important; }
.actions label.autosave { display: inline; margin: 0 .5rem; font-weight: 400; }
dialog.unsaved { max-width: min(26rem, calc(100vw - 2rem)); padding: 1.2rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
dialog.unsaved::backdrop { background: rgba(0, 0, 0, .45); }
dialog.unsaved h2 { margin-top: 0; font-size: 1.1rem; }
dialog.unsaved .error { color: var(--danger); }

/* ---- wider screens ------------------------------------------------------- */
@media (min-width: 720px) {
  body { font-size: 15px; }
  h1 { font-size: 1.5rem; }
  main { padding: 1.25rem 16px 3rem; }
  /* The menu is laid out along the header: name, links, you, sign out. */
  .top { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; min-height: 0; padding: .45rem 16px; }
  .menu-toggle, .menu-button { display: none; }
  .title { order: 1; padding: 0; text-align: left; overflow: visible; }
  .brand { font-size: 1rem; }
  .top nav, .top .menu-toggle:checked ~ nav { display: contents; }
  .top nav a { order: 2; width: auto; padding: .2rem 0; border: 0; }
  .top nav .who { display: none; }
  .me { order: 3; width: auto; height: auto; margin-left: auto; gap: .35rem; color: var(--accent); }
  .me .name { display: inline; }
  .top svg { width: 1.15rem; height: 1.15rem; }
  .top nav form { order: 4; }
  .top nav button.link { width: auto; padding: .2rem 0; border: 0; }
  .card.narrow { margin: 3rem auto; }
  .card.narrow.wide { margin: 1rem auto; }
  .empty { padding: 2rem; }
  input:not([type=checkbox]), select, textarea { padding: .45rem .55rem; }
  button, .button { padding: .4rem .9rem; }
  button.link { padding: 0; }
  .filters label { flex: 0 1 auto; }
  .filters select, .filters input { width: auto; }
  .links .rel { flex: 0 0 8rem; font-size: inherit; }
  .links form.inline label { flex: 0 1 auto; }
  .links form.inline select, .links form.inline input { width: auto; }
  textarea { font-size: .9rem; }
  .tabs a { padding: .4rem 0; }
  table.list { display: table; border-collapse: collapse; }
  table.list thead { display: table-header-group; }
  table.list tbody { display: table-row-group; }
  table.list tr { display: table-row; padding: 0; border-bottom: 0; }
  table.list th, table.list td { display: table-cell; padding: .5rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
  table.list td:empty { display: table-cell; }
  table.list td.num { text-align: right; }
  table.list th { font-size: .8rem; color: var(--muted); font-weight: 600; }
  table.list tr:last-child td { border-bottom: 0; }
  table.list td[data-label]::before { content: none; }
  .card table.list td, .card table.list th { padding-left: 0; }
}
