/* Launch mode's "Connect your phone" page — its whole stylesheet (the setup wizard keeps its
 * own, welcome.css). Built on the Biolink Health design system (the one biolink.health is
 * built from): near-white surfaces, ink type, one soft blue for controls and links, 1px
 * borders instead of shadows, Instrument Sans with IBM Plex Mono for codes. Status is a
 * coloured WORD, never a dot; the one exception is the setup checklist, which shows
 * progress with check marks (owner, 2026-12-01). Light on every device. No external assets (CSP: self); motion honours
 * reduced-motion. */

/* ---- self-hosted fonts (served from /app/fonts; CSP forbids external fonts) ---- */
@font-face {
  font-family: "Instrument Sans";
  src: url("/app/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/app/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/app/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light;

  --paper-a: #F5F7F9;          /* page ground (neutral-50) */
  --paper-b: #F5F7F9;
  --surface: #FFFFFF;          /* cards */
  --field: #FFFFFF;            /* inputs */
  --hairline: #DFE4E9;         /* border-default (neutral-200) */
  --hairline-strong: #C9D0D8;  /* border-strong (neutral-300) */
  --ink: #0D1520;              /* text-primary, matched to the logo */
  --muted-c: #5B6672;          /* text-secondary */
  --faint: #7A8592;            /* text-tertiary */
  --todo: #6B7682;             /* setup steps still to come: lighter than --muted-c, AA (4.6:1) */
  --accent: #3C74A8;           /* blue-600: buttons and controls */
  --accent-hover: #2D5D8A;     /* blue-700 */
  --accent-text: #2D5D8A;      /* blue-700: links, eyebrows, brand text */
  --accent-soft: #EFF5FA;      /* blue-50 */
  --on-accent: #FFFFFF;
  --ok: #2A6E45;
  --warn: #8A5A00;
  --err: #A4281E;
  --err-soft: #FBEDEB;
  --disabled-bg: #DFE4E9;
  --disabled-fg: #A3ADB8;
  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 4px #538CBE;

  --font-ui: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-ui);
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-xs: 4px;
  --r-sm: 6px;                 /* controls */
  --r-md: 8px;                 /* cards */
  --dur: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  font-family: var(--font-ui);
  color: var(--ink);
  font-size: 16px;
}

/* Light is the default on every device. Dark is opt-in only (data-theme="dark" on <html>);
   it never follows the device setting. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper-a: #0B1118; --paper-b: #0B1118;
  --surface: #121A23; --field: #0E151D;
  --hairline: #26313D; --hairline-strong: #36434F;
  --ink: #E8EDF2; --muted-c: #A3ADB8; --faint: #7F8A97; --todo: #7F8A97;
  --accent: #3C74A8; --accent-hover: #538CBE; --accent-text: #9BBEDD;
  --accent-soft: #17283A; --on-accent: #FFFFFF;
  --ok: #74C493; --warn: #E2B45A; --err: #F08A7E; --err-soft: #2A1614;
  --disabled-bg: #26313D; --disabled-fg: #6B7684;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper-a);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  width: min(680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 56px;
}

a { color: var(--accent-text); }
::selection { background: rgba(83, 140, 190, 0.25); }

/* ---- header ---------------------------------------------------------------------- */
/* The Biolink Health logo (the wordmark whose first letter is the B mark, as on
   biolink.health), painted through a mask so it takes this page's ink rather than the SVG's
   own colour (an <img> cannot inherit `currentColor`). Aspect is the artwork's own. The logo
   is always ink (or white on ink), never brand blue. */
.w-lockup {
  display: block;
  width: 150px;
  aspect-ratio: 445 / 115;
  margin: 0 0 28px;
  background-color: var(--ink);
  -webkit-mask: url("/app/brand/biolink-logo.svg") left center / contain no-repeat;
  mask: url("/app/brand/biolink-logo.svg") left center / contain no-repeat;
}

/* Sentence case, brand blue, no tracked capitals (the design system's eyebrow). */
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

h1, h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(28px, 4.4vw, 32px); line-height: 1.25; letter-spacing: -0.015em; }
h2 { font-size: clamp(20px, 3vw, 24px); line-height: 1.33; letter-spacing: -0.01em; }

