/* Tensai client portal — what it adds to the UI library (ui.css) and the Issuer's own parts
 * (issuer.css), both loaded first. Only the library's tokens are used, so light and dark come
 * from the same lines and keep the contrast tokens.css is checked for. Menus, popovers, the
 * theme control and the selects are the library's; only their place in this portal is set
 * here. Pages use the full width of the window, with gutters that grow with it; text keeps a
 * readable measure. */

body.cp { --cp-gutter: clamp(16px, 2.5vw + 8px, 64px); background: var(--canvas); min-height: 100vh; display: flex; flex-direction: column; }

/* ── shell: a navy top bar (the staff portal's sidebar colour) ──────── */
.cp-top { position: sticky; top: 0; z-index: 40; background: var(--nav-bg); color: var(--nav-text-2); border-bottom: 1px solid var(--nav-line); }
.cp-top-in { padding: 0 var(--cp-gutter); min-height: 60px; display: flex; align-items: center; gap: 28px; }
.cp-brand { display: flex; align-items: center; gap: 11px; color: var(--nav-text); text-decoration: none; flex: 0 0 auto; }
.cp-brand:hover { text-decoration: none; }
.cp-brand-name { display: grid; gap: 5px; font: 600 1rem/1.15 var(--font); letter-spacing: .01em; }
.cp-brand-name small { font: 400 .76rem/1.2 var(--font); color: var(--nav-muted); letter-spacing: 0; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The theme button on the navy bar (the size of the account button), showing the theme in force
   (.th-ico, menu.css); its popover's rows are the theme radios, the one in force ticked. */
.cp-theme-btn { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--nav-text-2);
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); }
.cp-theme-btn:hover, .dd[open] > .cp-theme-btn { color: var(--nav-text); background: rgba(255, 255, 255, .16); }
.cp-theme-btn .i { width: 18px; height: 18px; }
.cp-theme-panel .dd-item { position: relative; cursor: pointer; }
.cp-theme-panel .dd-item:has(input:checked) > .ui-check { visibility: visible; }
.cp-theme-panel .dd-item:has(input:focus-visible) { background: var(--ui-row-active-bg); box-shadow: inset 0 0 0 2px var(--ui-row-active-ring); }
@media (forced-colors: active) { .cp-theme-panel .dd-item:has(input:focus-visible) { outline: 2px solid Highlight; outline-offset: -2px; } }
/* The sections: a size container, so that without client.js the stylesheet can tell when they
   might not fit (below). */
