/* botcomms: plain server-rendered pages. Light and dark follow the device. */
:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --ink: #1d1f21;
  --muted: #62666c;
  --line: #deddd6;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #e3f3e9;
  --bad: #b3261e;
  --bad-bg: #fbe6e4;
  --warn: #8a5a00;
  --warn-bg: #fdf1d6;
  --code-bg: #efeee8;
  --mine: #fff7da;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --panel: #1b1e21;
    --ink: #e6e6e3;
    --muted: #9aa0a6;
    --line: #2e3236;
    --accent: #7aa9f0;
    --accent-ink: #0f1a2a;
    --ok: #7fd3a0;
    --ok-bg: #173323;
    --bad: #f2a29b;
    --bad-bg: #3a1c1a;
    --warn: #f0c46a;
    --warn-bg: #33290f;
    --code-bg: #24282c;
    --mine: #2d2a17;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans);
}
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: .2rem 0 .4rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h2 a { color: inherit; text-decoration: none; }
h2 a:hover { text-decoration: underline; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg);
       padding: .05em .35em; border-radius: 5px; overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.warn { color: var(--warn); }
.lede { color: var(--muted); margin: 0 0 1rem; max-width: 70ch; }

.testbar { background: var(--warn-bg); color: var(--warn); text-align: center;
           padding: .35rem 1rem; font-weight: 600; font-size: .9rem; }

/* header and tabs */
.top { background: var(--panel); border-bottom: 1px solid var(--line);
       position: sticky; top: 0; z-index: 2; }
