/* Nexus setup on the proxy (/setup, the success and handoff pages), moved from the API's
   /connect with its look unchanged. The admin redesign's look: IBM Plex Sans and Mono
   (self-hosted, SIL OFL 1.1: fonts-OFL.txt), warm neutrals, one blue accent; dark under
   prefers-color-scheme. Loaded from a file only: the CSP has style-src 'self'. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-sunken: #f1efe9;
  --border: #e4e1d8;
  --border-input: #8f8a7d;
  --ink: #1b1a17;
  --ink-2: #55524a;
  --ink-3: #6b675d;
  --accent: #2450c8;
  --accent-hover: #1a3c99;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefb;
  --accent-soft-ink: #1a3c99;
  --focus: #2450c8;
  --danger: #a2231a;
  --danger-bg: #fbe7e5;
  --warning-bg: #fdf0dc;
  --warning-ink: #8a5300;
  --positive: #1d6b40;
  --positive-bg: #e3f2e9;
  --code-bg: #f1efe9;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 8px;
  --radius-card: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151412;
    --surface: #1d1c19;
    --surface-sunken: #282622;
    --border: #33312c;
    --border-input: #777266;
    --ink: #f1efea;
    --ink-2: #b3aea3;
    --ink-3: #a29d91;
    --accent: #7c9cf0;
    --accent-hover: #a3baf5;
    --accent-ink: #10131c;
    --accent-soft: #232f4d;
    --accent-soft-ink: #bccdf8;
    --focus: #8fabf3;
    --danger: #f6a79f;
    --danger-bg: #401b18;
    --warning-bg: #3b2b10;
    --warning-ink: #f2c27d;
    --positive: #93d7ab;
    --positive-bg: #173524;
    --code-bg: #282622;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-sans);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* "Nexus by AllCode": Nexus large and semibold, "by AllCode" smaller and lighter on the same
   baseline; it wraps as a unit, never between "by" and "AllCode". */
.lockup {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.3em;
  line-height: 1.1;
}

.lockup-name {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.lockup-by {
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}

.brand img {
  width: 26px;
  height: 26px;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
  margin: 4px 0 0;
  font-weight: 600;
}

h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0;
}

.lead {
  color: var(--ink-2);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.note,
.hint {
  font-size: 13px;
  color: var(--ink-3);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field textarea {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 400 14px/1.3 var(--font-sans);
  width: 100%;
}

.field textarea {
  padding: 8px 10px;
  min-height: 4.5rem;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 560px) {
  .row {
    grid-template-columns: 1fr;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 600 14px/1.2 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--surface-sunken);
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.button-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.banner {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
}

.banner-error {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.banner-notice {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

.banner-warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.banner-ok {
  background: var(--positive-bg);
  color: var(--positive);
}

.secret-note {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--positive-bg);
  color: var(--positive);
  font-size: 13px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.snippet {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.snippet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.snippet-head code {
  font-size: 13px;
}

pre {
  margin: 0;
  padding: 12px 14px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font: 400 13px/1.5 var(--font-mono);
  white-space: pre;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

details summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-2);
}

details[open] summary {
  margin-bottom: 8px;
}

.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: 14px;
}

.meta dt {
  color: var(--ink-3);
}

.meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

pre.wrap,
pre.markdown {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre.markdown {
  font-size: 13px;
  line-height: 1.6;
  background: transparent;
  border: 0;
  padding: 0;
}

details + details {
  margin-top: 12px;
}

/* OS tabs (the browser's OS is selected first). */
.tablist {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.tablist button {
  font: 600 14px/1 var(--font-sans);
  color: var(--ink-2);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  cursor: pointer;
}

.tablist button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tablist button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Tabs (tabs.js). Without script the tablists stay hidden and every panel shows in turn, each
   under its own heading (.nojs-only); with script only the selected panel shows. */
.tablist[hidden],
.tabs.js .tabpanel[hidden],
.js .nojs-only {
  display: none;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.banner ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

/* The Options list under the command. */
.flags {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
  font-size: 13px;
}

.flags dd {
  margin: 0;
  min-width: 0;
}

@media (max-width: 560px) {
  .flags {
    grid-template-columns: 1fr;
  }
}

/* The Manual setup panel (success.js): the key is minted when it opens, so without script
   only the note shows. */
/* A details element is not reliably a flex container, so its children are spaced by margin. */
.manual > * + * {
  margin-top: 12px;
}

.js .nojs-note,
.manual-retry[hidden],
.manual-limit[hidden],
.manual-result[hidden] {
  display: none;
}

pre.secret {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  user-select: all;
}

.keylist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.keylist li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

footer {
  font-size: 12px;
  color: var(--ink-3);
}