.cp-nav { display: flex; align-items: stretch; align-self: stretch; gap: 2px; flex: 1 1 auto; min-width: 0; container: cp-nav / inline-size; }
.cp-link { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--nav-text-2); font-weight: 450; white-space: nowrap; text-decoration: none; }
.cp-link .i { width: 17px; height: 17px; opacity: .85; }
.cp-link:hover { color: var(--nav-text); background: rgba(255, 255, 255, .06); text-decoration: none; }
.cp-link.is-active { color: var(--nav-text); font-weight: 550; }
.cp-link.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; background: var(--nav-accent); }
.cp-link.is-active .i { opacity: 1; color: var(--nav-accent); }
.cp-right { display: flex; align-items: center; gap: 12px; margin-left: auto; flex: 0 0 auto; }
.cp-top .env { background: transparent; color: #f6c97a; border-color: rgba(246, 201, 122, .5); }
.cp-top .env::before { background: #f6c97a; }
.cp-top .env-staging { color: #a9c6ff; border-color: rgba(169, 198, 255, .5); }
.cp-top .env-staging::before { background: #a9c6ff; }
.cp-top .badge.tone-accent { background: rgba(255, 255, 255, .12); color: var(--nav-text); }
.cp-avatar { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center;
  background: rgba(255, 255, 255, .1); color: var(--nav-text); font: 600 .82rem/1 var(--font); border: 1px solid rgba(255, 255, 255, .22); }
summary.cp-avatar:hover, .dd[open] > summary.cp-avatar { background: rgba(255, 255, 255, .16); }
/* The account menu: wide enough for an email address. */
.cp-menu { width: 290px; }

.cp-main { width: 100%; padding: 32px var(--cp-gutter) 56px; flex: 1 0 auto; container: page / inline-size; }
.cp-notice { margin-bottom: 20px; }
.cp-foot { width: 100%; padding: 18px var(--cp-gutter) 28px; display: flex; flex-wrap: wrap; gap: 6px 20px;
  color: var(--muted); font-size: .84rem; border-top: 1px solid var(--line); }
.cp-foot > :first-child { margin-right: auto; }
.cp-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ── signed-out pages ───────────────────────────────────────────────── */
.cp .auth { flex: 1 0 auto; }
.cp .auth-main { align-content: center; gap: 18px; }
.cp-auth-logo { display: none; }
.cp-auth-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; }
.cp-auth-foot a { color: var(--muted); }
.cp-forgot { margin: -6px 0 14px; }
.cp-eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent-text); font: 600 .74rem/1.2 var(--font); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.cp-eyebrow .i { width: 15px; height: 15px; }
.cp-state-icon { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; margin-bottom: 18px;
  color: var(--b-fg, var(--accent-on-soft)); border: 1px solid currentColor; }
.cp-state-icon .i { width: 22px; height: 22px; }
.cp-progress { list-style: none; display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--line); }
.cp-progress li { display: flex; align-items: center; gap: 10px; padding: 12px 0 0; color: var(--muted); font-size: .86rem; font-weight: 500; position: relative; }
.cp-progress li span { width: 22px; height: 22px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font: 500 .76rem/1 var(--mono); }
.cp-progress li.is-current { color: var(--text); font-weight: 600; }
.cp-progress li.is-current::before { content: ""; position: absolute; left: 0; right: 8px; top: -2px; height: 3px; background: var(--accent); }
.cp-progress li.is-current span { background: var(--accent); color: var(--accent-ink); }
.cp-pw { gap: 0 14px; }
.cp-terms .check { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; color: var(--text-2); font-weight: 400; }
.cp-terms .check .cb { margin-top: 3px; flex: 0 0 auto; }

/* ── licences ───────────────────────────────────────────────────────── */
.cp-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px var(--card-pad); margin-bottom: var(--gap);
  border-left: 3px solid var(--accent); flex-wrap: wrap; }
.cp-hero-body { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 420px; }
.cp-hero-body h2 { font-size: 1.05rem; margin: 0 0 2px; }
.cp-hero-icon { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; border: 1px solid var(--accent-soft-2); color: var(--accent-text); flex: 0 0 auto; }
.cp-section-title { margin: 28px 0 12px; }
.cp-section-title:first-child { margin-top: 0; }
.cp-offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--gap); }
.cp-offer { display: flex; flex-direction: column; padding: var(--card-pad); gap: 14px; }
.cp-offer.is-live { border-top: 3px solid var(--accent); }
.cp-offer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cp-offer-title { min-width: 0; }
.cp-offer-title h2 { font-size: 1.02rem; margin: 0; }
.cp-offer-icon { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; flex: 0 0 auto;
  color: var(--b-fg, var(--accent-on-soft)); border: 1px solid var(--line); }
.cp-offer-icon .i { width: 17px; height: 17px; }
.cp-offer-facts { margin: 0; }
.cp-offer-actions { margin-top: auto; }
/* How it works, for someone with nothing collected yet. */
.cp-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); border-top: 1px solid var(--line); }
.cp-how > div { padding: 20px var(--card-pad); border-left: 1px solid var(--line); }
.cp-how > div:first-child { border-left: 0; }
.cp-how .n { font: 500 .78rem/1 var(--mono); color: var(--accent-text); letter-spacing: .06em; }
.cp-how h3 { color: var(--text); font-size: .95rem; text-transform: none; letter-spacing: 0; margin: 8px 0 4px; }
.cp-how p { color: var(--muted); font-size: .9rem; margin: 0; max-width: 46ch; }
@container page (max-width: 760px) {
  .cp-how > div { border-left: 0; border-top: 1px solid var(--line); }
  .cp-how > div:first-child { border-top: 0; }
}

