:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #d9dde4;
  --text: #1a2233;
  --muted: #5d6779;
  --accent: #1f4e8c;
  --accent-text: #ffffff;
  --selected: #e8effa;
  --ok: #1d6b45;
  --ok-bg: #e7f4ec;
  --warn: #8a5300;
  --warn-bg: #fdf1dc;
  --error: #a3261d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d;
    --surface: #1b212b;
    --border: #2f3846;
    --text: #e6eaf1;
    --muted: #9aa5b8;
    --accent: #7fb0f0;
    --accent-text: #0e1420;
    --selected: #243349;
    --ok: #7fd3a4;
    --ok-bg: #173326;
    --warn: #f0c070;
    --warn-bg: #3a2c12;
    --error: #ff9b91;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1 { margin: 0; font-size: 1.15rem; }
h2 { margin: 0 0 0.75rem; font-size: 1rem; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.session { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.narrow { max-width: 420px; margin: 3rem auto; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1rem; align-items: start; }
.detail { display: grid; gap: 1rem; min-width: 0; }
@media (max-width: 760px) { .workspace { grid-template-columns: minmax(0, 1fr); } }

.hint { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.9rem; }
.error { margin: 0.75rem 0 0; color: var(--error); }
.heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }

label, .label { display: block; margin-bottom: 0.25rem; font-weight: 600; font-size: 0.9rem; }
input, select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.field { margin-bottom: 0.9rem; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.choices label { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-weight: 400; }
.choices input { width: auto; }

button, a.button {
  display: inline-block;
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: default; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 400; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.pill.ok { border-color: transparent; background: var(--ok-bg); color: var(--ok); }
.pill.warn { border-color: transparent; background: var(--warn-bg); color: var(--warn); }

.contracts { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; }
.contracts button {
  display: grid;
  gap: 0.2rem;
  justify-items: start;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-color: transparent;
  background: none;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}
.contracts button:hover { background: var(--bg); }
.contracts button[aria-current="true"] { border-color: var(--accent); background: var(--selected); }
.contracts strong { overflow-wrap: anywhere; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.issued { border-color: var(--ok); }
.secret {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  padding: 0.6rem;
  border-radius: 6px;
  background: var(--ok-bg);
}
.secret code { flex: 1; min-width: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }
