:root {
  --bg: #f7f7f5; --surface: #ffffff; --text: #1d1d1b; --muted: #6b6b66; --line: #e3e2dd; --accent: #2f5bd3;
  --hot: #b4380e; --warn: #9a6a00; --ok: #2c7a3f;
  --s-open: #e8eefc; --s-progress: #e6f4ea; --s-blocked: #fde8e4; --s-owner: #fff1d6; --s-other: #efeaf9; --s-done: #ececec;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413; --surface: #1d1d1b; --text: #ecebe6; --muted: #9b9a93; --line: #2e2d2a; --accent: #7d9bf0;
    --hot: #f08a63; --warn: #e2b44d; --ok: #6cc183;
    --s-open: #1e2a45; --s-progress: #1b3324; --s-blocked: #43231b; --s-owner: #3d3016; --s-other: #2c2541; --s-done: #2a2a28;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 64px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
code { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; word-break: break-all; }
code.copy { cursor: copy; }
.pre { white-space: pre-wrap; }
.warn { color: var(--warn); }
.bad { color: var(--hot); }

nav.top { display: flex; gap: 18px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
nav.top .brand { font-weight: 650; color: var(--text); margin-right: auto; }
button { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
button.danger, .danger { color: var(--hot); }
input, select, textarea { font: inherit; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); max-width: 100%; }
textarea { width: 100%; }
label { display: block; margin: 10px 0; }
label input { display: block; width: 100%; margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 14px 0; padding: 8px 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.status { min-height: 1.5em; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
.card.narrow { max-width: 520px; margin: 40px auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.tile .n { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--muted); font-size: 13px; }
.tile.hot .n { color: var(--hot); }
.tile.warn .n { color: var(--warn); }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
tr.p-urgent td:first-child { box-shadow: inset 3px 0 var(--hot); }
tr.p-high td:first-child { box-shadow: inset 3px 0 var(--warn); }
tr.a-retired { opacity: .55; }
@media (max-width: 640px) { table { display: block; overflow-x: auto; } }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--s-open); white-space: nowrap; }
.s-in_progress { background: var(--s-progress); } .s-blocked { background: var(--s-blocked); } .s-waiting_on_owner { background: var(--s-owner); }
.s-waiting_on_other { background: var(--s-other); } .s-done, .s-dropped { background: var(--s-done); }
.tag { display: inline-block; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.due { font-size: 12px; color: var(--warn); margin-left: 6px; }

ol.log { list-style: none; padding: 0; margin: 0; }
ol.log li { padding: 7px 0; border-bottom: 1px solid var(--line); }
ol.log .when { color: var(--muted); font-size: 12px; display: block; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
summary { cursor: pointer; }
summary .kind { font-size: 11px; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
@media (max-width: 400px) { .agents { grid-template-columns: 1fr; } }
.agent header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.agent h3 { margin: 0; }
ul.conns { padding-left: 18px; }
ul.conns li { margin: 4px 0; }
form.mint { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
form.mint input { flex: 1 1 160px; }
form.rule { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 8px 0; }
form.rule input { width: 100%; margin-bottom: 6px; font-weight: 600; }
.minted code { font-size: 14px; }
ul.scopes { list-style: none; padding: 0; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .25rem .75rem; margin: .5rem 0; }
.picks .pick { display: flex; gap: .4rem; align-items: baseline; font-weight: normal; }
