/* ──────────────────────────────────────────────────────────────
   PRIMORA portal: components (pm-*) of the service pages
   Loaded after styles.css and nav.css on every page.

   Rules of this file
   - Every selector hangs on an pm-* class (tokens on :root are the one exception),
     so nothing here can restyle the existing pages.
   - Written for a 390 px screen first; wider layouts are added with min-width.
   - A solid colour is declared before every color-mix(), for browsers without it.
   - No url(): the page policy allows images from this origin only, and none are needed.
   ────────────────────────────────────────────────────────────── */

:root {
  /* State colours. Text colours are checked against the paper tones in tests-js/test_css.js. */
  --danger-fg: #A12B25;
  --danger-bg: #F9E4E0;
  --warn-fg: #7A4F00;
  --warn-bg: #F8EFD8;
  --ok-fg: #1D6A5D;
  --ok-bg: #DEF0EA;
  --muted-strong: #53626D;   /* small grey text on paper and on the tinted ground: 5.9:1 and better */

  --pm-teal: #1F3B55;        /* button fill (the deep blue of the mark): white on it is 11:1 */
  --pm-edge: #7A858E;        /* input borders: at least 3:1 against paper and white */
  --pm-line: #C5CCCA;        /* hairlines that sit on the tinted page background, where --rule disappears */
  --pm-on-dark: #E9EEF2;
  --pm-on-dark-2: #A9B8C4;
  --pm-teal-on-dark: #9CC3DC;
  --pm-ring: 0 0 0 3px rgba(60, 105, 143, 0.28);
  --pm-ring-danger: 0 0 0 3px rgba(161, 43, 37, 0.18);
  --pm-shadow: 0 2px 4px rgba(20, 34, 46, 0.05), 0 18px 44px rgba(20, 34, 46, 0.12);
  --pm-nav-h: 61px;          /* app.js measures the real navbar and overwrites this */
}

/* A component that is hidden stays hidden, whatever display its class sets. */
[class*="pm-"][hidden] { display: none !important; }

/* ── Page ─────────────────────────────────────────────────── */

/* Service pages run no canvas animation: porcelain paper with faint washes of the mark's blues
   and one of the warm accent. Text sits directly on this ground, so every tone of it must keep
   the grey, blue and warm text colours at 4.5:1 or better. tests-js/test_css.js computes that
   from these very numbers for phone, tablet and desktop viewports. */
.pm-bg::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle 95vmin at 2% 2%, rgba(112, 157, 188, 0.12), rgba(112, 157, 188, 0.04) 45%, rgba(112, 157, 188, 0) 100%),
    radial-gradient(circle 95vmin at 98% 2%, rgba(187, 216, 230, 0.20), rgba(187, 216, 230, 0.06) 45%, rgba(187, 216, 230, 0) 100%),
    radial-gradient(circle 95vmin at 62% 104%, rgba(200, 86, 59, 0.05), rgba(200, 86, 59, 0.015) 45%, rgba(200, 86, 59, 0) 100%),
    radial-gradient(circle 95vmin at 100% 72%, rgba(112, 157, 188, 0.08), rgba(112, 157, 188, 0.025) 45%, rgba(112, 157, 188, 0) 100%),
    radial-gradient(circle 95vmin at 22% 70%, rgba(31, 59, 85, 0.03), rgba(31, 59, 85, 0.01) 45%, rgba(31, 59, 85, 0) 100%);
  background-blend-mode: multiply;
}

.pm-shell { max-width: 1080px; margin: 0 auto; padding: 28px 16px 64px; }
.pm-shell--narrow { max-width: 560px; }
/* One 440 px column for sign-in: opener, notices and the card share their edges */
.pm-shell--narrow > * { max-width: 440px; margin-left: auto; margin-right: auto; }
.pm-shell--wide { max-width: 1280px; }

.pm-hero {
  padding-bottom: 24px; margin-bottom: 28px;
  border-bottom: 1px solid var(--pm-line);
}
.pm-eyebrow {
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--signal-fg);
  display: inline-flex; align-items: center; gap: 12px;
}
.pm-eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--signal); flex: none; }
/* The display face has one weight, so the title is set large and light rather than bold. */
.pm-title {
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.04; letter-spacing: -0.012em;
  margin: 16px 0 0; color: var(--ink);
  overflow-wrap: anywhere; text-wrap: balance;
}
.pm-title em { font-style: italic; font-weight: 400; color: var(--coral-fg); }
.pm-title--sm { font-size: clamp(32px, 3.8vw, 46px); }
.pm-lede {
  font-size: clamp(15.5px, 1.3vw, 17.5px); line-height: 1.6;
  color: var(--ink-2); margin: 16px 0 0; max-width: 640px;
}
.pm-heading { font-family: var(--f-display); font-weight: 400; font-size: 25px; line-height: 1.2; letter-spacing: -0.005em; margin: 0; color: var(--ink); }

/* Small text helpers */
.pm-caps {
  font-family: var(--f-mono); font-size: 11px; font-weight: 400;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted-strong);
}
.pm-mono { font-family: var(--f-mono); font-size: 12.5px; }
.pm-muted { color: var(--muted-strong); }
.pm-num { font-variant-numeric: tabular-nums; }
.pm-break { overflow-wrap: anywhere; word-break: break-word; }
.pm-nowrap { white-space: nowrap; }
.pm-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.pm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pm-row--end { justify-content: flex-end; }
.pm-row--between { justify-content: space-between; }