/* ── collecting a licence ───────────────────────────────────────────── */
.cp-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 14px; font-size: .9rem; }
.cp-back .i { width: 15px; height: 15px; }
.cp-collect { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }
.cp-step { padding: var(--card-pad); display: flex; flex-direction: column; }
.cp-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cp-step-head h2 { font-size: 1.02rem; margin: 0; }
.cp-step-n { width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 500 .86rem/1 var(--mono); flex: 0 0 auto; }
.cp-step-end { margin-top: auto; padding-top: 12px; }
.cp-open { width: 100%; justify-content: center; margin: 4px 0 12px; }
.cp-qr { display: grid; justify-items: center; gap: 10px; margin: 4px 0 12px; }
.cp-qr img { width: clamp(180px, 14vw, 240px); height: auto; aspect-ratio: 1; }
.cp-qr-more > summary { cursor: pointer; color: var(--accent-text); font-size: .9rem; margin-bottom: 10px; }
.cp-pin { display: flex; gap: clamp(4px, 1.4vw, 8px); margin: 6px 0 14px; }
.cp-pin span { width: clamp(38px, 11vw, 48px); height: clamp(48px, 13vw, 60px); display: grid; place-items: center; border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--surface-2); font: 500 clamp(1.35rem, 5vw, 1.75rem)/1 var(--mono); color: var(--text); }
.cp-fineprint { display: flex; align-items: center; gap: 6px; margin-top: 16px; max-width: 100ch; }
.cp-done { display: flex; gap: 16px; align-items: flex-start; }
.cp-done .cp-state-icon { margin: 0; }
.cp-done h2 { font-size: 1.1rem; margin: 2px 0 4px; }

