/* The console's one stylesheet: a plain, readable layout that follows
   the browser's light or dark preference. */

:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #d9d9de;
  --panel: #f5f5f7;
  --link: #0b57d0;
  --accent: #0b57d0;
  --danger: #b3261e;
  --ok: #1e7f3c;
  --warn: #9a6700;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618;
    --fg: #e8e8ea;
    --muted: #9a9aa0;
    --line: #333338;
    --panel: #202024;
    --link: #8ab4f8;
    --accent: #8ab4f8;
    --danger: #f28b82;
    --ok: #6ccf84;
    --warn: #e3b341;
  }
}

* { box-sizing: border-box; }

html { font: 15px/1.45 var(--sans); background: var(--bg); color: var(--fg); }
body { margin: 0; }
a { color: var(--link); }
code, pre, .path, .ts, .preview, td.num, .kv code { font-family: var(--mono); font-size: 0.93em; }

header.top {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.6rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
header.top .brand { font-weight: 600; color: var(--fg); text-decoration: none; }
header.top nav { display: flex; gap: 1rem; }
header.top nav a { color: var(--fg); text-decoration: none; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
header.top nav a.active { border-bottom-color: var(--accent); }
header.top .who { margin-left: auto; display: flex; gap: 0.75rem; align-items: center; color: var(--muted); }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
h1 { font-size: 1.5rem; margin: 0.25rem 0 1rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 0.6rem; }
p.hint, .muted { color: var(--muted); }
p.notice { background: var(--panel); border-left: 4px solid var(--ok); padding: 0.5rem 0.75rem; margin: 0 0 1rem; }
p.error { color: var(--danger); margin: 0.4rem 0; }

.tiles { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; min-width: 9rem; }
.tile .n { font-size: 1.6rem; font-weight: 600; }
.tile .l { color: var(--muted); font-size: 0.9rem; }

table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
td.num, th.num { text-align: right; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover { background: var(--panel); }
tr.empty td { color: var(--muted); }
tr.new td { animation: flash 1.5s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 25%, transparent); } to { background: transparent; } }
td.preview { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
table.kv th { width: 11rem; }
table.kv td { word-break: break-all; }

.method {
  display: inline-block; font-family: var(--mono); font-size: 0.8em; font-weight: 600;
  padding: 0.1rem 0.4rem; border-radius: 4px; background: var(--panel); border: 1px solid var(--line);
}
.method-post { color: var(--ok); }
.method-get { color: var(--accent); }
.method-delete { color: var(--danger); }
.method-put, .method-patch { color: var(--warn); }

.live-status { font-size: 0.8rem; font-weight: normal; color: var(--muted); margin-left: 0.5rem; }
.live-status.on { color: var(--ok); }
.live-status.off { color: var(--warn); }

form.filter { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: end; margin-bottom: 1rem; }
form.filter label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); gap: 0.2rem; }

input, select, textarea, button {
  font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.35rem 0.55rem;
}
textarea { font-family: var(--mono); font-size: 0.9em; width: 100%; max-width: 48rem; }
button { background: var(--panel); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: none; background: none; color: var(--link); padding: 0; text-decoration: underline; }
a.button-link { display: inline-block; font-size: 0.9rem; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: var(--panel); }
form.inline { display: inline; }

fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; margin: 0 0 1rem; }
fieldset.has-error { border-color: var(--danger); }
legend { font-weight: 600; padding: 0 0.3rem; }
form.rules label, form.account label, section.login label { display: flex; flex-direction: column; gap: 0.2rem; margin: 0.5rem 0; max-width: 48rem; }
form.rules label.check { flex-direction: row; align-items: center; gap: 0.5rem; }
.secret, .pair { display: flex; gap: 0.4rem; margin: 0.3rem 0; max-width: 48rem; }
.secret input, .pair input { flex: 1; font-family: var(--mono); }
.actions { margin: 1rem 0; }
details { margin: 1rem 0; }
details summary { cursor: pointer; color: var(--muted); }
details textarea { margin: 0.5rem 0; }

.danger-zone { display: flex; gap: 1rem; flex-wrap: wrap; }
.danger-form { margin: 1rem 0; }
section.confirm, section.message, section.login { max-width: 32rem; margin: 2rem auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem 1.5rem; }
section.login h1, section.confirm h1 { margin-top: 0; }
nav.neighbours { display: flex; justify-content: space-between; margin-bottom: 1rem; font-size: 0.9rem; }
.pager { display: flex; gap: 1rem; margin: 0.5rem 0 1.5rem; }

.data { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .data { grid-template-columns: 1fr; } }
.data .raw { position: relative; }
.data .toolbar { position: absolute; right: 0.5rem; top: 0.5rem; }
pre { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-all; }
.tree { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; font-family: var(--mono); font-size: 0.9em; overflow: auto; }
.tree ul { list-style: none; margin: 0; padding-left: 1.2rem; }
.tree > ul { padding-left: 0; }
.tree .toggle { cursor: pointer; user-select: none; color: var(--muted); display: inline-block; width: 1rem; }
.tree .collapsed > ul { display: none; }
.tree .key { color: var(--accent); }
.tree .string { color: var(--ok); }
.tree .number { color: var(--warn); }
.tree .boolean, .tree .null { color: var(--danger); }
.tree .count { color: var(--muted); }
.redacted { color: var(--muted); font-style: italic; }

/* Two-factor authentication: the code fields, and the enrolment page
   with the QR code beside the secret and the form. */
input.code { font-family: var(--mono); font-size: 1.1em; letter-spacing: 0.15em; max-width: 10rem; }
ol.steps { max-width: 48rem; }
.enrol { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; margin: 1rem 0; }
.qr-box { width: 14rem; max-width: 100%; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qr-box svg { display: block; width: 100%; height: auto; }
.enrol-side { flex: 1 1 18rem; }
.secret-text { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0; }
.secret-text code { font-size: 1.05em; word-break: break-all; }