.top-row { display: flex; align-items: center; justify-content: space-between;
           gap: 1rem; padding: .6rem 16px 0; max-width: 1100px; margin: 0 auto; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.me { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.me form { margin: 0; }
.tag { font-size: .72rem; border: 1px solid var(--line); border-radius: 999px;
       padding: 0 .45rem; color: var(--muted); }
.tabs { display: flex; gap: .2rem; overflow-x: auto; padding: .4rem 12px 0;
        max-width: 1100px; margin: 0 auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; padding: .45rem .7rem .55rem; color: var(--muted);
          text-decoration: none; border-bottom: 2px solid transparent; font-size: .93rem; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 2rem; }
.foot { max-width: 1100px; margin: 0 auto; padding: 0 16px 2rem; color: var(--muted); font-size: .8rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 1rem; margin: 0 0 1rem; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1rem; }
.login { max-width: 460px; margin: 3rem auto; }

.flash { border-radius: var(--radius); padding: .6rem .8rem; margin: 0 0 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }

/* lists */
ul.plain, ul.entries, ul.people, ul.branches, ol.rules { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .25rem 0; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.person { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; min-width: 0; }
.person-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

.entry { border-top: 1px solid var(--line); padding: .5rem 0; min-width: 0; }
.entry:first-child { border-top: 0; }
.entry.for-me { background: var(--mine); margin: 0 -.5rem; padding: .5rem; border-radius: 6px; }
.entry-head { display: flex; flex-wrap: wrap; gap: .25rem .55rem; align-items: baseline; font-size: .88rem; }
.when { font-variant-numeric: tabular-nums; color: var(--muted); }
.kind { font-weight: 600; }
.g-rules .kind, .g-work .kind, .g-stage .kind { color: var(--accent); }
.g-deploys .kind { color: var(--warn); }
.msg { overflow-wrap: anywhere; margin-top: .15rem; }
.res { white-space: normal; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px;
        padding: 0 .5rem; background: var(--code-bg); }
.result { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 0 .5rem; }
.r-ok { background: var(--ok-bg); color: var(--ok); }
.r-failed, .r-rolled-back { background: var(--bad-bg); color: var(--bad); }
.r-partial { background: var(--warn-bg); color: var(--warn); }
.note-open { padding: 0 0 .4rem; }

.proposal, .task { border-top: 1px solid var(--line); padding: .8rem 0; }
.proposal:first-of-type, .task:first-of-type { border-top: 0; padding-top: 0; }
.task.stale { border-left: 3px solid var(--warn); padding-left: .6rem; }
.rule-text { font-size: 1rem; margin: .2rem 0; overflow-wrap: anywhere; }
ol.rules li { border-top: 1px solid var(--line); padding: .7rem 0; }
ol.rules li:first-child { border-top: 0; padding-top: 0; }
.context { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0; }
.branches li { display: flex; justify-content: space-between; align-items: center; gap: .6rem;
               flex-wrap: wrap; border-top: 1px solid var(--line); padding: .5rem 0; }
.branches li:first-child { border-top: 0; }

/* tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: .4rem .5rem; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; border-top: 0; }
.msgcell { min-width: 14rem; overflow-wrap: anywhere; }

/* forms */
form { margin: .4rem 0 0; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.add { border-top: 1px solid var(--line); margin-top: .8rem; padding-top: .8rem; }
.add label { display: block; font-weight: 600; margin-bottom: .35rem; }
.check { display: flex; gap: .4rem; align-items: flex-start; font-size: .88rem; flex: 1 1 18rem; }
input[type="text"], select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .6rem; min-width: 0; flex: 1 1 12rem; max-width: 100%;
}
button, .button {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .9rem; cursor: pointer;
  text-decoration: none; display: inline-block;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 400; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.filters { margin: 0 0 1rem; display: flex; gap: .5rem; flex-wrap: wrap; }
nav.filters a { padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 999px;
                text-decoration: none; color: var(--muted); }
nav.filters a[aria-current="true"] { color: var(--ink); border-color: var(--accent); }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; }

/* ---------------------------------------------------------------- reviews */
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem;
             flex-wrap: wrap; }
.card-head h2 { margin-bottom: .4rem; }
nav.filters.seg { margin: 0 0 .6rem; }
.empty h2 { margin-bottom: .3rem; }
.crumbs { margin: 0 0 .2rem; color: var(--muted); }
.num { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pr-title { overflow-wrap: anywhere; }
.pr-meta { display: flex; flex-wrap: wrap; gap: .2rem .45rem; align-items: baseline; max-width: none; }
.sha { font-family: var(--mono); font-size: .84em; }
a.sha { text-decoration: none; background: var(--code-bg); border-radius: 5px; padding: .05em .35em; }
.tag { white-space: nowrap; }

.chip { display: inline-block; font-size: .78rem; font-weight: 600; line-height: 1.5;
        border-radius: 999px; padding: 0 .55rem; margin: .1rem 0; white-space: nowrap;
        border: 1px solid transparent; background: var(--code-bg); color: var(--ink); }
.chip.t-ok { background: var(--ok-bg); color: var(--ok); }
.chip.t-warn { background: var(--warn-bg); color: var(--warn); }
.chip.t-bad { background: var(--bad-bg); color: var(--bad); }
.chip.t-busy, .chip.t-accent { background: var(--code-bg); color: var(--accent); border-color: var(--accent); }
.chip.t-skip { background: transparent; color: var(--warn); border: 1px dashed var(--warn); }
.chip.t-muted { color: var(--muted); }

.state { font-size: .8rem; font-weight: 600; border-radius: 6px; padding: 0 .4rem;
         border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.state.st-open { color: var(--accent); border-color: var(--accent); }
.state.st-merged { color: var(--ok); border-color: var(--ok); }
.state.st-draft, .state.st-closed, .state.st-other { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem;
         margin: .2rem 0 .7rem; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; min-width: 0;
        display: flex; flex-direction: column; gap: .1rem; }
.stat b { font-size: 1.35rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.stat.t-ok b { color: var(--ok); }
.stat.t-warn b, .stat.t-skip b { color: var(--warn); }
.stat.t-bad b { color: var(--bad); }
.verdict-big { margin: 0 0 .7rem; font-size: 1rem; }

/* pull request list: a table on wide screens, one block per row on a phone */
table.stack td { overflow-wrap: anywhere; }
.pr-link { font-weight: 600; text-decoration: none; }
.pr-link:hover { text-decoration: underline; }
.prs td:first-child { min-width: 14rem; }

/* the strip: opened to merged at a glance */
.strip-wrap { margin: .2rem 0 0; }
.strip { display: block; overflow: visible; }
.s-rail { stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.s-commit { fill: var(--muted); }
.s-person { fill: var(--panel); stroke: var(--warn); stroke-width: 2.5; }
.s-event { fill: var(--panel); stroke: var(--accent); stroke-width: 3; }
.s-event.t-ok { fill: var(--ok); stroke: var(--ok); }
.s-event.t-muted { stroke: var(--muted); }
.s-review { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.s-review.t-bad { fill: var(--bad); }
.s-review.t-muted { fill: var(--muted); }
.s-review.t-busy { fill: var(--panel); stroke: var(--accent); stroke-width: 2.5; }
.strip-wrap figcaption { display: flex; flex-direction: column; gap: .2rem; margin-top: .15rem; }
.strip-ends { display: flex; justify-content: space-between; gap: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .15rem .7rem; align-items: center; }
.lg { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .25rem;
      vertical-align: -.05rem; }
.lg-review { background: var(--accent); }
.lg-bad { background: var(--bad); }
.lg-commit { width: .2rem; border-radius: 1px; background: var(--muted); height: .8rem; }
.lg-person { border: 2px solid var(--warn); }
.lg-event { border: 2px solid var(--accent); }

/* timeline: a rail with one dot per step */
ol.timeline { list-style: none; margin: 0; padding: 0 0 0 1.4rem; position: relative; }
ol.timeline::before { content: ""; position: absolute; left: .45rem; top: .5rem; bottom: .6rem;
                      width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 .85rem; min-width: 0; }
.tl::before { content: ""; position: absolute; left: -1.33rem; top: .32rem; width: .85rem;
              height: .85rem; border-radius: 50%; background: var(--panel);
              border: 2px solid var(--muted); }
.tl.has-gap::before { top: 1.47rem; }
.tl-gap { font-size: .76rem; color: var(--muted); margin: 0 0 .1rem; font-style: italic; }
.tl-head { display: flex; flex-wrap: wrap; gap: .1rem .6rem; align-items: baseline; }
.tl-head time { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums;
                white-space: nowrap; }
.tl-head strong { overflow-wrap: anywhere; }
.tl-head a { color: inherit; }
.tl-meta { margin: .1rem 0 .15rem; }
.tl.k-review::before { background: var(--accent); border-color: var(--accent); }
.tl.k-review.t-bad::before { background: var(--bad); border-color: var(--bad); }
.tl.k-review.t-muted::before { background: var(--muted); border-color: var(--muted); }
.tl.k-review.t-busy::before { background: var(--panel); border-color: var(--accent); }
.tl.k-commits::before { border-radius: 3px; width: .7rem; height: .7rem; left: -1.26rem;
                        border-color: var(--muted); background: var(--code-bg); }
.tl.k-pr::before { border-color: var(--accent); }
.tl.k-pr.t-ok::before { background: var(--ok); border-color: var(--ok); }
.tl.k-pr.t-muted::before { border-color: var(--muted); }
.tl.k-person::before { border-color: var(--warn); }
.tl.k-note::before { width: .6rem; height: .6rem; left: -1.2rem; border-color: var(--line); }
.tl.k-note .tl-head strong { font-weight: 400; color: var(--muted); }
ul.tl-subs { list-style: none; margin: .25rem 0 0; padding: 0 0 0 .7rem;
             border-left: 2px solid var(--line); font-size: .88rem; }
ul.tl-subs li { padding: .1rem 0; overflow-wrap: anywhere; }
ul.tl-subs li.t-ok, ul.tl-subs li.t-ok a { color: var(--ok); }
ul.tl-subs li.t-warn a, ul.tl-subs li.t-skip a { color: var(--warn); }
.touch { color: var(--muted); }

/* findings */
.findings .f-main { min-width: 16rem; max-width: 30rem; }
.f-tags { display: flex; flex-wrap: wrap; gap: .25rem .45rem; align-items: center; }
.fid { font-family: var(--mono); font-weight: 700; }
.ftitle { font-weight: 600; margin: .2rem 0 .1rem; overflow-wrap: anywhere; }
.rec { margin: .2rem 0 0; overflow-wrap: anywhere; }
.where { white-space: normal; overflow-wrap: anywhere; }
ol.fhist { list-style: none; margin: 0; padding: 0; }
ol.fhist li { padding: .12rem 0 .12rem .7rem; border-left: 2px solid var(--line); overflow-wrap: anywhere; }
ol.fhist li.t-ok { border-left-color: var(--ok); }
ol.fhist li.t-warn { border-left-color: var(--warn); }
ol.fhist li.t-skip { border-left: 2px dashed var(--warn); }
ol.fhist time { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums;
                margin-right: .3rem; }
.fsteps { margin-top: .4rem; }
.fsteps ul { margin: .15rem 0 0; padding-left: 1.1rem; }
.fsteps li { overflow-wrap: anywhere; }
tr:target td { background: var(--mine); }

/* review runs */
.runs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .7rem; }
.run { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 8px;
       padding: .6rem .75rem; min-width: 0; }
.run.t-ok { border-left-color: var(--ok); }
.run.t-bad { border-left-color: var(--bad); }
.run.t-busy { border-left-color: var(--accent); }
.run-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem;
            flex-wrap: wrap; }
.run .verdict { margin: .3rem 0; font-weight: 600; overflow-wrap: anywhere; }
.bad-text { color: var(--bad); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .7rem;
           margin: .4rem 0 0; font-size: .85rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden;
                      clip: rect(0 0 0 0); }
  table.stack tr { border-top: 1px solid var(--line); padding: .6rem 0; }
  table.stack tbody tr:first-child { border-top: 0; padding-top: 0; }
  table.stack td { border: 0; padding: .15rem 0; min-width: 0; max-width: none; }
  table.stack td[data-label]::before { content: attr(data-label); display: block;
                                       font-size: .74rem; color: var(--muted); font-weight: 600; }
  .prs td[data-label] { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
  .prs td[data-label]::before { display: inline; min-width: 8.5rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dl.facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
}

@media (max-width: 520px) {
  body { font-size: 14.5px; }
  .card { padding: .8rem; }
  .branches li form { width: 100%; }
}