.pm-link {
  color: var(--signal-fg);
  text-decoration: underline; text-decoration-color: var(--signal); text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.pm-link:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ── Focus ────────────────────────────────────────────────── */
.pm-btn:focus-visible, .pm-link:focus-visible, .pm-linkbtn:focus-visible, .pm-tab:focus-visible, .pm-filter:focus-visible,
.pm-seg__item:focus-visible, .pm-option:focus-visible, .pm-user__btn:focus-visible, .pm-user__item:focus-visible,
.pm-sheet-link:focus-visible, .pm-banner__close:focus-visible, .pm-details > summary:focus-visible,
.pm-jobrow__id:focus-visible, .pm-nav-pill:focus-visible, .pm-sheet-signin:focus-visible {
  outline: 2px solid var(--signal-fg);
  outline-offset: 2px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.pm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  font-family: var(--f-sans); font-size: 14.5px; font-weight: 600; line-height: 1.2; letter-spacing: -0.005em;
  text-decoration: none; text-align: center; white-space: nowrap;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid transparent; border-radius: 999px;
  cursor: pointer;
  transition: transform .15s, filter .15s, background .15s, color .15s, border-color .15s;
}
.pm-btn .pm-ar { font-family: var(--f-mono); font-weight: 500; }
.pm-btn--primary { background: var(--pm-teal); color: #fff; }
.pm-btn--primary:hover { color: #fff; background: var(--blue-7); transform: translateY(-1px); }
.pm-btn--secondary { background: var(--card); color: var(--ink); border-color: var(--pm-line); }
.pm-btn--secondary:hover { background: var(--paper-3); color: var(--ink); border-color: var(--ink); }
.pm-btn--danger { background: var(--card); color: var(--danger-fg); border-color: var(--danger-fg); }
.pm-btn--danger:hover { background: var(--danger-fg); color: #fff; }
.pm-btn--ghost { background: transparent; color: var(--ink); padding-left: 12px; padding-right: 12px; }
.pm-btn--ghost:hover { background: var(--paper-2); color: var(--ink); }
.pm-btn--on-dark { background: var(--pm-on-dark); color: var(--night); }
.pm-btn--on-dark:hover { background: #fff; color: var(--night); transform: translateY(-1px); }
.pm-btn--sm { min-height: 34px; padding: 6px 14px; font-size: 13px; }
.pm-btn--block { display: flex; width: 100%; }
.pm-btn:active { transform: scale(0.98); }
.pm-btn:disabled, .pm-btn[aria-disabled="true"] {
  opacity: 0.5; cursor: not-allowed; transform: none; filter: none;
}
.pm-btn--secondary:disabled:hover, .pm-btn--secondary[aria-disabled="true"]:hover { background: var(--card); border-color: var(--pm-line); }
.pm-btn--danger:disabled:hover, .pm-btn--danger[aria-disabled="true"]:hover { background: var(--card); color: var(--danger-fg); }
.pm-btn--primary:disabled:hover, .pm-btn--primary[aria-disabled="true"]:hover { background: var(--pm-teal); }
.pm-btn--on-dark:disabled:hover, .pm-btn--on-dark[aria-disabled="true"]:hover { background: var(--pm-on-dark); }
.pm-btn[aria-busy="true"] { opacity: 0.8; cursor: progress; }
.pm-btn[aria-busy="true"]::before {
  content: ""; width: 14px; height: 14px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: pm-spin .7s linear infinite;
}
@keyframes pm-spin { to { transform: rotate(360deg); } }

/* A button that reads as a link: "Use a different email", "Resend code". */
.pm-linkbtn {
  font-size: inherit; color: var(--signal-fg);
  text-decoration: underline; text-decoration-color: var(--signal); text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.pm-linkbtn:hover { color: var(--ink); text-decoration-color: var(--ink); }
.pm-linkbtn:disabled { color: var(--muted-strong); text-decoration: none; cursor: not-allowed; }

.pm-spinner {
  display: inline-block; width: 16px; height: 16px; vertical-align: -3px;
  border: 2px solid var(--signal-fg); border-right-color: transparent; border-radius: 50%;
  animation: pm-spin .7s linear infinite;
}

/* ── Surfaces ─────────────────────────────────────────────── */
.pm-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.pm-card--pad { padding: 22px 18px; }
.pm-card__foot {
  padding: 14px 18px;
  border-top: 1px solid var(--rule);
  border-top: 1px solid color-mix(in oklch, var(--rule) 60%, transparent);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted-strong);
}
.pm-card__foot a { color: var(--muted-strong); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.pm-card__foot a:hover { color: var(--ink); }

/* Sign-in card: 440 px wide wherever it stands */
.pm-auth { max-width: 440px; margin-left: auto; margin-right: auto; }

/* Numbered block inside a card: "01  Input  one .h5ad file, up to 200 MB" */
.pm-block {
  padding: 24px 18px;
  border-bottom: 1px solid var(--rule);
  border-bottom: 1px solid color-mix(in oklch, var(--rule) 60%, transparent);
}
.pm-block:last-child { border-bottom: 0; }
.pm-block__head { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 4px 14px; margin-bottom: 18px; }
.pm-block__num { font-family: var(--f-mono); font-size: 11px; color: var(--muted-strong); letter-spacing: 0.18em; text-transform: uppercase; }
.pm-block__name { font-family: var(--f-display); font-weight: 400; font-size: 26px; line-height: 1.15; letter-spacing: -0.005em; margin: 0; color: var(--ink); }
.pm-block__hint { grid-column: 1 / -1; font-family: var(--f-mono); font-size: 11px; color: var(--muted-strong); letter-spacing: 0.06em; }

/* Dark band at the foot of a card: summary on the left, the action on the right */
.pm-band {
  display: grid; gap: 16px; align-items: center;
  padding: 22px 18px;
  background: var(--night-2);
  color: var(--pm-on-dark);
  border-radius: 0 0 13px 13px;   /* nests inside the 14 px corner of a card with its 1 px border */
}
.pm-band--alone { border-radius: var(--radius); }
.pm-band__text { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.06em; line-height: 1.6; color: var(--pm-on-dark-2); margin: 0; }
.pm-band__text b { color: var(--pm-on-dark); font-weight: 500; }
.pm-band__accent { color: var(--pm-teal-on-dark); }
.pm-band .pm-btn:focus-visible { outline-color: var(--pm-teal-on-dark); }

/* "or continue with" */
.pm-divider {
  display: flex; align-items: center; gap: 16px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-strong); margin: 24px 0; white-space: nowrap;
}
.pm-divider::before, .pm-divider::after { content: ""; flex: 1; height: 1px; background: var(--pm-line); }

/* A notice with weight, e.g. the mainland-China data restriction */
.pm-notice {
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: 3px solid var(--warn-fg);
  background: var(--warn-bg);
  background: color-mix(in oklch, var(--warn-bg) 80%, transparent);
  font-size: 13.5px; line-height: 1.55; color: var(--ink);
}
.pm-notice p { margin: 0; }
.pm-notice p + p { margin-top: 6px; }
.pm-notice--info { border-left-color: var(--signal-fg); background: var(--signal-bg); background: color-mix(in oklch, var(--signal-bg) 75%, transparent); }
.pm-notice__title { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--warn-fg); margin-bottom: 6px; }
.pm-notice--info .pm-notice__title { color: var(--signal-fg); }

.pm-checklist { list-style: none; margin: 0; padding: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.pm-checklist li { position: relative; padding-left: 22px; }
.pm-checklist li + li { margin-top: 6px; }
.pm-checklist li::before {
  content: ""; position: absolute; left: 2px; top: 0.42em;
  width: 9px; height: 5px;
  border-left: 1.5px solid var(--signal-fg); border-bottom: 1.5px solid var(--signal-fg);
  transform: rotate(-45deg);
}

/* ── Banners ──────────────────────────────────────────────── */
.pm-banners { position: relative; z-index: 40; }
.pm-banners--sticky { position: sticky; top: var(--pm-nav-h); }
.pm-banner {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 14px;
  padding: 12px 16px;
  font-size: 14px; line-height: 1.5;
  color: var(--ink);
  background: var(--signal-bg);
  border: 1px solid #C3DCE9;
  border-left: 3px solid var(--signal-fg);
  border-radius: var(--radius-sm);
}
.pm-banners > .pm-banner { border-radius: 0; border-width: 0 0 1px 3px; padding-left: 16px; }
.pm-banner__body { flex: 1 1 240px; min-width: 0; }
.pm-banner__text, .pm-banner p { margin: 0; overflow-wrap: anywhere; }
.pm-banner__text + .pm-banner__text { margin-top: 4px; }
.pm-banner__tag {
  flex: none; align-self: flex-start;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 8px; margin-top: 1px;
  border: 1px solid currentColor; border-radius: 999px;
  color: var(--signal-fg);
}
.pm-banner__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pm-banner__close {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  font-family: var(--f-mono); font-size: 16px; line-height: 1; color: var(--ink-2);
}
.pm-banner__close:hover { background: rgba(20, 34, 46, 0.08); color: var(--ink); }
.pm-banner--warn { background: var(--warn-bg); border-color: #E6D4A4; border-left-color: var(--warn-fg); }
.pm-banner--warn .pm-banner__tag { color: var(--warn-fg); }
.pm-banner--error { background: var(--danger-bg); border-color: #EBC3BD; border-left-color: var(--danger-fg); }
.pm-banner--error .pm-banner__tag { color: var(--danger-fg); }
.pm-banner--test {
  background-color: var(--night-2);
  background-image: repeating-linear-gradient(135deg, rgba(233, 238, 242, 0.06) 0 8px, rgba(233, 238, 242, 0) 8px 16px);
  border-color: var(--night-2); border-left-color: var(--warm);
  color: var(--pm-on-dark);
}
.pm-banner--test .pm-banner__tag { color: var(--night); background: var(--warm); border-color: var(--warm); font-weight: 500; }
.pm-banner--test .pm-banner__close { color: var(--pm-on-dark-2); }
.pm-noscript { margin: 0; padding: 12px 16px; background: var(--warn-bg); border-bottom: 1px solid var(--warn-fg); color: var(--ink); font-size: 14px; }

/* ── Form fields ──────────────────────────────────────────── */
.pm-field { display: grid; gap: 6px; }
.pm-field + .pm-field { margin-top: 18px; }
.pm-label {
  font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink);
}
.pm-label__opt { color: var(--muted-strong); text-transform: none; letter-spacing: 0.02em; }
/* A label that is a sentence ("Enter the 6-digit code we sent to you@institute.org"): no capitals */
.pm-label--text { font-family: var(--f-sans); font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; line-height: 1.45; overflow-wrap: anywhere; }
.pm-hint { font-size: 12.5px; line-height: 1.45; color: var(--muted-strong); margin: 0; }
.pm-counter { font-family: var(--f-mono); font-size: 11px; color: var(--muted-strong); text-align: right; margin: 0; }
.pm-error {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; line-height: 1.45; color: var(--danger-fg); margin: 0;
}
.pm-error::before {
  content: "!"; flex: none;
  width: 15px; height: 15px; border: 1px solid currentColor; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-family: var(--f-mono); font-size: 10px; font-weight: 500; line-height: 1;
  transform: translateY(1px);
}
.pm-saved { font-size: 13px; color: var(--ok-fg); margin: 0; }
/* PM.setFieldError marks the field; its label joins the error line in colour */
.pm-field--invalid > .pm-label { color: var(--danger-fg); }

.pm-input, .pm-select, .pm-textarea {
  width: 100%; min-height: 44px;
  padding: 10px 12px;
  font-family: var(--f-sans); font-size: 16px; line-height: 1.35;
  color: var(--ink);
  background-color: var(--card);
  border: 1px solid var(--pm-edge);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.pm-textarea { min-height: 96px; resize: vertical; }
.pm-input::placeholder, .pm-textarea::placeholder { color: var(--muted-strong); opacity: 1; }
.pm-input:hover, .pm-select:hover, .pm-textarea:hover { border-color: var(--ink); }
.pm-input:focus, .pm-select:focus, .pm-textarea:focus {
  outline: 2px solid transparent;
  border-color: var(--signal-fg); box-shadow: var(--pm-ring);
}
.pm-input[aria-invalid="true"], .pm-select[aria-invalid="true"], .pm-textarea[aria-invalid="true"] { border-color: var(--danger-fg); }
.pm-input[aria-invalid="true"]:focus, .pm-select[aria-invalid="true"]:focus, .pm-textarea[aria-invalid="true"]:focus { box-shadow: var(--pm-ring-danger); }
.pm-input:disabled, .pm-select:disabled, .pm-textarea:disabled {
  background-color: var(--paper-3); color: var(--muted-strong); border-color: var(--rule); cursor: not-allowed;
}
.pm-input--mono { font-family: var(--f-mono); }
/* The six-digit sign-in code */
.pm-input--code {
  font-family: var(--f-mono); font-size: 26px; font-variant-numeric: tabular-nums;
  letter-spacing: 0.4em; text-align: center;
  padding: 12px 8px 12px calc(8px + 0.4em);
  max-width: 280px;
}
.pm-select {
  appearance: none; -webkit-appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Parameter row: label and hint, control, echo of the value */
.pm-param { display: grid; gap: 8px; padding: 12px 0; }
.pm-param + .pm-param { border-top: 1px dashed var(--pm-line); }
.pm-param__label { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.04em; color: var(--ink); }
.pm-param__hint { font-family: var(--f-mono); font-size: 10.5px; line-height: 1.5; color: var(--muted-strong); margin: 3px 0 0; }
.pm-param__val { display: none; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted-strong); text-align: right; }

/* Segmented control (enum with up to four choices) */
.pm-seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--card);
  border: 1px solid var(--pm-edge); border-radius: 999px;
}
.pm-seg__item {
  min-height: 32px; padding: 6px 14px; border-radius: 999px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted-strong);
  transition: background .15s, color .15s;
}
.pm-seg__item:hover { color: var(--ink); }
.pm-seg__item[aria-checked="true"], .pm-seg__item[aria-pressed="true"] { background: var(--pm-teal); color: #fff; }
.pm-seg__item:disabled { opacity: 0.5; cursor: not-allowed; }

/* Checkbox with its label; .pm-check--box is the consent / attestation box */
.pm-check { display: grid; grid-template-columns: 20px 1fr; gap: 12px; align-items: start; cursor: pointer; font-size: 14px; line-height: 1.5; color: var(--ink); }
.pm-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.5px solid var(--ink-2); border-radius: 5px;
  background: var(--card);
  display: inline-grid; place-content: center;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.pm-check input[type="checkbox"]::before {
  content: ""; width: 10px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform .12s;
}
.pm-check input[type="checkbox"]:checked { background: var(--pm-teal); border-color: var(--pm-teal); }
.pm-check input[type="checkbox"]:checked::before { transform: translateY(-1px) rotate(-45deg) scale(1); }
.pm-check input[type="checkbox"]:focus-visible { outline: 2px solid var(--signal-fg); outline-offset: 2px; }
.pm-check input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
.pm-check__text p { margin: 0; }
.pm-check--box {
  padding: 14px 14px;
  border: 1px solid var(--pm-line); border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 13.5px;
  transition: border-color .15s, background .15s;
}
.pm-check--box + .pm-check--box { margin-top: 10px; }
.pm-check--box:hover { border-color: var(--ink); }
.pm-check--box:has(input:checked) {
  border-color: var(--signal);
  background: var(--signal-bg);
  background: color-mix(in oklch, var(--signal-bg) 60%, var(--card));
}

/* On/off switch (boolean parameter, notification setting) */
.pm-switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; color: var(--ink); }
.pm-switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: none;
  width: 40px; height: 24px; margin: 0;
  border-radius: 999px; background: var(--pm-edge);
  cursor: pointer; transition: background .15s;
}
.pm-switch input[type="checkbox"]::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .15s;
}
.pm-switch input[type="checkbox"]:checked { background: var(--pm-teal); }
.pm-switch input[type="checkbox"]:checked::before { transform: translateX(16px); }
.pm-switch input[type="checkbox"]:focus-visible { outline: 2px solid var(--signal-fg); outline-offset: 2px; }
.pm-switch input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }

/* Radio cards: tasks */
.pm-options { display: grid; gap: 10px; }
.pm-option {
  display: grid; grid-template-columns: 16px 1fr; gap: 6px 14px; align-items: start;
  width: 100%; padding: 16px 16px; text-align: left;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--pm-line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.pm-option:hover { border-color: var(--ink); box-shadow: var(--shadow-1); }
.pm-option__dot { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; border: 1.5px solid var(--ink-2); display: grid; place-items: center; }
.pm-option[aria-checked="true"] {
  border-color: var(--signal);
  background: var(--signal-bg);
  background: color-mix(in oklch, var(--signal-bg) 62%, var(--card));
  box-shadow: 0 0 0 1px var(--signal);
}
.pm-option[aria-checked="true"] .pm-option__dot::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.pm-option__id { display: block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-strong); }
.pm-option__name { display: block; font-size: 16.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; margin-top: 3px; }
.pm-option__desc { display: block; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); margin-top: 6px; }
.pm-option__meta { display: block; grid-column: 2; font-family: var(--f-mono); font-size: 10.5px; color: var(--muted-strong); margin-top: 6px; }
.pm-option__side { grid-column: 2; justify-self: start; }
.pm-option[aria-disabled="true"], .pm-option:disabled { cursor: not-allowed; background: transparent; border-style: dashed; box-shadow: none; }
.pm-option[aria-disabled="true"]:hover, .pm-option:disabled:hover { border-color: var(--pm-line); box-shadow: none; }
.pm-option[aria-disabled="true"] .pm-option__name, .pm-option[aria-disabled="true"] .pm-option__desc,
.pm-option:disabled .pm-option__name, .pm-option:disabled .pm-option__desc { color: var(--muted-strong); }
.pm-option[aria-disabled="true"] .pm-option__dot, .pm-option:disabled .pm-option__dot { border-color: var(--rule); }