/* ── the app ────────────────────────────────────────────────────────── */
.cp-download { justify-content: center; }
.cp-size { font-weight: 400; margin-left: 4px; font-family: var(--mono); font-size: .86em; }
.cp-notes { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.cp-app-qr { margin: 0 auto 12px; }
.cp-app-qr img { width: 200px; height: 200px; }
/* TR500 Simulator: the activation code beside its QR code */
.sim-code-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.sim-code-qr { margin: 0; }
.sim-code-qr img { width: 168px; height: 168px; }
.sim-code { font-size: 1.9rem; font-weight: 600; letter-spacing: .12em; margin: 2px 0 0; color: var(--text); }
.cp-grants { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cp-grants li { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.cp-grants .i { color: var(--ok-text); }
.cp-places { display: grid; gap: 8px; }
.cp-places-figure { font: 600 1.8rem/1 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cp-places-figure small { font: 400 .9rem var(--font); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.cp-account { max-width: 1280px; }

/* ── product licences ───────────────────────────────────────────────── */
.cp-lic-home { margin-bottom: var(--gap); }
.cp-of { font: 400 .9rem var(--font); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.cp-lic-date { font-size: clamp(1.15rem, 11cqi, 1.6rem); }
/* inline: on a phone the table's cell puts its label before it, on the same line */
.cp-seats { display: inline-grid; gap: 5px; min-width: 96px; vertical-align: baseline; }
.cp-seats .meter { width: 96px; }
/* A licence: Devices, the licence's facts (and help), then Activity, the grid's own children in
   that order. On a wide page the facts are beside both and Activity follows Devices (its row,
   not Devices', takes what the facts need beyond Devices); on a narrow one they come one under
   the other, so a phone has the key and the expiry before the history. */
.cp-lic { grid-template-rows: auto 1fr; }
.cp-lic > .cp-lic-seats { grid-column: 1; grid-row: 1; }
.cp-lic > .cp-lic-activity { grid-column: 1; grid-row: 2; }
.cp-lic > .cp-lic-side { grid-column: 2; grid-row: 1 / span 2; }
@container page (max-width: 1180px) {
  .cp-lic { grid-template-rows: none; }
  .cp-lic > .cp-lic-seats, .cp-lic > .cp-lic-activity, .cp-lic > .cp-lic-side { grid-column: auto; grid-row: auto; }
}
/* A device on a phone (the library puts the status and the row's actions both at the row's end):
   "Free this seat" on a line of its own under the dates, so it covers neither the status nor
   them. */
@container page (max-width: 640px) {
  .cp-lic .table.responsive td.col-actions { grid-column: 1 / -1; grid-row: auto; justify-self: start; align-self: start; margin-top: 6px; }
}
/* Activity: the latest events, the rest once "Show all" is open. Without :has, all of them
   show, and so no "Show all". */
.cp-lic-activity:has(.cp-all:not([open])) .table tr.cp-later { display: none; }
.cp-all { padding: 10px var(--card-pad) 12px; }
.cp-all[open] { border-top: 1px solid var(--line); } /* closed, the last row shown has its line */
.cp-all > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 500; }
.cp-all > summary::-webkit-details-marker { display: none; }
.cp-all > summary .i { width: 15px; height: 15px; transition: transform var(--ease); }
.cp-all[open] > summary .i { transform: rotate(180deg); }
.cp-all[open] .cp-all-more, .cp-all:not([open]) .cp-all-less { display: none; }
@supports not selector(:has(*)) { .cp-all { display: none; } }

/* ── staff preview ──────────────────────────────────────────────────── */
.cp-preview { background: var(--warn-soft); border-bottom: 1px solid var(--warn-line); color: var(--text); }
.cp-preview-in { padding: 9px var(--cp-gutter); display: flex; align-items: center; gap: 14px; }
.cp-preview-icon { color: var(--warn-text); display: grid; }
.cp-preview-icon .i { width: 19px; height: 19px; }
.cp-preview-text { flex: 1; font-size: .88rem; line-height: 1.45; color: var(--text-2); }
.cp-preview-text strong { color: var(--text); }
.cp-redacted { display: flex; align-items: center; gap: 10px; padding: 16px; margin-bottom: 12px; border-radius: var(--r-md);
  border: 1px dashed var(--line-strong); background: var(--surface-2); color: var(--muted); font-size: .9rem; }
.cp-redacted .i { flex: 0 0 auto; }
.cp-pin-hidden span { color: var(--faint); }

/* ── narrower windows ───────────────────────────────────────────────── */
@container page (max-width: 1080px) {
  .cp-collect { grid-template-columns: 1fr; }
}
/* The sections' short names where the full ones would not fit (the full name stays as the
   link's name for screen readers, out of sight; the short one is aria-hidden), and those the bar still has no
   room for in More (below). The bar never runs off the page: without any script it scrolls
   sideways, its thin scroll bar showing that there is more. */
.cp-short { display: none; }
.cp-nav { overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .3) transparent; }
@media (max-width: 1120px) {
  .cp-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .cp-short { display: inline; }
}
/* Between the tab bar and room for everything, the top bar's sections are words only. */
@media (min-width: 901px) and (max-width: 1120px) {
  .cp-link .i { display: none; }
}
@media (max-width: 1000px) {
  .cp-brand-name small { max-width: 16ch; }
  .cp-link { padding: 0 9px; }
}
/* More: the sections the bar has no room for, as a menu. When the page is one of them, More is
   marked as the page's own link would be, and so is its item. */
.cp-more { display: none; }
.cp-more > summary { cursor: pointer; }
.cp-more[open] > summary, .cp-more:has(.dd-item[aria-current="page"]:not([hidden])) > summary { color: var(--nav-text); }
.cp-more:has(.dd-item[aria-current="page"]:not([hidden])) > summary::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; background: var(--nav-accent); }
.cp-more:has(.dd-item[aria-current="page"]:not([hidden])) > summary .i { opacity: 1; color: var(--nav-accent); }
.cp-more .dd-item[aria-current="page"] { color: var(--accent-text); font-weight: 550; }
.cp-more .dd-item[aria-current="page"] .i { color: var(--accent-text); }
@media (min-width: 901px) {
  /* client.js fits the bar: the full names, or the short ones (words only) when they leave
     fewer sections out; the links that still do not fit hidden, their items shown in More. */
  .cp-nav[data-cp-fit="more"] > .cp-more { display: flex; }
  .cp-nav[data-cp-short] .cp-link .i { display: none; }
  .cp-nav[data-cp-short] .cp-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .cp-nav[data-cp-short] .cp-short { display: inline; }
  /* Without client.js (a staff preview loads none of the portal's own scripts) the bar's width
     and its number of sections decide, as if they had the longest names (measured: nine full
     names need 1050px, seven 867, five 646; nine short ones 594; ten, with Product licences,
     about 1220px): four or more take the short names where the full ones might not fit; and
     with the library's script, which opens More over the page ([popover]: in place, the bar
     would cut it off), five or more put the less used ones (.cp-x) in More where even the short
     ones might not. */
  @container cp-nav (max-width: 1220px) {
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(10)) .cp-link .i { display: none; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(10)) .cp-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(10)) .cp-short { display: inline; }
  }
  @container cp-nav (max-width: 1050px) {
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(8)) .cp-link .i { display: none; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(8)) .cp-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(8)) .cp-short { display: inline; }
  }
  @container cp-nav (max-width: 870px) {
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(6)) .cp-link .i { display: none; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(6)) .cp-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(6)) .cp-short { display: inline; }
  }
  @container cp-nav (max-width: 650px) {
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(4)) .cp-link .i { display: none; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(4)) .cp-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .cp-nav:not([data-cp-fit]):has(> a.cp-link:nth-of-type(4)) .cp-short { display: inline; }
  }
  @container cp-nav (max-width: 600px) {
    .cp-nav:not([data-cp-fit]):has(> .cp-more > [popover]):has(> a.cp-link:nth-of-type(5)) > .cp-x { display: none; }
    .cp-nav:not([data-cp-fit]):has(> .cp-more > [popover]):has(> a.cp-link:nth-of-type(5)):has(> .cp-x) > .cp-more { display: flex; }
  }
}
/* Keyboard focus never lands under the navy bar (it is taller than the staff portals' top bar). */
html:has(body.cp) { scroll-padding-top: 72px; }
/* Phones and tablets: the sections become a tab bar at the foot of the screen, five at most:
   with six or more, the less used ones (.cp-x) move into More. */
