:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --border: #e2e5ea;
  --text: #1b1f24;
  --muted: #5d6673;
  --accent: #3a5bd9;
  --accent-text: #ffffff;
  --code-bg: #f1f3f6;
  --good: #1f7a4d;
  --bad: #b3261e;
  --radius: 10px;
  --bar-h: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #181c21;
    --border: #2a3038;
    --text: #e6e9ed;
    --muted: #9aa4b1;
    --accent: #7d97ff;
    --accent-text: #0d1020;
    --code-bg: #1c2128;
    --good: #5ccf95;
    --bad: #ff8a80;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
body:not(.tool) :not(pre) > code, dialog :not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
.doc pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; line-height: 1.5; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  height: var(--bar-h); padding: 0 20px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand .mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-family: ui-monospace, monospace; }
.muted { color: var(--muted); font-weight: 500; }
.bar nav { display: flex; gap: 4px; }
.bar nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 550; }
.bar nav a:hover { color: var(--text); background: var(--surface); }
.bar nav a[aria-current="page"] { color: var(--text); background: var(--surface); }
button { font: inherit; cursor: pointer; }
.credential { margin-left: auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.credential.set { border-color: var(--good); }
.credential.set::before { content: "● "; color: var(--good); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }

.doc { max-width: 860px; margin: 0 auto; padding: 24px 20px 64px; }
.hero h1 { font-size: 2.2rem; line-height: 1.2; margin: 24px 0 8px; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 20px; }
.base { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.base .label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
body:not(.tool) .base code { background: none; padding: 0; font-size: 1rem; word-break: break-all; }
.copy { margin-left: auto; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 6px; padding: 2px 10px; font-size: 0.85rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 20px 0 8px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card span { color: var(--muted); font-size: 0.95rem; }
section h2 { margin-top: 44px; font-size: 1.45rem; }
section h3 { margin: 0 0 4px; font-size: 1.05rem; }
.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 20px; }
.defs dt { font-weight: 650; margin-top: 12px; }
.defs dd { margin: 2px 0 0; color: var(--muted); }
.button { display: inline-block; padding: 8px 16px; border-radius: 8px; background: var(--accent); color: var(--accent-text); text-decoration: none; font-weight: 600; }
.foot { display: flex; gap: 20px; justify-content: center; padding: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }

/* The explorers fill the window under the bar. */
body.tool { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.explorer { flex: 1; min-height: 0; overflow: auto; }
.explorer.graphql { overflow: hidden; }
#graphiql { height: 100%; }
.explorer.rest { background: #ffffff; color: #1b1f24; }
.explorer.rest .swagger-ui .info { margin: 24px 0; }
.hint { margin: 0; padding: 8px 20px; background: var(--surface); color: var(--muted); border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.explorer.rest .hint { background: #f6f7f9; color: #5d6673; border-color: #e2e5ea; }
.loading { padding: 24px 20px; color: var(--muted); }

dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--bg); color: var(--text); width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 0.4); }
.credential-form { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.credential-form h2 { margin: 0; font-size: 1.2rem; }
.credential-form p { margin: 0 0 6px; color: var(--muted); font-size: 0.92rem; }
.credential-form input[type="password"] { font: inherit; font-family: ui-monospace, monospace; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.credential-form .check { display: flex; gap: 8px; align-items: center; font-size: 0.92rem; color: var(--muted); }
.credential-form .status { min-height: 1.4em; margin: 0; }
.credential-form .status[data-kind="good"] { color: var(--good); }
.credential-form .status[data-kind="bad"] { color: var(--bad); }
.actions { display: flex; gap: 8px; align-items: center; }
.actions .spacer { flex: 1; }
.actions button { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.actions .primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

@media (max-width: 640px) {
  .bar { gap: 10px; padding: 0 12px; }
  .brand { font-size: 0; gap: 0; }
  .brand .mark { font-size: 12px; }
  .bar nav a { padding: 6px 8px; }
  .credential { max-width: 110px; padding: 6px 10px; font-size: 0.85rem; }
  .doc { padding: 16px 16px 48px; }
  .hero h1 { font-size: 1.7rem; }
}
