:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --border: #d8dee4;
  --accent: #2557d6;
  --accent-text: #ffffff;
  --danger: #c4314b;
  --ok-bg: #dafbe1;
  --ok-text: #116329;
  --bad-bg: #ffebe9;
  --bad-text: #a40e26;
  --note-bg: #fff8c5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --text: #e6edf3;
    --muted: #8b949e;
    --border: #30363d;
    --accent: #4c7df0;
    --danger: #f0566e;
    --ok-bg: #12361f;
    --ok-text: #6fdd8b;
    --bad-bg: #3d1218;
    --bad-text: #ff9ba8;
    --note-bg: #3a3214;
  }
}

* { 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); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 .75rem; }
.card h2 { margin-top: 0; }
code { font: .9em ui-monospace, "Cascadia Mono", Consolas, monospace; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1.25rem; }
.topbar nav a { color: var(--text); text-decoration: none; }
.topbar nav a:hover { color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.card.narrow { max-width: 380px; margin: 3rem auto; }
.card.highlight { border-color: var(--accent); }

label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .45rem .6rem;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  border-radius: 6px;
  padding: .5rem 1rem;
  background: var(--accent);
  color: var(--accent-text);
}
button.small { padding: .25rem .6rem; font-size: .85rem; }
button.danger { background: var(--danger); }
button.link { background: none; color: var(--text); padding: 0; font-weight: normal; }
button.link:hover { color: var(--accent); }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.row .grow { flex: 1 1 220px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.stat strong { font-size: 1.4rem; }
.stat span { color: var(--muted); font-size: .85rem; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td form { margin: 0; }
.detail { word-break: break-all; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; }
.badge.active { background: var(--ok-bg); color: var(--ok-text); }
.badge.revoked, .badge.expired { background: var(--bad-bg); color: var(--bad-text); }

.error { background: var(--bad-bg); color: var(--bad-text); padding: .6rem .8rem; border-radius: 6px; }
.notice { background: var(--note-bg); padding: .6rem .8rem; border-radius: 6px; }

pre.cmd {
  margin: .5rem 0 1rem;
  padding: .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  font: .9em ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.key {
  display: block;
  padding: .75rem;
  margin: .75rem 0;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 6px;
  word-break: break-all;
  user-select: all; /* one click selects the whole key */
}