@media (max-width: 900px) {
  .cp-top-in { min-height: 54px; gap: 12px; }
  .cp-nav { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; gap: 0;
    padding: 0 4px env(safe-area-inset-bottom); background: var(--nav-bg); border-top: 1px solid var(--nav-line); }
  .cp-link { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; height: 58px; padding: 0 2px;
    font-size: .8rem; font-weight: 500; text-align: center; }
  .cp-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cp-link .i { width: 20px; height: 20px; }
  .cp-link.is-active::after { top: 0; bottom: auto; left: 22%; right: 22%; }
  .cp-nav:has(> a.cp-link:nth-of-type(6)) > .cp-x { display: none; }
  .cp-nav:has(> a.cp-link:nth-of-type(6)) > .cp-more { display: flex; flex: 1 1 0; min-width: 0; }
  .cp-more > summary { width: 100%; }
  .cp-more:has(.dd-item[aria-current="page"]:not([hidden])) > summary::after { top: 0; bottom: auto; left: 22%; right: 22%; }
  body.cp:has(.cp-nav) { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  /* Above the tab bar: a form's save bar, the toasts (above the save bar too, so they never
     cover its buttons), and where a focused field is scrolled to. */
  body.cp:has(.cp-nav) .form-actions { bottom: calc(58px + env(safe-area-inset-bottom)); }
  body.cp:has(.cp-nav) .toasts { bottom: calc(58px + env(safe-area-inset-bottom) + 12px); }
  body.cp:has(.cp-nav):has(.form-actions) .toasts { bottom: calc(58px + env(safe-area-inset-bottom) + 84px); }
  html:has(.cp-nav) { scroll-padding-bottom: calc(58px + env(safe-area-inset-bottom) + 12px); }
  html:has(.cp-nav):has(.form-actions) { scroll-padding-bottom: calc(58px + env(safe-area-inset-bottom) + 84px); }
  .cp-top .env { display: none; }
  .cp-main { padding-top: 22px; padding-bottom: 36px; }
  .cp-preview-in { flex-wrap: wrap; gap: 6px 12px; padding-top: 8px; padding-bottom: 8px; }
  .cp-preview-text { flex-basis: calc(100% - 40px); font-size: .82rem; }
  .cp-preview-more { display: none; }
  .cp-preview-in .btn { margin-left: 31px; }
}
@media (max-width: 560px) {
  .cp-pw { grid-template-columns: 1fr; }
  /* A preview's own bar above says it is one: the top bar keeps its room for the theme control
     and the person's initials. */
  .cp-right > .badge { display: none; }
}
@media (max-width: 380px) {
  .cp-brand-name small { display: none; }
}

/* API documentation: the readers' references (rendered Markdown) and C# samples */
.doc-readers { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: var(--gap, 20px); align-items: start; }
.doc-links { display: grid; gap: 8px; }
.doc-link { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); text-decoration: none; }
.doc-link:hover { border-color: var(--accent); background: var(--surface-2); }
.doc-link > svg { flex: none; margin-top: 2px; color: var(--accent-text); }
.doc-link strong { display: block; font-weight: 600; }
.doc-link span span { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.doc-crumb { font-size: .85rem; color: var(--muted); margin: 0 0 4px; }
.doc-crumb a { color: var(--muted); }
.doc-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.doc-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.doc-nav { display: flex; flex-direction: column; gap: 1px; }
.doc-nav .label { margin: 0 10px 6px; }
.doc-nav .doc-nav-sep { margin-top: 18px; }
.doc-nav-link, .doc-toc-link { display: block; padding: 6px 10px; border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-size: .9rem; }
.doc-toc-link { padding: 4px 10px; font-size: .84rem; color: var(--muted); }
.doc-nav-link:hover, .doc-toc-link:hover { background: var(--surface-2); color: var(--text); }
.doc-nav-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.doc-body { padding: 8px 32px 28px; min-width: 0; line-height: 1.6; }
.doc-body h2 { font-size: 1.3rem; margin: 30px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.doc-body h2:first-child { margin-top: 18px; padding-top: 0; border-top: 0; }
.doc-body h3 { font-size: 1.05rem; margin: 24px 0 8px; scroll-margin-top: 16px; }
.doc-body p, .doc-body ul, .doc-body ol { margin: 0 0 12px; max-width: 82ch; }
.doc-body li { margin: 3px 0; }
.doc-body code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: .86em; overflow-wrap: anywhere; }
.doc-body h2 code { font-size: .9em; }
.doc-code { position: relative; margin: 0 0 16px; }
.doc-code pre { margin: 0; padding: 14px 16px; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; line-height: 1.5; }
.doc-code pre code { background: none; border: 0; padding: 0; font-size: .84rem; overflow-wrap: normal; }
.doc-copy { position: absolute; top: 8px; right: 8px; }
.doc-table { margin: 0 0 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.doc-table table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.doc-table th, .doc-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc-table th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.doc-table tr:last-child td { border-bottom: 0; }
@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { display: none; }
  .doc-side { position: static; max-height: none; }
  .doc-body { padding: 4px 18px 22px; }
  .doc-readers { grid-template-columns: 1fr; }
}

/* The NDA page: the agreement scrolls inside the card, so the signature form stays in reach. */
.cp-nda-text { max-height: min(52vh, 560px); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 18px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); color: var(--text);
  font-size: .9rem; line-height: 1.55; }
