:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5b6573;
  --border: #d9dee5;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok-bg: #ecfdf3;
  --ok-text: #05603a;
  --code-bg: #eef1f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --border: #2d333b;
    --accent: #6e93f7;
    --accent-text: #0b1020;
    --danger: #f97066;
    --danger-bg: #2b1614;
    --ok-bg: #0f2a1d;
    --ok-text: #75e0a7;
    --code-bg: #232932;
  }
}

* { 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;
}
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; }
.top nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
main.narrow { max-width: 440px; }

.heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.notice { background: var(--ok-bg); color: var(--ok-text); padding: 0.6rem 0.9rem; border-radius: 6px; }
.error { background: var(--danger-bg); color: var(--danger); padding: 0.6rem 0.9rem; border-radius: 6px; }

input, select, textarea, button, .button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 0.45rem 0.7rem;
}
input, textarea { width: 100%; }
button, .button { cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.danger { color: var(--danger); border-color: var(--danger); }
.danger:hover { background: var(--danger-bg); }
.small { padding: 0.15rem 0.5rem; font-size: 0.85rem; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }

.stack { display: grid; gap: 0.8rem; }
.stack label { display: grid; gap: 0.25rem; }
.inline { display: inline; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.6rem; }
.row input { flex: 1 1 18rem; width: auto; }
.right { text-align: right; margin: 0.5rem 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin: 1.25rem 0; }
.danger-zone { border-color: var(--danger); }
.confirm-id { font-size: 1rem; padding: 4px 8px; user-select: all; word-break: break-all; }
.confirm { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.confirm button { justify-self: start; }

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.filters input { flex: 1 1 16rem; width: auto; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.detail code { white-space: pre-wrap; word-break: break-word; display: block; max-width: 36rem; }
.ua { max-width: 22rem; font-size: 0.85rem; color: var(--muted); }
.break { word-break: break-all; }

.tag { font-size: 0.75rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.tag.public { color: var(--ok-text); background: var(--ok-bg); border-color: transparent; }

.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1rem 0; }

.facts-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 1rem 0; }
.facts-grid dt { color: var(--muted); }
.facts-grid dd { margin: 0; min-width: 0; }

.document { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 1rem; margin: 0.5rem 0; }
.document summary { cursor: pointer; }
.fact-list { padding-left: 1.5rem; margin: 0.5rem 0; }
.fact-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.fact-list li:last-child { border-bottom: 0; }

.qr { background: #fff; padding: 12px; display: inline-block; border-radius: 8px; }
.secret { word-break: break-all; }
.codes { columns: 2; list-style: none; padding: 0; }
.codes li { margin: 0.3rem 0; }

@media (max-width: 640px) {
  .facts-grid { grid-template-columns: 1fr; }
  .facts-grid dt { margin-top: 0.4rem; }
  .fact-list li { flex-direction: column; gap: 0.3rem; }
}
input.pick { width: auto; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