.lede { max-width: 620px; margin: 0; color: var(--muted-c); font-size: 16px; line-height: 1.6; }

/* ---- device strip ---------------------------------------------------------------- */
.device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin: 24px 0 0;
  padding: 10px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--muted-c);
  font-size: 14px;
}
.device b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.device .line-break { display: none; }   /* used only in the two-column layout */
/* A way OUT of setup: signing in as the wrong person used to be a dead end (the wizard
   has no nav), leaving clearing site data as the only escape. */
.device .linky {
  margin-left: auto;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.device .linky:hover { text-decoration: underline; text-underline-offset: 2px; background: none; }

/* ---- progress rail --------------------------------------------------------------- */
.rail {
  display: flex;
  gap: 4px;
  margin: 24px 0 20px;
  padding: 0;
  list-style: none;
}
/* The browser's own `[hidden] { display: none }` is a USER-AGENT rule, so ANY author rule
   that sets `display` on the same element beats it — regardless of order. That silently
   broke two things here: `.rail` (which showed every owner step to a household member on
   the first screen) and `.ghost` (the wizard's "Turn off remote access" button, which the
   JS hides but which stayed on screen anyway). Make hiding authoritative once, for every
   element, the way app.css already does for the app shell. */
[hidden] { display: none !important; }
.rail li {
  flex: 1;
  padding-top: 8px;
  border-top: 2px solid var(--hairline);
  color: var(--faint);
  font-size: 13px;
  font-weight: 500;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rail li.done { border-top-color: var(--accent); color: var(--muted-c); }
.rail li.done::after { content: " ✓"; color: var(--ok); }
.rail li.active { border-top-color: var(--accent); color: var(--ink); font-weight: 600; }

/* ---- cards ------------------------------------------------------------------------ */
/* White, 1px border, 8px radius, no shadow: structure comes from the line. */
.card {
  margin-top: 20px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
  animation: rise 280ms var(--ease);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.card > p:not(.step):not(.result) { color: var(--muted-c); line-height: 1.6; margin: 0 0 8px; }
.card code {
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.step {
  margin: 0 0 6px;
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}
.step .idx {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.step .opt { color: var(--faint); font-weight: 500; }
.step b { color: var(--warn); font-weight: 600; }
.step.success-step { color: var(--ok); }

/* ---- forms ------------------------------------------------------------------------ */
form { display: grid; gap: 8px; margin-top: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; line-height: 18px; margin-top: 6px; color: var(--ink); }
label span, .muted { color: var(--faint); font-weight: 400; }
.muted.small, .small { font-size: 13px; line-height: 20px; }

input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:hover, select:hover { border-color: var(--faint); }
input:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.row-inline { display: flex; gap: 8px; align-items: center; }

/* password field + Show/Hide toggle (makeRevealable() in welcome.js) */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 68px; }
.pw-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  min-height: 0;
  width: auto;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--accent-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}
.pw-reveal:hover { background: var(--accent-soft); }
.pw-reveal:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- buttons ---------------------------------------------------------------------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
}
button:hover { background: var(--accent-hover); }
button:active { background: #22476A; }
button:disabled { background: var(--disabled-bg); color: var(--disabled-fg); cursor: not-allowed; }
button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* Secondary: surface fill, strong border, ink text (the site's .btn-secondary). */
button.ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--hairline-strong);
}
button.ghost:hover { background: var(--paper-a); }
button.ghost:disabled { background: var(--disabled-bg); color: var(--disabled-fg); }
button.small { min-height: 36px; padding: 0 12px; font-size: 14px; }

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 6px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 140ms var(--ease);
}
.button-link:hover { background: var(--accent-hover); }
.button-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- panels / status -------------------------------------------------------------- */
.panel {
  margin: 8px 0 4px;
  padding: 12px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--paper-a);
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted-c);
}
.panel b { color: var(--ink); font-weight: 600; }

/* Status is a coloured WORD — never a bare dot. */
.pill { font-size: 14px; font-weight: 600; }
.pill.on { color: var(--ok); }
.pill.off { color: var(--faint); }
.pill.warn { color: var(--warn); }

