:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1c2330; --muted: #5d6675; --line: #dedbd2; --accent: #1f3a5f; --accent-ink: #ffffff;
  --amber: #8a5a00; --amber-bg: #fdf1d3; --blue: #1c4f8c; --blue-bg: #e2edfa; --green: #1d6b3a; --green-bg: #dff3e5; --red: #9c2b22; --red-bg: #fbe3e0; --grey-bg: #ecebe6;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --panel: #1d2128; --ink: #e6e8ec; --muted: #9aa3b2; --line: #313743; --accent: #8fb8ee; --accent-ink: #10151c;
    --amber: #f2c467; --amber-bg: #3c2f10; --blue: #9cc4f5; --blue-bg: #1b2e47; --green: #8fd6a6; --green-bg: #173322; --red: #f2a59d; --red-bg: #43201c; --grey-bg: #272c35;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 1rem 0 .3rem; }
p { margin: .4rem 0; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--grey-bg); padding: .05em .3em; border-radius: 4px; }

.bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: -.01em; }
.bar nav { display: flex; gap: .25rem; flex: 1; }
.bar nav a { text-decoration: none; color: var(--muted); padding: .3rem .6rem; border-radius: 6px; }
.bar nav a[aria-current="page"] { color: var(--ink); background: var(--grey-bg); }
.who { display: flex; gap: .6rem; align-items: center; color: var(--muted); font-size: .9rem; }

main { max-width: 68rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.crumbs a { color: var(--muted); }
.sub { color: var(--muted); font-size: .9rem; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.cols { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 52rem) { .cols { grid-template-columns: minmax(0, 1fr); } }
section { margin-bottom: 1.5rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; text-decoration: none; color: inherit; }
a.card:hover, a.row:hover { border-color: var(--accent); }
.card .name { font-weight: 650; font-size: 1.05rem; }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; font-size: .9rem; color: var(--muted); }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }

.list { display: flex; flex-direction: column; gap: .4rem; }
.row { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: .6rem; align-items: baseline; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .8rem; text-decoration: none; color: inherit; }
.row .id { font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.row .title { overflow-wrap: anywhere; }
.row .note { grid-column: 2 / -1; font-size: .88rem; color: var(--amber); overflow-wrap: anywhere; }
@media (max-width: 34rem) { .row { grid-template-columns: minmax(0, 1fr) auto; } .row .id { grid-column: 1 / -1; } .row .note { grid-column: 1 / -1; } }

.tag { display: inline-block; font-size: .78rem; line-height: 1.5; padding: 0 .5rem; border-radius: 999px; background: var(--grey-bg); color: var(--muted); white-space: nowrap; }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.red { background: var(--red-bg); color: var(--red); }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); margin-right: .35rem; }
.dot.on { background: var(--green); }

.banner { border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; background: var(--amber-bg); color: var(--amber); overflow-wrap: anywhere; white-space: pre-wrap; }
.banner.red { background: var(--red-bg); color: var(--red); }
.empty { color: var(--muted); padding: .5rem 0; }

button, .button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: .45rem .85rem; min-height: 2.5rem; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--red); border-color: var(--red); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

form { display: grid; gap: .7rem; }
label { display: grid; gap: .2rem; font-size: .9rem; color: var(--muted); }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); }
input[type=text], input[type=number], textarea, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; width: 100%; min-height: 2.5rem; }
textarea { min-height: 5.5rem; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: .85rem; min-height: 18rem; }
.two { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
details > summary { cursor: pointer; font-weight: 600; padding: .2rem 0; }
details[open] > summary { margin-bottom: .7rem; }
.secret { font-family: var(--mono); font-size: .85rem; background: var(--grey-bg); padding: .6rem; border-radius: 8px; overflow-wrap: anywhere; user-select: all; }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .35rem .5rem .35rem 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 500; }
.scroll { overflow-x: auto; }

.md h3 { margin-top: 1rem; }
.md ul { margin: .3rem 0; padding-left: 1.2rem; }
.md li { margin: .15rem 0; }
.md li.task { list-style: none; margin-left: -1.2rem; }

.run { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-bottom: .6rem; }
.run > summary { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .6rem .8rem; font-weight: 400; margin: 0; }
.run > summary .what { font-weight: 600; }
.run > summary .meta { color: var(--muted); font-size: .85rem; margin-left: auto; }
.run .inside { padding: 0 .8rem .8rem; }
.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; max-height: 28rem; overflow: auto; font-size: .86rem; }
.log .m { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: .5rem; padding: .12rem 0; }
.log .t { color: var(--muted); font-family: var(--mono); font-size: .78rem; padding-top: .12rem; }
.log .b { white-space: pre-wrap; overflow-wrap: anywhere; }
.log .tool .b, .log .tool_result .b { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.log .tool_result .b { max-height: 7rem; overflow: auto; }
.log .status .b { color: var(--muted); }
.log .question .b, .log .PERSON .b { font-weight: 600; }
.log .bad .b { color: var(--red); }
.log .good .b { color: var(--green); }
.timeline { font-size: .9rem; }
.timeline .e { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .5rem; padding: .25rem 0; border-bottom: 1px solid var(--line); }
.timeline .e time { color: var(--muted); font-size: .82rem; }
.timeline .e span { overflow-wrap: anywhere; }

#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; max-width: min(92vw, 40rem); z-index: 10; }
#toast.bad { background: var(--red); color: #fff; }

.gap-top { margin-top: 1.5rem; }
.group { margin-bottom: 1rem; }
.stats.flush { margin: 0 0 .8rem; }
.panel.narrow { max-width: 32rem; margin: 3rem auto; }
[hidden] { display: none !important; }
