:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1d232b; --muted: #687280; --line: #dfe3e8;
  --accent: #2b5fd9; --accent-text: #ffffff; --ok: #1f8a4c; --warn: #b7791f; --bad: #c53030; --run: #2b6cb0;
  --off: #8a94a3; --code: #eef1f5; --add: #e6f6ec; --del: #fdeaea; --hunk: #eaf0fb;
  --api: #2b6cb0; --module: #6b46c1; --app: #2f855a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --panel: #1b2129; --text: #e3e7ec; --muted: #98a2b0; --line: #2d3540;
    --accent: #5b8cff; --accent-text: #0d1117; --ok: #48bb78; --warn: #ecc94b; --bad: #fc8181; --run: #63b3ed;
    --off: #8a94a3; --code: #232b35; --add: #173523; --del: #3d1d1d; --hunk: #1d2a40;
    --api: #63b3ed; --module: #b794f4; --app: #68d391;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: .9em; }
code { background: var(--code); padding: .05em .35em; border-radius: 4px; }
pre { background: var(--code); padding: .8em 1em; border-radius: 6px; overflow: auto; }
pre code { background: none; padding: 0; }
h1 { font-size: 1.6rem; margin: .2em 0 .8em; word-break: break-word; }
h2 { font-size: 1.1rem; margin: 0 0 .6em; }
h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
h4 { font-size: .95rem; margin: 1em 0 .3em; }

header.top { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: .6rem 1.2rem;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); letter-spacing: .02em; }
.brand::before { content: ""; display: inline-block; width: .7em; height: .7em; border-radius: 3px;
  background: var(--accent); margin-right: .45em; vertical-align: .02em; }
.mainnav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.mainnav a { padding: .35rem .65rem; border-radius: 6px; color: var(--muted); }
.mainnav a:hover { background: var(--code); color: var(--text); text-decoration: none; }
.mainnav a.active { background: var(--code); color: var(--text); font-weight: 600; }
.userbox { display: flex; gap: .6rem; align-items: center; }
main { max-width: 1280px; margin: 0 auto; padding: 1.2rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 0 1rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem;
  margin-bottom: 1rem; min-width: 0; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid > .card { margin-bottom: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.err { color: var(--bad); }
.ok { color: var(--ok); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--line); background: var(--panel); }
.flash.ok { border-color: var(--ok); }
.flash.error { border-color: var(--bad); color: var(--bad); }
.flash.warn { border-color: var(--warn); }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1px solid currentColor; white-space: nowrap; vertical-align: .05em; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); }
.badge.run { color: var(--run); } .badge.wait { color: var(--warn); } .badge.off { color: var(--off); }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .45rem; background: var(--off); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.sev { font-weight: 700; text-transform: uppercase; font-size: .75rem; }
.sev.critical, .sev.high { color: var(--bad); } .sev.medium { color: var(--warn); } .sev.low { color: var(--muted); }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .2rem 0; }
.inline-list li { display: inline-block; margin-right: 1rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; word-break: break-word; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: color-mix(in srgb, var(--code) 60%, transparent); }
table.findings td:first-child { width: 6rem; }