.result { min-height: 20px; margin: 6px 2px 0; font-size: 14px; color: var(--muted-c); }
.result.ok { color: var(--ok); }
.result.bad { color: var(--err); }

.note { margin: 12px 0 0; color: var(--faint); font-size: 14px; line-height: 1.55; }
.message { min-height: 24px; margin: 16px 4px 0; color: var(--err); font-size: 14px; }
.message:empty { min-height: 0; margin: 0; }
.success { border-color: var(--hairline); }

/* One column (a phone, a narrow window): the step showing comes straight after the checklist,
   with the backups line after it, so the step is never pushed down the page. The two column wrappers dissolve into one ordered column. */
@media (max-width: 959px) {
  main { display: flex; flex-direction: column; }
  .side, .stage { display: contents; }
  main > header, #status, #update-note, #setup { order: 1; }
  .stage > * { order: 2; }
  #backup-reminder { order: 3; }
}

@media (max-width: 560px) {
  main { padding: 24px 0 32px; }
  .w-lockup { margin-bottom: 20px; }
  .device { display: grid; gap: 6px; }
  .grid2 { grid-template-columns: 1fr; }
  .rail li { font-size: 0; }
  .rail li.done::after { content: ""; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- what the Connect page adds ----------------------------------------------------- */
/* On a computer the page is ONE screen: the introduction and status on the left, the
 * card for the current step on the right, and the code sized to the window's height, so
 * nobody scrolls to find it. No external assets (CSP: self). */

/* The page is a column: the content, then the version line centred at the foot of the screen. */
body { display: flex; flex-direction: column; }
.page-foot { margin-top: auto; padding: 8px 16px 16px; text-align: center; }
.page-foot p { margin: 0; color: var(--faint); font-size: 13px; line-height: 20px; }
#server-version, #server-id { font-family: var(--font-mono); font-size: 12px; }

.device .pill { font-size: inherit; }
.pill.bad { color: var(--err); }

/* ---- the owner's setup checklist (connect.js renderSetup) --------------------------- */
/* A quiet card of rows: the step's number in the same small tile as `.step .idx`, then its name.
   Progress shows without status words (owner, 2026-12-01): a done step's tile is a green check
   mark, the step showing is held in a soft blue highlight with a filled number, and steps still
   to come are in light text with an outlined number. The word (Done, Now, Next) stays in the
   row for screen readers only. */
.setup {
  --setup-px: 16px;            /* side padding; the "now" highlight runs out to it */
  margin-top: 16px;
  padding: 10px var(--setup-px) 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
}
.setup-head { margin: 0 0 2px; color: var(--accent-text); font-size: 13px; font-weight: 600; line-height: 20px; }
.setup-list { margin: 0; padding: 0; list-style: none; }
.setup-step { border-top: 1px solid var(--hairline); }
.setup-step:first-child { border-top: 0; }
.setup-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 6px 0;
  color: var(--muted-c);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}
/* A step that can be opened: a button that looks like its row, the name underlined on hover. */
button.setup-pick {
  min-height: 38px;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted-c);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}