.cp-nda-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-nda-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .84rem; }

/* A deed: the PDF in a frame tall enough to read a page, the signature form below it. Phones
   do not show PDFs in frames, so they get the link to open it instead. */
.auth-card.cp-deed { max-width: min(1040px, 100%); }
@media (min-width: 901px) { .auth:has(.cp-deed) { grid-template-columns: minmax(300px, .5fr) minmax(0, 1.5fr); } }
.cp-nda-intro { margin: 0 0 12px; color: var(--text); }
.cp-nda-open { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.cp-deed-frame { display: block; width: 100%; height: min(78vh, 980px); margin: 12px 0 8px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface-2); }
.cp-deed-small { margin: 0 0 18px; }
.cp-deed-fields { grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 720px) {
  .cp-deed-frame { display: none; }
  .cp-nda-open { margin-left: 0; }
  .cp-deed-fields { grid-template-columns: 1fr; }
}

/* ── licence requests ──────────────────────────────────────────────────────── */
.cp-quota { font-variant-numeric: tabular-nums; }
.cp-requests { margin-bottom: var(--gap); }
.cp-req-list { list-style: none; margin: 0; padding: 0; }
.cp-req { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px var(--card-pad); border-top: 1px solid var(--line); }
.cp-req:first-child { border-top: 0; }
.cp-req-main { display: grid; gap: 3px; min-width: 0; }
.cp-req-name { font-weight: 600; }
.cp-req-reason { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--bad-text); background: var(--surface-2); font-size: .9rem; max-width: 70ch; }
.cp-req-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cp-req-side form { margin: 0; }
.cp-req-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.cp-quota-big { margin: 0 0 10px; font-size: .95rem; color: var(--muted); }
.cp-quota-big strong { font: 600 1.6rem/1 var(--mono); color: var(--text); margin-right: 4px; font-variant-numeric: tabular-nums; }
.cp-steps { list-style: none; margin: 0; padding: 0; }
.cp-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 14px var(--card-pad); border-top: 1px solid var(--line); }
.cp-steps li:first-child { border-top: 0; }
.cp-steps .n { font: 500 .78rem/1.4rem var(--mono); color: var(--accent-text); letter-spacing: .06em; }
.cp-steps h3 { color: var(--text); font-size: .92rem; text-transform: none; letter-spacing: 0; margin: 0 0 3px; }
.cp-steps p { color: var(--muted); font-size: .86rem; margin: 0; }
@media (max-width: 960px) {
  .cp-req-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cp-req { flex-direction: column; }
  .cp-req-side { justify-content: flex-start; }
}

