:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6a7180;
  --border: #e2e5ea;
  --accent: #d8232a;
  --removed: #d8232a;
  --idle: #1f8a4c;
  --active: #1f6fd8;
  --offline: #8a8f99;
  --warn-bg: #fff4e0;
  --warn-text: #7a4b00;
  --ok-bg: #e6f6ec;
  --ok-text: #14532d;
  --added-bg: #e6f6ec;
  --added-text: #14532d;
  --changed-bg: #e7effd;
  --changed-text: #1a4b99;
  --removed-bg: #fdeceb;
  --removed-text: #9b1c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --card: #1a1d23;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --border: #2b2f37;
    --removed: #ff6b6b;
    --idle: #4cc27e;
    --active: #5c9dff;
    --offline: #7d828c;
    --warn-bg: #3a2c12;
    --warn-text: #f5c87a;
    --ok-bg: #12301f;
    --ok-text: #8fe0ad;
    --added-bg: #12301f;
    --added-text: #8fe0ad;
    --changed-bg: #15284a;
    --changed-text: #a8c8ff;
    --removed-bg: #3a1618;
    --removed-text: #ffa3a3;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 860px; margin: 0 auto; padding: 16px; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--border);
}
.topbar nav, .tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a, .tabs a {
  color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px;
}
.topbar nav a.on, .tabs a.on { color: var(--text); background: var(--bg); font-weight: 600; }
.me { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.me form { margin: 0; }
.me a { color: inherit; text-decoration: none; }
.me a:hover, .me a.on { color: var(--text); text-decoration: underline; }
.tabs { margin-bottom: 16px; }

h2 { font-size: 18px; margin: 24px 0 10px; }
h2 .count { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; }
h3 { font-size: 14px; margin: 12px 0 6px; }
.updated { font-size: 13px; margin: 0; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
}
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.name { font-weight: 600; word-break: break-all; }
.labels { color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-word; }
.empty { padding: 8px 0; }

/* Runners: one tile per slot, grouped by host and pool. Runner tiles carry their status as a dot top-right;
   empty slots are dashed (Starting) or red (Missing). */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.legend > span { display: inline-flex; align-items: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; background: var(--dot); }
.dot.active, .tile.active, .chip.active { --dot: var(--active); }
.dot.idle, .tile.idle, .chip.idle { --dot: var(--idle); }
.dot.offline, .tile.offline, .chip.offline { --dot: var(--offline); }
.pools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.pool { min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.pool-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pool-head strong { font-size: 17px; }
.q { font-size: 14px; font-weight: 600; white-space: nowrap; }
.q.zero { color: var(--muted); font-weight: 400; }
.q.wait { color: var(--warn-text); background: var(--warn-bg); padding: 2px 8px; border-radius: 999px; }
.pool-sum, .left-over { font-size: 13px; color: var(--muted); }
.hosts { display: flex; gap: 8px; margin: 22px 0; }
.hosts:has(+ .left-over) { margin-bottom: 6px; }
.host { min-width: 0; }
.host-name { font-size: 12px; color: var(--muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host.down .host-name { color: var(--removed-text); }
.tiles { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.tile { position: relative; height: 76px; min-width: 0; padding: 4px; border-radius: 6px; display: flex;
        align-items: center; justify-content: center; font-size: 13px; font-weight: 600; overflow: hidden;
        background: var(--card); border: 1px solid var(--border); }
.tile.active::after, .tile.idle::after, .tile.offline::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--dot);
}
.tile.idle { color: var(--muted); }
/* Repo names are cut at the start so their distinctive end stays visible: rtl + ellipsis; &lrm; keeps punctuation in place. */
.repo { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; }
/* In a 76px tile: the repo (13px) centred about 15px under the dot, the time (11px) about 15px above the bottom. */
.tile .repo { position: absolute; top: 29px; left: 6px; right: 6px; text-align: center; }
.tile small { position: absolute; top: 47px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 400; opacity: .85; }
.tile.starting { border: 2px dashed var(--border); color: var(--muted); }
.tile.missing { background: var(--removed-bg); border: 2px dashed var(--removed); color: var(--removed-text); }
.chip { display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: 999px; background: var(--bg);
        border: 1px solid var(--border); color: var(--muted); margin: 2px 4px 0 0; }
.left-over + .queue { margin-top: 22px; }
.queue { list-style: none; margin: 8px 0 0; padding: 6px 0 0; border-top: 1px solid var(--border); font-size: 13px;
         display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, auto); grid-auto-columns: minmax(0, 340px);
         column-gap: 20px; row-gap: 2px; }
.queue li { display: flex; gap: 6px; min-width: 0; }
.queue .n, .queue .t { color: var(--muted); flex: none; }
.queue .repo { flex: 1; text-align: left; }
.waiting { font-size: 13px; }
.chip::before { content: "●"; color: var(--dot, var(--offline)); margin-right: 4px; }

.hint {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.versions { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.versions li {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
  min-width: 0; max-width: 100%; overflow-wrap: anywhere;
}

.banner { padding: 10px 12px; border-radius: 8px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-text); }
.banner.ok { background: var(--ok-bg); color: var(--ok-text); }
.banner.changelog-note { font-size: 13px; margin: 0 0 10px; }

.button {
  display: inline-block; border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none;
}
.button.secondary { background: var(--border); color: var(--text); }
button.link {
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--active);
}
button.link.danger { color: var(--accent); }

input, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
form.inline { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
form.inline input { flex: 1; min-width: 200px; }
form.stack { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
form.stack label, .fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.fields { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; align-items: flex-end; }
.fields label.check { flex-direction: row; align-items: center; padding-bottom: 8px; }
.fields label.grow { flex: 1; min-width: 180px; }
.fields input[type=number] { width: 70px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.actions { display: flex; gap: 12px; justify-content: flex-end; }
td.actions form { margin: 0; }
@media (max-width: 640px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--border); padding: 6px 0; }
  td { border: 0; padding: 2px 10px; }
  td.actions { justify-content: flex-start; }
}

.login { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.login form { margin-top: 10px; }
.card h3 { margin-top: 2px; }
.card code { overflow-wrap: anywhere; }
.card p { margin: 6px 0; }
.note { font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 16px; }

/* Linux images: pills mark an image's state, badges count changes */
.pill, .badge {
  display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600;
  line-height: 18px; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--border);
}
.pill.small { padding: 0 7px; font-size: 11px; line-height: 16px; vertical-align: 1px; }
.pill.current, .pill.added, .badge.added { background: var(--added-bg); color: var(--added-text); border-color: transparent; }
.pill.changed, .badge.changed { background: var(--changed-bg); color: var(--changed-text); border-color: transparent; }
.badge.removed { background: var(--removed-bg); color: var(--removed-text); border-color: transparent; }
.pill.rollback { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.counts { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.section-title { font-size: 16px; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.section-title .count { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; }

.host + .host { margin-top: 40px; }
.image-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: stretch; }
a.image-card {
  display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 14px 16px;
  color: inherit; text-decoration: none; font-size: 14px; min-width: 0;
}
a.image-card:hover, a.release:hover { border-color: var(--active); box-shadow: 0 1px 6px rgba(0, 0, 0, .08); }
.image-card .tag code { font-size: 15px; font-weight: 600; }
.image-card .more { color: var(--active); font-size: 13px; font-weight: 600; margin-top: auto; padding-top: 4px; }
.glance {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 6px 0 0;
  padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px;
}
.glance dt { color: var(--muted); }
.glance dd {
  margin: 0; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.releases { list-style: none; margin: 0 0 0 6px; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.releases li { position: relative; margin-bottom: 8px; }
.releases li::before {
  content: ""; position: absolute; left: -25px; top: 15px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.releases li:first-child::before { background: var(--idle); border-color: var(--idle); }
a.release {
  display: flex; justify-content: space-between; align-items: center; gap: 6px 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  color: inherit; text-decoration: none;
}
.release-tag { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.release-tag code { font-weight: 600; overflow-wrap: anywhere; }
.release-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }

/* One image's page */
.crumbs { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.crumbs a { color: var(--active); text-decoration: none; }
.release-head { padding: 16px; }
.release-head .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.release-head h1 { margin: 10px 0 14px; line-height: 1.2; }
.release-head h1 code { font-size: 20px; overflow-wrap: anywhere; }
.release-facts { margin: 0; padding-left: 20px; font-size: 14px; overflow-wrap: anywhere; }
.compare { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 4px; }
.compare a { color: var(--active); }
.diff-title { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 18px 0 6px; }
.diff-title::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--muted);
}
.diff-title.added::before { background: var(--idle); }
.diff-title.removed::before { background: var(--removed); }
.diff-title.changed::before { background: var(--active); }
.table-wrap { overflow-x: auto; }
table.data { margin-bottom: 4px; }
table.data th .muted { font-weight: 400; }
table.data td { vertical-align: top; overflow-wrap: anywhere; }
table.diff td.category { font-weight: 600; width: 26%; border-right: 1px solid var(--border); }
table.diff tr.group-row { display: none; }
table.diff tr.group-row th { background: var(--bg); color: var(--text); }
table.diff code.old { color: var(--muted); }
table.diff.changed code.new, table.diff.added code.new { font-weight: 600; }
table.diff.removed code.old { text-decoration: line-through; }
table.tools td:first-child { width: 45%; }
.group-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.group-nav a {
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 13px;
  color: var(--text); text-decoration: none; background: var(--card);
}
.group-nav a:hover { border-color: var(--active); }
.group-nav a span { color: var(--muted); margin-left: 2px; }
.tool-section { scroll-margin-top: 12px; }
.tool-section h3 { font-size: 15px; margin: 20px 0 6px; }
.tool-section h4 { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.tool-list { columns: 2 260px; column-gap: 24px; margin: 0; padding-left: 20px; font-size: 14px; }
.tool-list li { break-inside: avoid; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  table.data { display: table; }
  table.data thead { display: table-header-group; }
  table.data tbody { display: table-row-group; }
  table.data tr { display: table-row; padding: 0; }
  table.data th, table.data td { display: table-cell; padding: 6px 8px; border-bottom: 1px solid var(--border); }
  table.diff td.category, table.diff thead th:first-child { display: none; }
  table.diff tr.group-row { display: table-row; }
  table.diff code { white-space: nowrap; }
}
.token { margin-top: 8px; font-size: 13px; }
.token code { word-break: break-all; }

/* Xcode Stack: a Mac stack, one collapsed category per manifest section */
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 14px; margin-bottom: 10px; font-size: 14px; }
.categories { padding: 0; }
details.cat + details.cat { border-top: 1px solid var(--border); }
details.cat > summary {
  cursor: pointer; list-style: none; padding: 10px 14px;
  display: grid; grid-template-columns: 190px 1fr auto; gap: 12px; align-items: baseline;
}
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary::after { content: "▸"; color: var(--muted); }
details.cat[open] > summary::after { content: "▾"; }
details.cat > .table-wrap { padding: 0 14px 12px; }
.cat-name { font-weight: 600; }
.cat-name span { color: var(--muted); font-weight: 400; font-size: 13px; }
.names { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; min-width: 0; }
.names .badge { margin-left: 4px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 0 7px;
                background: var(--changed-bg); color: var(--changed-text); border-color: transparent; }
@media (max-width: 640px) {
  details.cat > summary { grid-template-columns: 1fr auto; }
  details.cat > summary .names { grid-column: 1 / -1; grid-row: 2; }
}
details.edge > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; margin: 16px 0 10px; }
details.edge > summary::-webkit-details-marker { display: none; }
details.edge > summary::before { content: "▸"; color: var(--muted); }
details.edge[open] > summary::before { content: "▾"; }
details.edge > summary h3 { display: inline; margin: 0; font-size: 16px; }

/* Xcode Stack with a changelog: the stacks scroll, the changelog stays beside them */
main.wide { max-width: 1180px; }
/* The hint and Xcode list span the page; the changelog starts level with the Stack. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "top top" "stacks rail";
          column-gap: 24px; align-items: start; }
.layout > .top { grid-area: top; }
.layout > .stacks { grid-area: stacks; }
.layout > .rail { grid-area: rail; }
.rail { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.rail h2 { margin-top: 24px; }  /* level with the Stack heading */
/* The scroll sits on a wrapper so the timeline's dots, left of its line, aren't clipped. */
.timeline-scroll { overflow-y: auto; padding: 2px 4px 2px 8px; }
.timeline li { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; }
.entry-title { display: block; font-weight: 600; }
.entry-title .img-name { display: block; font-weight: 400; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.timeline .release-meta { margin: 4px 0 6px; font-size: 12px; }
/* The whole entry picks its stack; "What changed" sits above the link. */
.timeline a.pick { position: absolute; inset: 0; border-radius: 8px; }
.timeline li:hover, .timeline li.selected { border-color: var(--active); }
button.what {
  position: relative;
  font: inherit; font-size: 13px; color: var(--active); background: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px;
}
button.what:hover { border-color: var(--active); }
dialog { border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text);
         padding: 0; width: min(680px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
               padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dialog-head button { font-size: 20px; line-height: 1; }
.dialog-body { padding: 4px 16px 16px; max-height: 70vh; overflow: auto; }
.dialog-body .old { color: var(--removed-text); background: var(--removed-bg); border-radius: 4px; padding: 0 4px; }
.dialog-body .new { color: var(--added-text); background: var(--added-bg); border-radius: 4px; padding: 0 4px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "top" "stacks" "rail"; }
  .rail { position: static; max-height: none; }
}