/* Drop zone around a real, focusable <input type="file" class="pm-sr"> */
.pm-drop {
  display: block; position: relative;
  padding: 32px 18px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--pm-edge);
  border: 1.5px dashed color-mix(in oklch, var(--ink) 40%, transparent);
  border-radius: var(--radius);
  background: var(--paper);
  background: color-mix(in oklch, var(--paper) 60%, var(--card));
  transition: border-color .15s, background .15s;
}
.pm-drop:hover, .pm-drop.is-over, .pm-drop:focus-within {
  border-color: var(--signal);
  background: var(--signal-bg);
  background: color-mix(in oklch, var(--signal-bg) 55%, var(--card));
}
.pm-drop:focus-within { outline: 2px solid var(--signal-fg); outline-offset: 2px; }
.pm-drop__icon {
  width: 32px; height: 32px; margin: 0 auto 10px;
  border: 1.5px solid var(--ink); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-mono); color: var(--ink);
}
.pm-drop__big { display: block; font-size: 18px; line-height: 1.3; color: var(--ink); }
.pm-drop__small { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-strong); margin-top: 6px; }
.pm-drop[aria-disabled="true"] { cursor: not-allowed; opacity: 0.6; }
.pm-drop[aria-disabled="true"]:hover { border-color: var(--pm-edge); background: var(--paper); }