@media (max-width: 720px) { .cp-preview-in { flex-wrap: wrap; } }

/* A popover holding a form (a simulator's name and removal): room for the fields. */
.cp-pop { width: 300px; padding: 14px; }
/* A row's menu reads from the start, though its button sits at the row's end (People). */
.col-actions .dd-panel { text-align: start; }
.col-actions .dd-label { white-space: normal; overflow-wrap: anywhere; }

/* Resellers: a relationship and its answers. */
.reseller-item { display: flex; gap: 12px; align-items: flex-start; }
.reseller-item .row-actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reseller-item .row-actions form { margin: 0; }

/* The co-branded reseller that manages the organisation. */
.cp-reseller { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.cp-reseller-logo { max-height: 36px; max-width: 160px; object-fit: contain; }
.cp-reseller-text a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
/* A reseller's customers on a narrow page: the links to work for one under its details. */
@container page (max-width: 640px) {
  .table.responsive td.col-end.cp-act { grid-column: 1 / -1; grid-row: auto; padding-top: 6px !important; }
}

/* ── Documents ─────────────────────────────────────────────────────────────── */
.doc-pages { display: grid; gap: 18px; justify-items: center; margin-top: 12px; }
.doc-page { margin: 0; width: 100%; max-width: 980px; text-align: center; }
.doc-page img { display: block; width: 100%; height: auto; border: 1px solid var(--line, #dfe5ec); border-radius: 6px;
  background: #fff; box-shadow: 0 1px 3px rgba(15, 27, 51, .08); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.doc-page figcaption { margin-top: 6px; }
.doc-note { display: flex; align-items: center; gap: 6px; }
.doc-gate { max-width: 460px; margin: 48px auto; }
.doc-gate-title { margin: 4px 0 6px; font-size: 1.5rem; line-height: 1.25; }
@media print { .doc-pages { display: none; } }
.cp-plain-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