button.setup-pick:hover, button.setup-pick:active { background: none; }
button.setup-pick:hover .setup-name { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.setup-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.setup-name { flex: 1; min-width: 0; }
/* The status word: read aloud, not shown. */
.setup-word {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Done: the number gives way to a check mark drawn in the tile (no glyph, so no font fallback). */
.setup-step.done .setup-num { position: relative; background: var(--ok); color: transparent; }
.setup-step.done .setup-num::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 5px;
  height: 10px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
/* Now: held in a soft highlight that runs to the card's edges, a blue bar at its left. */
.setup-step.now {
  margin: 0 calc(-1 * var(--setup-px));
  padding: 0 var(--setup-px);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.setup-step.now, .setup-step.now + .setup-step { border-top-color: transparent; }
/* The last step sits close to the card's rounded bottom (2px of padding on a short window). */
.setup-step.now:last-child { border-radius: 0 0 calc(var(--r-md) - 1px) calc(var(--r-md) - 1px); }
.setup-step.now .setup-name { color: var(--ink); font-weight: 600; }
.setup-step.now .setup-num { background: var(--accent); color: var(--on-accent); }
/* Still to come: light text, the number outlined rather than filled. One that can be opened now
   (a recovery code put off with "Not now") keeps the normal row colour, so it doesn't read as
   disabled. */
.setup-step.todo .setup-row { color: var(--todo); }
.setup-step.todo button.setup-pick { color: var(--muted-c); }
.setup-step.todo .setup-num { background: none; box-shadow: inset 0 0 0 1px var(--hairline-strong); color: var(--todo); }
/* High-contrast mode drops backgrounds and shadows: bring the status word back, keep the
   check mark's tile, outline the step showing, and give checklist buttons a real focus outline. */
@media (forced-colors: active) {
  .setup-word { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .setup-step.done .setup-num { forced-color-adjust: none; }
  .setup-step.now { outline: 2px solid Highlight; outline-offset: -2px; }
  button.setup-pick:focus-visible { outline: 2px solid Highlight; outline-offset: -2px; }
}
/* Backups, done in the app: one line under the checklist. */
.setup-note { margin-top: 10px; color: var(--muted-c); font-size: 13px; line-height: 19px; }
.setup-note b { color: var(--ink); font-weight: 600; }

.steps {
  margin: 12px 0 0;
  padding-left: 1.3em;
  color: var(--muted-c);
  font-size: 15px;
  line-height: 1.5;
}
.steps li { margin: 3px 0; padding-left: 2px; }
.steps li::marker { color: var(--faint); font-variant-numeric: tabular-nums; }
.steps b { color: var(--ink); font-weight: 600; }

/* The code: white quiet zone on every theme (a scanner needs dark-on-light), a 1px line, and
   a size that follows the window's height so the whole card stays on screen. */
.qr-box {
  --qr: clamp(136px, calc(100vh - 526px), 200px);
  margin-top: 16px;
  text-align: center;
}
.qr-box img {
  display: block;
  margin: 0 auto;
  width: var(--qr);
  height: var(--qr);
  max-width: 100%;
  background: #fff;
  padding: 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}
.qr-box p { margin: 8px auto 0; max-width: 460px; }
.qr-box .expired { color: var(--warn); font-weight: 600; }
/* The QR with only what typing needs under it: the six digits, then the address. */
.qr-figure { display: inline-flex; flex-direction: column; align-items: center; max-width: 100%; }
.qr-box .code-fallback { margin-top: 6px; text-align: center; }
.qr-box .code-fallback p { margin: 0; }
.qr-box .pair-code {
  font-family: var(--font-mono);
  font-size: 24px;
  line-height: 28px;
  letter-spacing: 0.25em;
  padding-left: 0.25em;   /* balances the trailing letter-spacing, so the digits sit centred */
  color: var(--ink);
  user-select: all;
}
/* Said aloud, not shown (the code's spoken form, with whose phone it connects). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.qr-box .pair-address {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--muted-c);
  user-select: all;
  overflow-wrap: anywhere;
}
.qr-box .linked { color: var(--ok); font-weight: 600; font-size: 16px; }

#signin-user-slot select, #signin-user-slot input { width: 100%; }

/* Everyone registered here, one row each; the chosen row takes the selected fill. */
.people { display: grid; gap: 6px; }
label.person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  margin: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  background: var(--field);
  font-size: 15px;
  cursor: pointer;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
label.person:hover { border-color: var(--faint); }
/* welcome.css sizes every input as a text box; a radio is not one. */
label.person input {
  width: 16px; height: 16px; min-height: 0; flex: none;
  margin: 0; padding: 0; accent-color: var(--accent);
}
label.person.chosen { border-color: var(--accent); background: var(--accent-soft); }
.person-name { font-weight: 600; color: var(--ink); }
.person-sub { font-weight: 400; color: var(--faint); font-size: 13px; }

/* A link-looking button (same as the wizard's "Not you?" in the status strip). */
.note .linky {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.note .linky:hover { text-decoration: underline; text-underline-offset: 2px; background: none; }

/* Your phones: one row per phone, its Remove at the end of the row. */
#phones-list { margin-top: 8px; }
.phone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
}
.phone-row:first-child { border-top: 0; }
.phone-words { display: grid; gap: 2px; min-width: 0; }
.phone-name { font-weight: 600; color: var(--ink); font-size: 15px; overflow-wrap: anywhere; }
.phone-note { color: var(--faint); font-size: 13px; }
.phone-note.confirm { color: var(--ink); }
.phone-actions { display: flex; gap: 8px; flex: none; }
.phone-row button { flex: none; width: auto; min-height: 36px; padding: 0 12px; font-size: 14px; }
@media (max-width: 560px) {
  .phone-row { flex-wrap: wrap; }
}

/* The supporting card (phones) is quieter than the step card. */
#phones-card { padding: 20px 24px; }
#phones-card h2 { font-size: 17px; line-height: 24px; letter-spacing: -0.005em; margin-bottom: 4px; }
#phones-card > p { margin-bottom: 0; }
/* Settings: a quiet gear in the top-right corner of the screen (the owner, at the server's own
   network only). It opens a small menu: the away-from-home switch (remote access, on by
   default) and Export logs; a click elsewhere or Escape closes it. */
#logs-card.settings { position: fixed; top: 12px; right: 12px; z-index: 20; margin: 0; }
.settings-menu summary {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  color: var(--faint);
  cursor: pointer;
  list-style: none;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.settings-menu summary::-webkit-details-marker { display: none; }
.settings-menu summary:hover, .settings-menu[open] summary { color: var(--ink); background: var(--hairline); }
.settings-menu summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.settings-menu .gear { width: 18px; height: 18px; }
.settings-pop {
  position: absolute;
  top: 42px;
  right: 0;
  width: 260px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(13, 21, 32, .10), 0 1px 3px rgba(13, 21, 32, .06);
  /* The gear is fixed to the screen, so the page can't scroll to the menu's foot: on a short or
     zoomed-in window the menu scrolls inside itself instead. */
  max-height: calc(100vh - 66px);
  overflow-y: auto;
}
.settings-pop button { width: 100%; min-height: 36px; font-size: 14px; }
.settings-note { margin: 8px 0 0; color: var(--faint); font-size: 12px; line-height: 17px; }
.settings-pop .result { font-size: 13px; }
.settings-pop .result:empty { min-height: 0; margin: 0; }
/* The away-from-home switch, at the top of the menu: its title, its status word, one plain line and the
   switch; a hairline below it before Export logs. */
.settings-away { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--hairline); }
.settings-away .away-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.settings-away h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: 0; }
.settings-away .pill { font-size: 13px; }
.settings-away .settings-note { color: var(--muted-c); }
.away-address { margin: 6px 0 0; font-family: var(--font-mono); font-size: 12px; line-height: 16px;
  color: var(--muted-c); overflow-wrap: anywhere; }
#away-more .note, #away-more .result { margin: 6px 0 0; font-size: 12px; line-height: 17px; }
#away-actions { margin-top: 10px; }
#away-actions:empty { display: none; }

.newcode code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.06em;
  padding: 6px 10px;
}
label.check { display: flex; gap: 10px; align-items: center; font-size: 15px; font-weight: 500; margin-top: 14px; }
label.check input { width: auto; min-height: 0; }

/* ---- one screen on a computer ------------------------------------------------------ */
/* Two columns, nothing to scroll (owner, 2026-12-01): the heading, then under it the server's
   status and the setup checklist on the left (.side); on the right
   (.stage) only the card for the step showing now (connect.js show()), with the phones list
   under it. The stage starts level with the status strip, under the heading. Sizes step down a
   notch from the wizard's so the whole page fits a laptop window. */
@media (min-width: 960px) {
  main {
    margin: auto;   /* centred in the space above the version line */
    width: min(1120px, calc(100% - 64px));
    padding: 32px 0;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 40px;
  }
  main > header { grid-column: 1; grid-row: 1; }
  main > .side { grid-column: 1; grid-row: 2; }
  main > .stage { grid-column: 2; grid-row: 2; align-self: start; }
  .stage > .card { margin-top: 16px; }   /* the strip's own top margin, so the two tops line up */
  .stage > #phones-card { margin-top: 12px; }
  .w-lockup { width: 136px; margin-bottom: 24px; }
  h1 { font-size: 28px; line-height: 36px; }
  h2 { font-size: 22px; line-height: 30px; }
  .lede { font-size: 15px; line-height: 1.55; }
  .device { margin-top: 16px; padding: 8px 14px; font-size: 13px; gap: 4px 20px; }
  .device .linky { font-size: 13px; }
  .setup { margin-top: 12px; }
  /* While the owner's checklist shows, it says what comes next, and the code's own card says to
     install the app: the introduction gives its lines to the checklist, so nothing scrolls. */
  main:has(#setup:not([hidden])) .lede,
  main:has(#setup:not([hidden])) .eyebrow { display: none; }
  .device { column-gap: 14px; }
  /* "Update available" waits until setup is finished. Without it, "Signed in as … Sign out"
     would move up beside the server and leave Sign out alone below; this break keeps it on its
     own line. With the pill showing, the strip wraps there anyway, so the break steps aside
     (a third row would push the page past one screen), and signed out there is no line to start. */
  .device .line-break { display: block; flex-basis: 100%; height: 0; }
  .device #update-wrap:not([hidden]) + .line-break,
  .device .line-break:has(+ #who-wrap[hidden]) { display: none; }
  #update-note { margin-top: 8px; font-size: 13px; line-height: 19px; }
  .card { padding: 24px 28px; }
  .card > p:not(.step):not(.result) { font-size: 15px; }

  /* The supporting cards: their title says what they are, so the small label above it goes. */
  #phones-card { margin-top: 12px; padding: 14px 18px; }
  #phones-card .step { display: none; }
  #phones-card h2 { font-size: 16px; line-height: 22px; }
  #phones-card > p { font-size: 13px; line-height: 19px; }
  .phone-row { padding: 6px 0; }
  .phone-name { font-size: 14px; }
  .phone-note { font-size: 12px; }
  #phones-list { margin-top: 4px; }
  #phones-card button { min-height: 32px; padding: 0 12px; font-size: 13px; }
  #phones-card .result:empty { min-height: 0; margin: 0; }

  /* Inside the code card: the QR, with its code and address under it, lines up with the text. */
  .steps { font-size: 14px; margin-top: 8px; }
  .qr-box:has(img) { text-align: left; }
  /* Left-aligned like the steps above: the address is wider than the code, so centring would
     push the code in from the card's edge. */
  .qr-box .qr-figure { align-items: flex-start; }
  .qr-box .qr-figure img { margin: 0; }
  .qr-box .code-fallback { text-align: left; }
  .qr-box .pair-code { padding-left: 0; }
  /* "Show a new code" beside the code's address, not under it: the code and address under the
     QR took the height the button row had. */
  .qr-row { display: flex; align-items: flex-end; column-gap: 24px; }
  .qr-row .qr-box { flex: 1 1 auto; min-width: 0; }
  .qr-row .actions { flex: none; margin-top: 0; }   /* never squeezed by a longer line beside it */
  /* Expired, a failed code, or the localhost warning: no image, still left-aligned with the card. */
  .qr-box { text-align: left; }
  .qr-box p { margin: 8px 0 0; }
}

/* A short window (a laptop at 1366 x 768, with or without browser chrome): tighter vertical rhythm. */
@media (min-width: 960px) and (max-height: 800px) {
  main { padding: 8px 0; }
  .w-lockup { margin-bottom: 6px; }
  .page-foot { padding: 0 16px 8px; }
  .page-foot p { line-height: 18px; }
  main:has(#setup:not([hidden])) .device { margin-top: 8px; }
  .card { padding: 18px 24px; }
  h2 { font-size: 20px; line-height: 28px; margin-bottom: 4px; }
  .qr-box { margin-top: 12px; }
  .actions { margin-top: 12px; }
  .setup { --setup-px: 14px; padding: 6px var(--setup-px) 2px; }
  .setup-row, button.setup-pick { min-height: 30px; padding: 3px 0; }
  .setup-note { margin-top: 8px; }
}

/* A narrow laptop window (columns wrap more text): the code gives up a little more height. */
@media (min-width: 960px) and (max-width: 1199px) {
  .qr-box { --qr: clamp(136px, calc(100vh - 546px), 200px); }
}
