:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --line: #d9dee5;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --ok-bg: #e6f4ea;
  --ok-text: #1e6b34;
  --warn-bg: #fff4e0;
  --warn-text: #7a4b00;
  --err-bg: #fdecea;
  --err-text: #a1271b;
  --danger: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b2129;
    --text: #e6e9ee;
    --muted: #9aa5b4;
    --line: #2c3540;
    --accent: #5aa2f0;
    --accent-text: #0b1420;
    --ok-bg: #173323;
    --ok-text: #9ed9b0;
    --warn-bg: #3a2c12;
    --warn-text: #f3cf8a;
    --err-bg: #3d1a17;
    --err-text: #f4b1aa;
    --danger: #f28b82;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.page { max-width: 44rem; margin: 0 auto; padding: 1rem; }
.page.narrow { max-width: 26rem; padding-top: 3rem; }

.brand h1 { margin: 0; font-size: 1.6rem; }
.brand p { margin: 0.2rem 0 1rem; color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin: 0 0 1rem;
}
.card h2 { margin: 0 0 0.6rem; font-size: 1.2rem; display: flex; align-items: center; gap: 0.5rem; }

.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-size: 0.95rem; flex: none;
}

label { display: block; font-weight: 600; margin: 0.8rem 0 0.25rem; }
.inline-label { margin-top: 0; }

input, select {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, button:focus-visible, .button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

button, .button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.1rem;
  margin: 0.9rem 0.4rem 0 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 0.3rem 0; margin: 0.2rem 0 0; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.small-button { padding: 0.35rem 0.7rem; margin-top: 0.5rem; font-size: 0.9rem; }

@media (max-width: 30rem) {
  .button.primary, button.primary { width: 100%; margin-right: 0; }
}

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
.wrap, .mono { overflow-wrap: anywhere; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.9rem; margin: 0.6rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 30rem) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 0.45rem; }
}

.message { padding: 0.6rem 0.8rem; border-radius: 8px; margin: 0.8rem 0 0; }
.message.error { background: var(--err-bg); color: var(--err-text); }
.message.ok { background: var(--ok-bg); color: var(--ok-text); }
.message.warn { background: var(--warn-bg); color: var(--warn-text); }

.progress { margin: 1rem 0 0; padding-left: 1.4rem; }
.progress li { color: var(--muted); margin: 0.2rem 0; }
.progress li.doing { color: var(--text); font-weight: 600; }
.progress li.doing::after { content: " …"; }
.progress li.done { color: var(--ok-text); }
.progress li.done::after { content: " ✓"; }
.progress li.failed { color: var(--err-text); font-weight: 600; }
.progress li.failed::after { content: " ✗"; }

.howto ol { padding-left: 1.3rem; }
.howto li { margin: 0.35rem 0; }

.certs { list-style: none; margin: 0; padding: 0; }
.certs li { border-top: 1px solid var(--line); padding: 0.7rem 0; }
.certs li:first-child { border-top: none; }
.badge { font-size: 0.75rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--line); text-transform: uppercase; letter-spacing: 0.03em; }
.badge.active { background: var(--ok-bg); color: var(--ok-text); }
.badge.revoked, .badge.expired { background: var(--err-bg); color: var(--err-text); }

.dev-banner { background: #b3261e; color: #fff; text-align: center; padding: 0.5rem; font-weight: 700; }

[hidden] { display: none !important; }