/* ── Chips ────────────────────────────────────────────────── */
.pm-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; line-height: 1.2;
  letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  padding: 4px 10px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule); border-radius: 999px;
}
.pm-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pm-chip--neutral::before, .pm-chip--na::before, .pm-chip--test::before { content: none; }
.pm-chip--queued { color: var(--muted-strong); background: var(--card); border-color: var(--pm-edge); }
.pm-chip--running { color: var(--warn-fg); background: var(--warn-bg); border-color: #E6D4A4; }
.pm-chip--running::before { animation: pm-pulse 1.2s ease-in-out infinite; }
.pm-chip--canceling { color: var(--warn-fg); background: transparent; border-color: var(--warn-fg); border-style: dashed; }
.pm-chip--succeeded, .pm-chip--ok { color: var(--ok-fg); background: var(--ok-bg); border-color: #B7DACF; }
.pm-chip--failed, .pm-chip--danger { color: var(--danger-fg); background: var(--danger-bg); border-color: #EBC3BD; }
.pm-chip--warn { color: var(--warn-fg); background: var(--warn-bg); border-color: #E6D4A4; }
.pm-chip--canceled, .pm-chip--expired, .pm-chip--unknown { color: var(--muted-strong); background: transparent; border-color: var(--pm-edge); }
.pm-chip--canceled::before, .pm-chip--expired::before, .pm-chip--unknown::before { background: transparent; border: 1px solid currentColor; }
.pm-chip--na { color: var(--muted-strong); background: transparent; border-color: var(--pm-edge); border-style: dashed; }
.pm-chip--test { color: var(--pm-on-dark); background: var(--night-2); border-color: var(--night-2); }
@keyframes pm-pulse { 50% { opacity: 0.3; } }

/* Worker status line: "GPU worker online · NVIDIA GH200 · queue empty" */
.pm-strip {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.5;
  color: var(--muted-strong);
}
.pm-strip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; transform: translateY(-1px); border: 1px solid currentColor; }
.pm-strip--on { color: var(--ok-fg); }
.pm-strip--on::before { background: var(--ok-fg); border-color: var(--ok-fg); animation: pm-pulse 1.2s ease-in-out infinite; }
.pm-strip--warn { color: var(--warn-fg); }
.pm-strip--warn::before { background: var(--warn-fg); }
.pm-strip--test { color: var(--ink); }
.pm-strip--test::before { background: var(--coral); border-color: var(--coral); }

/* ── Progress ─────────────────────────────────────────────── */
.pm-progress { display: grid; gap: 8px; }
.pm-progress__track {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--rule);
  background: color-mix(in oklch, var(--ink) 14%, transparent);
}
.pm-progress__fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--signal); transition: width .4s ease-out; }
.pm-progress__meta { display: flex; justify-content: space-between; gap: 12px; font-family: var(--f-mono); font-size: 11.5px; line-height: 1.5; color: var(--ink-2); }
.pm-progress__caption { min-width: 0; overflow-wrap: anywhere; }
.pm-progress__note { flex: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.pm-progress--thin .pm-progress__track { height: 3px; border-radius: 0; }
.pm-progress--warn .pm-progress__fill { background: var(--warn-fg); }
.pm-progress--error .pm-progress__fill { background: var(--danger-fg); }
.pm-progress--done .pm-progress__fill { background: var(--signal-fg); }
/* Work in progress with no percentage reported: a band that travels, never a made-up number */
.pm-progress--indeterminate .pm-progress__fill { width: 32%; animation: pm-travel 1.6s ease-in-out infinite; }
@keyframes pm-travel { 0% { transform: translateX(-110%); } 100% { transform: translateX(330%); } }

/* ── Inline confirm ───────────────────────────────────────── */
.pm-confirm {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 6px 6px 6px 14px;
  background: var(--card);
  border: 1px solid var(--pm-edge); border-radius: 22px;
  font-size: 13.5px; color: var(--ink);
}
.pm-confirm__q { font-weight: 600; margin-right: 4px; }

/* ── Empty state, skeleton ────────────────────────────────── */
.pm-empty {
  padding: 36px 18px; text-align: center;
  border: 1.5px dashed var(--rule);
  border: 1.5px dashed color-mix(in oklch, var(--ink) 25%, transparent);
  border-radius: var(--radius);
}
.pm-empty__icon {
  width: 32px; height: 32px; margin: 0 auto 12px;
  border: 1.5px solid var(--muted-strong); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-mono); color: var(--muted-strong);
}
.pm-empty__title { font-size: 18px; line-height: 1.3; color: var(--ink); margin: 0; }
.pm-empty__text { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); margin: 6px auto 0; max-width: 420px; }
.pm-empty .pm-btn { margin-top: 16px; }