.btn { display: inline-block; font: inherit; font-size: .9rem; padding: .4rem .9rem; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); line-height: 1.3; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.warn { color: var(--warn); border-color: var(--warn); }
.btn.small { font-size: .8rem; padding: .15rem .55rem; }
.btn.link { border: none; background: none; color: var(--accent); padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.btnrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
form.inline { display: inline-flex; gap: .4rem; align-items: flex-end; flex-wrap: wrap; margin: 0; }
details.inline { display: inline-block; }
details > summary { cursor: pointer; margin: .5rem 0; color: var(--accent); }
details > summary.btn { list-style: none; }
details > summary.btn::-webkit-details-marker { display: none; }
details.feedback { margin-top: .8rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs { display: flex; gap: .2rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.toolbar .tabs { margin-bottom: 0; border-bottom: none; }
.tabs a { padding: .45rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

form.stack { display: flex; flex-direction: column; gap: .8rem; }
form.wide { max-width: 980px; margin-bottom: 1.5rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; font-weight: 500; }
label.check, .row > label:has(input[type=radio]) { flex-direction: row; align-items: center; gap: .45rem; font-weight: 400; }
label.compact { flex-direction: row; align-items: center; gap: .35rem; font-weight: 400; }
label.compact input { width: 4.5rem; }
label.reauth { color: var(--warn); }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > label { flex: 1 1 200px; }
input, select, textarea { font: inherit; font-size: .95rem; padding: .45rem .6rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%; max-width: 100%; }
input[type=radio], input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem 1rem; margin: 0; background: var(--panel);
  display: flex; flex-direction: column; gap: .8rem; }
legend { font-weight: 600; padding: 0 .4rem; }

.md { overflow-wrap: anywhere; }
.md table { margin: .6rem 0; }
.md blockquote { border-left: 3px solid var(--line); margin: .5rem 0; padding: .1rem 1rem; color: var(--muted); }
.md li.task { list-style: none; }
.fix { font-size: .9rem; color: var(--muted); margin-top: .3rem; }
.round { border-top: 1px solid var(--line); padding-top: .4rem; margin-top: .8rem; }
.round:first-child { border-top: none; margin-top: 0; }
pre.log { max-height: 70vh; white-space: pre-wrap; word-break: break-word; font-size: .82rem; }
pre.term { min-height: 18rem; max-height: 55vh; }
pre.diff { font-size: .82rem; max-height: 75vh; }
pre.diff .add { background: var(--add); display: inline-block; width: 100%; }
pre.diff .del { background: var(--del); display: inline-block; width: 100%; }
pre.diff .hunk { background: var(--hunk); color: var(--muted); display: inline-block; width: 100%; }
pre.diff .file { font-weight: 700; }
.oauth-links p { margin: .3rem 0; }

.meter { height: .6rem; background: var(--code); border-radius: 999px; overflow: hidden; margin: .4rem 0; }
.meter span { display: block; height: 100%; background: var(--ok); }
.meter .m0 { width: 2%; } .meter .m1 { width: 10%; } .meter .m2 { width: 20%; } .meter .m3 { width: 30%; }
.meter .m4 { width: 40%; } .meter .m5 { width: 50%; } .meter .m6 { width: 60%; } .meter .m7 { width: 70%; }
.meter .m8 { width: 80%; background: var(--warn); } .meter .m9 { width: 90%; background: var(--bad); }
.meter .m10 { width: 100%; background: var(--bad); }

.graphwrap { overflow: auto; }
svg.graph { max-width: none; }
svg.graph .node rect { fill: var(--panel); stroke-width: 2; }
svg.graph .kind-api rect { stroke: var(--api); }
svg.graph .kind-module rect { stroke: var(--module); }
svg.graph .kind-app rect { stroke: var(--app); }
svg.graph a:hover rect { fill: var(--code); }
svg.graph .nname { fill: var(--text); font-weight: 700; font-size: 14px; }
svg.graph .nmeta { fill: var(--muted); font-size: 12px; }
svg.graph .edge { fill: none; stroke: var(--muted); stroke-width: 1.6; }
svg.graph .edge.outdated { stroke: var(--warn); stroke-dasharray: 6 4; }
svg.graph .arrowhead { fill: var(--muted); }
.legend .lg { display: inline-block; width: .9rem; height: .9rem; border: 2px solid; border-radius: 3px;
  vertical-align: -.15rem; margin: 0 .25rem 0 .8rem; }
.legend .lg.kind-api { border-color: var(--api); } .legend .lg.kind-module { border-color: var(--module); }
.legend .lg.kind-app { border-color: var(--app); }
details.reauthbox[open] { display: block; flex-basis: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: .2rem .8rem .8rem; margin: .3rem 0; }
details.reauthbox > summary { margin: 0; }
details.reauthbox[open] > summary { margin: .4rem 0; }
pre.term { white-space: pre; overflow-x: auto; word-break: normal; line-height: 1.25; }
.termkeys { margin: .4rem 0 .8rem; }
.termin input { flex: 1 1 300px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: .85rem; }
.card.narrow-wide { max-width: 720px; }
