:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b35;
  --fg: #e6e9ef;
  --muted: #8b93a3;
  --accent: #4c8dff;
  --ok: #2fbf71;
  --warn: #e0a72c;
  --err: #e2564d;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body.center {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
}

nav.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

nav.top .brand { font-weight: 600; margin-right: .5rem; }
nav.top a { color: var(--muted); text-decoration: none; padding: .25rem .5rem; border-radius: 6px; }
nav.top a:hover, nav.top a:focus-visible { color: var(--fg); background: #1f2430; }
nav.top .right { margin-left: auto; }

main { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }

h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.card.narrow { width: min(480px, 100%); }
.card.ok { border-color: var(--ok); }

.cards { display: flex; flex-wrap: wrap; gap: .75rem; }
.cards .card { flex: 1 1 160px; margin: 0; }
.cards .num { display: block; font-size: 1.8rem; font-weight: 600; }

.row { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.row.wrap { flex-wrap: wrap; }

label { display: block; margin-bottom: .75rem; color: var(--muted); font-size: .9rem; }
label.chk { display: inline-flex; gap: .35rem; margin: 0; align-items: center; }

input, select, textarea {
  background: #10131a;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .5rem .6rem;
  font: inherit;
  width: 100%;
}

label > input, label > select { margin-top: .25rem; }
.row input, .row select { width: auto; min-width: 9rem; }

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1f2430;
  color: var(--fg);
  padding: .45rem .8rem;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
button.ghost { background: transparent; }
button.danger { background: transparent; border-color: var(--err); color: var(--err); }
button.link { background: none; border: none; color: var(--muted); padding: 0; }
button:hover { filter: brightness(1.12); }

table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.grid th, table.grid td {
  text-align: left;
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid th { color: var(--muted); font-weight: 500; white-space: nowrap; }
table.grid tbody tr:hover { background: #1a1e27; }

.actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.err { color: var(--err); }
.hint { color: var(--muted); font-size: .88rem; }
.meta { color: var(--muted); font-size: .82rem; max-width: 28rem; word-break: break-word; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }
pre.pre-copy {
  background: #10131a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .7rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.tag {
  font-size: .72rem;
  padding: .1rem .4rem;
  border-radius: 4px;
  background: #23324d;
  color: #9dc0ff;
}

.st { font-size: .8rem; padding: .12rem .45rem; border-radius: 4px; border: 1px solid; }
.st-active   { color: var(--ok);   border-color: #24593c; background: #16281f; }
.st-pending  { color: var(--warn); border-color: #59491f; background: #262016; }
.st-disabled { color: var(--muted); border-color: var(--line); }
.st-expired  { color: var(--err);  border-color: #5a2b28; background: #291a19; }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--panel);
  border: 1px solid var(--ok);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
.toast.err { border-color: var(--err); }

dialog {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 420px;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog menu { display: flex; gap: .5rem; justify-content: flex-end; padding: 0; margin: 1rem 0 0; }

details summary { cursor: pointer; color: var(--muted); }
details[open] summary { margin-bottom: .75rem; }

@media (max-width: 720px) {
  main { padding: .75rem; }
  .row { flex-wrap: wrap; }
  table.grid { font-size: .84rem; }
}