.pm-skeleton {
  display: block; height: 14px; border-radius: 6px;
  background-color: var(--paper-3);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 220px 100%; background-repeat: no-repeat; background-position: -220px 0;
  animation: pm-shimmer 1.4s ease-in-out infinite;
}
.pm-skeleton + .pm-skeleton { margin-top: 10px; }
.pm-skeleton--title { height: 30px; width: 55%; }
.pm-skeleton--short { width: 38%; }
.pm-skeleton--block { height: 96px; }
@keyframes pm-shimmer { to { background-position: calc(100% + 220px) 0; } }

/* ── Tables ───────────────────────────────────────────────────
   A real <table>. Below 641 px each row becomes a block and every cell shows its
   data-label, so give each <td> one: <td data-label="Submitted">. */
.pm-table-wrap { overflow: hidden; }
/* On its own (inside a block, say) the wrapper draws the frame; on an .pm-card the card does. */
.pm-table-wrap:not(.pm-card) {
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--card);
}
.pm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.45; }
.pm-table caption { text-align: left; padding: 14px 18px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-strong); }
.pm-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.pm-table tr { display: block; padding: 12px 18px; border-top: 1px solid var(--rule); border-top: 1px solid color-mix(in oklch, var(--rule) 70%, transparent); }
.pm-table tbody tr:first-child { border-top: 0; }
.pm-table td { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 4px 0; vertical-align: top; overflow-wrap: anywhere; }
.pm-table td::before {
  content: attr(data-label);
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-strong); padding-top: 2px;
}
.pm-table td:not([data-label]) { grid-template-columns: 1fr; }
.pm-table td:not([data-label])::before { content: none; }
.pm-table a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--pm-edge); text-underline-offset: 3px; }
.pm-table a:hover { text-decoration-color: var(--signal); }
.pm-table__id { font-family: var(--f-mono); font-size: 12.5px; }

