:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #5f6b7a;
  --line: #dde2e8;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --ok: #1d7a46;
  --bad: #b3261e;
  --code: #eef1f5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1a2028;
    --text: #e6e9ee;
    --muted: #97a1ad;
    --line: #2c343f;
    --accent: #6f93ff;
    --accent-text: #0b0f15;
    --ok: #5cc98b;
    --bad: #ff8a80;
    --code: #222a34;
    color-scheme: dark;
  }
}

* { 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: 960px; margin: 0 auto; padding: 16px; }
a { color: var(--accent); }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

header.top {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
header.top h1 { font-size: 18px; margin: 0; }
header.top h1 a { color: inherit; text-decoration: none; }
.who { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; text-align: right; }
button.link {
  margin: 0; padding: 0; border: 0; background: none; color: var(--accent);
  font: inherit; font-weight: 400; text-decoration: underline; cursor: pointer;
}

section.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; margin: 16px 0;
}
section.card h2 { font-size: 16px; margin: 0 0 12px; }
section.card > p:first-of-type { margin-top: 0; }

label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 13px; }
label .type { font-weight: 400; color: var(--muted); }
input[type=text], input[type=url], textarea, select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit;
}
textarea { min-height: 70px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
input[type=file] { margin: 4px 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }

button {
  margin-top: 12px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .55; cursor: wait; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row button { margin-top: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.id { overflow-wrap: anywhere; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--code); }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }

.fn { border-top: 1px solid var(--line); padding: 12px 0; }
.fn:first-of-type { border-top: 0; padding-top: 0; }
.fn h3 { font-size: 15px; margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.fn .sig { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

pre.result {
  background: var(--code); padding: 8px 10px; border-radius: 6px; margin: 10px 0 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
pre.result.ok { border-left: 3px solid var(--ok); }
pre.result.bad { border-left: 3px solid var(--bad); color: var(--bad); }
.status { margin-top: 10px; color: var(--muted); }
.status.bad { color: var(--bad); }
.status.ok { color: var(--ok); }
.hint { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
ul.events { list-style: none; padding: 0; margin: 0; }
ul.events li { border-bottom: 1px solid var(--line); padding: 6px 0; overflow-wrap: anywhere; }

.node-footer { max-width: 960px; margin: 0 auto; padding: 8px 16px 24px; color: var(--muted); font-size: 13px; }
.node-footer:empty { display: none; }

.badge {
  margin-left: 8px; padding: 1px 7px; border-radius: 10px; font: 600 11px system-ui, sans-serif;
  background: var(--code); color: var(--ok); vertical-align: middle;
}

dialog.signing {
  width: min(420px, calc(100vw - 32px)); padding: 18px 22px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
dialog.signing::backdrop { background: rgba(10, 14, 20, .55); }
dialog.signing h2 { font-size: 17px; margin: 0 0 10px; }
dialog.signing p { margin: 8px 0; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  dl.details { grid-template-columns: 1fr; }
  dl.details dd { margin-bottom: 6px; }
  th.optional, td.optional { display: none; }
}