.pm-loadmore {
  display: flex; justify-content: center; padding: 16px;
  border-top: 1px solid var(--rule);
  border-top: 1px solid color-mix(in oklch, var(--rule) 70%, transparent);
}

/* ── Job tray ("Your recent jobs") ────────────────────────── */
.pm-tray { overflow: hidden; }
.pm-tray__head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  border-bottom: 1px solid color-mix(in oklch, var(--rule) 80%, transparent);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-strong);
}
.pm-tray__head a { color: var(--muted-strong); text-decoration: underline; text-decoration-color: var(--pm-edge); text-underline-offset: 3px; }
.pm-tray__head a:hover { color: var(--ink); }
.pm-jobrow {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "id chip" "what what" "stage stage";
  gap: 4px 12px; align-items: center;
  padding: 14px 18px;
  font-family: var(--f-mono); font-size: 12px; line-height: 1.5;
  border-top: 1px solid var(--rule);
  border-top: 1px solid color-mix(in oklch, var(--rule) 60%, transparent);
}
.pm-jobrow:first-of-type { border-top: 0; }
.pm-tray__empty { margin: 0; padding: 18px; font-family: var(--f-mono); font-size: 12px; line-height: 1.5; color: var(--muted-strong); }
.pm-jobrow__id { grid-area: id; color: var(--ink); text-decoration: underline; text-decoration-color: var(--pm-edge); text-underline-offset: 3px; }
.pm-jobrow__id:hover { text-decoration-color: var(--signal); }
.pm-jobrow__what { grid-area: what; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-jobrow__stage { grid-area: stage; color: var(--muted-strong); }
.pm-jobrow__chip { grid-area: chip; justify-self: end; }
.pm-jobrow .pm-progress { grid-column: 1 / -1; margin-top: 4px; }

/* ── File rows: result files, stored inputs, the chosen file ─ */
.pm-files { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; }
.pm-file {
  display: grid; grid-template-columns: 36px 1fr; gap: 6px 14px; align-items: start;
  padding: 14px 16px;
  background: var(--card);
}
.pm-file__icon {
  width: 36px; height: 36px; border: 1px solid var(--ink-2); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.04em; color: var(--ink-2);
}
.pm-file--report .pm-file__icon { border-color: var(--signal-fg); color: var(--signal-fg); }
.pm-file__main { min-width: 0; }
.pm-file__name { display: block; font-size: 15px; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.pm-file__desc { display: block; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.pm-file__meta { display: block; font-family: var(--f-mono); font-size: 10.5px; line-height: 1.6; color: var(--muted-strong); margin-top: 4px; overflow-wrap: anywhere; }
.pm-file__action { grid-column: 2; justify-self: start; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pm-file--deleted .pm-file__name { color: var(--muted-strong); text-decoration: line-through; }
.pm-file--deleted .pm-file__icon { border-style: dashed; border-color: var(--pm-edge); color: var(--muted-strong); }

/* ── Key / value list ─────────────────────────────────────── */
.pm-kv { margin: 0; font-size: 13.5px; line-height: 1.5; }
.pm-kv > div { display: grid; gap: 2px; padding: 9px 0; border-bottom: 1px dashed var(--pm-line); }
.pm-kv > div:last-child { border-bottom: 0; }
.pm-kv dt { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-strong); }
.pm-kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* ── Result summary: headline numbers, small table, figure ── */
.pm-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; }
.pm-metric { padding: 14px 16px; background: var(--card); min-width: 0; }
.pm-metric__value { display: block; font-family: var(--f-sans); font-weight: 600; font-size: 26px; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; }
.pm-metric__unit { font-family: var(--f-sans); font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); margin-left: 3px; }
.pm-metric__label { display: block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-strong); margin-top: 6px; }
.pm-metric__note { display: block; font-size: 12px; line-height: 1.4; color: var(--ink-2); margin-top: 4px; }
.pm-figure { margin: 0; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--card); overflow: hidden; }
.pm-figure img { max-width: 100%; height: auto; margin: 0 auto; }
.pm-figure figcaption { padding: 10px 14px; border-top: 1px solid var(--rule); font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }

/* ── Tabs and filter chips ────────────────────────────────── */
.pm-tabs {
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--pm-line);
}
.pm-tabs::-webkit-scrollbar { display: none; }
/* A tab is a button that shows a panel (aria-selected), or a link to a page of its own (aria-current). */
.pm-tab {
  flex: none; padding: 14px 0 12px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
  color: var(--muted-strong); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.pm-tab:hover { color: var(--ink); }
.pm-tab[aria-selected="true"], .pm-tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.pm-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.pm-filter {
  min-height: 34px; padding: 8px 14px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--pm-line); border-radius: 999px;
  transition: background .15s, color .15s, border-color .15s;
}
.pm-filter:hover { border-color: var(--ink); color: var(--ink); }
.pm-filter[aria-pressed="true"] { background: var(--pm-teal); color: #fff; border-color: var(--pm-teal); }

/* ── Activity list ────────────────────────────────────────── */
.pm-timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; line-height: 1.5; }
.pm-timeline li { display: grid; gap: 2px; padding: 9px 0; border-bottom: 1px dashed var(--pm-line); }
.pm-timeline li:last-child { border-bottom: 0; }
.pm-timeline time { font-family: var(--f-mono); font-size: 11px; color: var(--muted-strong); }

/* ── Disclosure ("Didn't get the email?") ─────────────────── */
.pm-details { border-top: 1px solid var(--pm-line); border-bottom: 1px solid var(--pm-line); }
.pm-details > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; font-size: 14px; font-weight: 600; color: var(--ink);
}
.pm-details > summary::-webkit-details-marker { display: none; }
.pm-details > summary::after {
  content: "+"; flex: none;
  width: 22px; height: 22px; border: 1px solid var(--pm-edge); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 13px; font-weight: 400; color: var(--ink-2);
  transition: transform .2s, color .15s, border-color .15s;
}
.pm-details[open] > summary::after { transform: rotate(45deg); color: var(--signal-fg); border-color: var(--signal); }
.pm-details__body { padding: 0 0 14px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.pm-details__body p { margin: 0 0 8px; }

/* Commands shown to administrators */
.pm-cmd {
  margin: 0; padding: 12px 14px; overflow-x: auto; white-space: pre;
  font-family: var(--f-mono); font-size: 12px; line-height: 1.55; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius-sm);
}

/* ── Long text (privacy, terms) ───────────────────────────── */
.pm-prose { max-width: 720px; font-size: 15.5px; line-height: 1.65; color: var(--ink); }
.pm-prose h2 { font-family: var(--f-display); font-weight: 400; font-size: 30px; line-height: 1.15; letter-spacing: -0.005em; margin: 48px 0 14px; padding-top: 18px; border-top: 1px solid var(--ink); }
.pm-prose h3 { font-family: var(--f-sans); font-weight: 600; font-size: 16.5px; line-height: 1.35; letter-spacing: 0; margin: 28px 0 8px; }
.pm-prose p { margin: 0 0 14px; }
.pm-prose ul, .pm-prose ol { margin: 0 0 14px; padding-left: 22px; }
.pm-prose li + li { margin-top: 6px; }
.pm-prose a { color: var(--signal-fg); text-decoration-color: var(--signal); }
.pm-version { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-strong); }

/* ── Navbar additions (the markup comes from app.js) ──────── */
.pm-nav-slot { display: contents; }
/* The pills app.js adds stand on the night-blue bar like the page's own. */
.pm-nav-pill.primary:hover { color: var(--night); }
.pm-nav-pill.secondary:hover { color: var(--on-night); }
.pm-nav-signin, .pm-user { display: none; }
/* "Sign in / Sign up": the second half shows where the navbar has room for it (wide screens,
   below) and always in the mobile sheet, whose pill has the whole width. */
.pm-nav-signin .pm-nav-signup { display: none; }
.pm-nav-signup { white-space: pre; }
/* The words of the pill carry their own space; the gap of a pill would add a second one. */
.pm-nav-signin { gap: 0; }
.pm-user { position: relative; }
.pm-user__btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--on-night); background: rgba(233, 238, 242, 0.08); border: 1px solid rgba(233, 238, 242, 0.24);
  transition: background .15s, color .15s, border-color .15s;
}
.pm-user__btn:hover { border-color: rgba(233, 238, 242, 0.6); }
.pm-user__btn[aria-expanded="true"] { background: var(--on-night); border-color: var(--on-night); color: var(--night); }
.pm-user__menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  min-width: 232px; max-width: min(320px, calc(100vw - 32px));
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: var(--pm-shadow);
}
.pm-user__who { display: grid; gap: 2px; padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--rule); }
.pm-user__label { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-strong); }
.pm-user__email { font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-user .pm-user__item {
  display: block; width: 100%; padding: 9px 10px; text-align: left;
  font-family: var(--f-sans); font-size: 14px; font-weight: 500; line-height: 1.3;
  color: var(--ink); text-decoration: none; border-radius: 8px;
}
.pm-user .pm-user__item:hover { background: var(--paper-2); color: var(--ink); }

/* The closed sheet sits just outside the viewport, but its shadow reaches 60 px back into it. */
.pm-sheet:not(.open) { box-shadow: none; }

/* Mobile sheet: the same entries, above its "Submit a Job" pill */
.pm-sheet-account { display: grid; gap: 10px; }
.pm-sheet-who { display: grid; gap: 2px; padding-top: 14px; border-top: 1px solid rgba(233, 238, 242, 0.14); }
.pm-sheet-who .pm-user__label { color: var(--on-night-3); }
.pm-sheet-who .pm-user__email { color: var(--on-night); }
.pm-sheet-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 4px; }
.pm-sheet-link { padding: 6px 0; font-family: var(--f-sans); font-size: 15px; font-weight: 600; color: var(--on-night); text-decoration: underline; text-decoration-color: rgba(233, 238, 242, 0.35); text-underline-offset: 3px; }
.pm-sheet-link:hover { color: var(--warm); }
.pm-sheet-signin { justify-content: center; }

/* ── Vertical rhythm ──────────────────────────────────────────
   .pm-stack spaces its children evenly. It stands after the components on purpose: many of
   them reset their own margin, and here the stack has the last word. */
.pm-stack > * + * { margin-top: var(--pm-gap, 20px); }
.pm-stack--tight { --pm-gap: 10px; }
.pm-stack--loose { --pm-gap: 32px; }

/* ── Wider screens ────────────────────────────────────────── */
@media (min-width: 541px) {
  /* Below this the navbar has room for the logo, one pill and the menu button only;
     sign-in and the account entries live in the mobile sheet there. */
  .pm-nav-signin { display: inline-flex; }
  .pm-user { display: block; }
}

/* Measured with the site's own fonts: between these widths the navbar keeps at least 60 px free
   on either side of its links with the longer pill. From 901 to 1023 px the four links and three
   pills leave no room for it, and below 600 px neither do the logo and two pills. */
@media (min-width: 600px) and (max-width: 900px), (min-width: 1024px) {
  .pm-nav-signin .pm-nav-signup { display: inline; }
}

@media (min-width: 641px) {
  .pm-shell { padding: 40px 20px 72px; }
  .pm-card--pad { padding: 32px 36px; }
  .pm-card__foot { padding: 16px 36px; }
  .pm-block { padding: 32px 36px; }
  .pm-block__head { grid-template-columns: 66px 1fr auto; gap: 14px; margin-bottom: 20px; }
  .pm-block__hint { grid-column: auto; }
  .pm-band { grid-template-columns: 1fr auto; gap: 24px; padding: 26px 36px; }
  .pm-input, .pm-select, .pm-textarea { font-size: 15px; min-height: 42px; }
  .pm-input--code { font-size: 26px; }
  .pm-btn { min-height: 42px; }
  .pm-btn--sm { min-height: 32px; }
  /* Page-wide banners line up with the navbar content (1320 px column, 32 px gutter) */
  .pm-banners > .pm-banner { padding: 12px max(32px, calc((100vw - 1320px) / 2 + 32px)); }

  .pm-param { grid-template-columns: 200px 1fr; gap: 12px 24px; align-items: center; }
  .pm-options--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-option { grid-template-columns: 16px 1fr auto; padding: 18px 20px; }
  .pm-option__side { grid-column: 3; grid-row: 1; justify-self: end; }
  .pm-option__meta { grid-column: 2 / 4; }
  .pm-drop { padding: 40px 28px; }

  .pm-table thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .pm-table tr { display: table-row; padding: 0; border-top: 0; }
  .pm-table th {
    text-align: left; padding: 12px 18px;
    font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted-strong); white-space: nowrap;
    border-bottom: 1px solid var(--ink);
  }
  .pm-table td { display: table-cell; padding: 13px 18px; border-top: 1px solid var(--rule); border-top: 1px solid color-mix(in oklch, var(--rule) 70%, transparent); }
  .pm-table td::before { content: none; }
  .pm-table tbody tr:first-child td { border-top: 0; }
  .pm-table tbody tr:hover td { background: var(--paper); background: color-mix(in oklch, var(--paper) 60%, var(--card)); }
  .pm-table__num { text-align: right; font-variant-numeric: tabular-nums; }

  .pm-tray__head { padding: 16px 24px; }
  .pm-tray__empty { padding: 18px 24px; }
  .pm-jobrow { grid-template-columns: 124px minmax(0, 1fr) minmax(0, 190px) auto; grid-template-areas: "id what stage chip"; gap: 18px; padding: 16px 24px; }
  .pm-file { grid-template-columns: 36px 1fr auto; padding: 16px 20px; }
  .pm-file__action { grid-column: 3; grid-row: 1; justify-self: end; align-self: center; margin-top: 0; }
  .pm-kv > div { grid-template-columns: 180px 1fr; gap: 16px; }
  .pm-kv dt { padding-top: 3px; }
  .pm-metrics { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .pm-timeline li { grid-template-columns: 210px 1fr; gap: 16px; }
  .pm-timeline time { padding-top: 2px; }
  .pm-empty { padding: 48px 28px; }
  .pm-user__btn { width: 40px; height: 40px; font-size: 12px; }
}

@media (min-width: 901px) {
  .pm-shell { padding: 64px var(--gutter) 96px; }
  .pm-hero { padding-bottom: 36px; margin-bottom: 44px; }
  .pm-block__head { grid-template-columns: 80px 1fr auto; gap: 24px; }
  /* Content sits under the block's name, as on the existing server page */
  .pm-block__body { padding-left: 104px; }
  .pm-param { grid-template-columns: 200px 1fr 140px; }
  .pm-param__val { display: block; }
}

/* ── Motion and contrast preferences ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pm-btn, .pm-progress__fill, .pm-details > summary::after { transition: none; }
  .pm-chip--running::before, .pm-strip--on::before, .pm-skeleton { animation: none; }
  .pm-progress--indeterminate .pm-progress__fill { animation: none; width: 100%; opacity: 0.45; }
  .pm-btn[aria-busy="true"]::before, .pm-spinner { animation-duration: 2s; }
}
@media (forced-colors: active) {
  .pm-progress__fill { background: Highlight; }
  .pm-option[aria-checked="true"], .pm-tab[aria-selected="true"], .pm-tab[aria-current="page"], .pm-filter[aria-pressed="true"], .pm-seg__item[aria-checked="true"] { outline: 2px solid Highlight; }
}

/* The two halves of the server, under the opener of the Atlas and of the Server page */
.pm-tabs--modes { margin-top: 22px; }
/* A short service page keeps its footer at the bottom of the window. */
.pm-bg { display: flex; flex-direction: column; min-height: 100vh; }
.pm-bg > .pm-shell { flex: 1 0 auto; width: 100%; }
/* An opener that ends in those tabs is closed by their rule, not by a second one of its own. */
.pm-hero--modes { padding-bottom: 0; border-bottom: 0; margin-bottom: 20px; }
