/* portal-kit design tokens + component styles.
   All styling for the DataTable/Modal/dropdown framework lives here — no
   consuming project should need <style> blocks in its own HTML for these
   components; override the CSS custom properties below instead. */

/* ─── Colour tokens ───────────────────────────────────────────────────────
   Every colour is declared ONCE, via light-dark(). An absent data-pk-theme
   on <html> means "follow the OS": `color-scheme: light dark` below makes
   each light-dark() pair resolve from prefers-color-scheme. The two
   attribute rules pin it instead, which is what PK.theme.set() writes.

   This replaces the previous :root + @media (prefers-color-scheme: dark)
   pair, in which every token existed twice and a manual theme choice was
   impossible. Consequence for consumers: overriding a token with a plain
   colour (--pk-accent: #abc) pins it for BOTH themes — use light-dark() in
   the override too. The browser floor is therefore Chrome 123 / Safari 17.5
   / Firefox 120, all shipped in 2024. */
:root {
  color-scheme: light dark;

  --pk-bg:              light-dark(#f7f7f8, #16161a);
  --pk-surface:         light-dark(#ffffff, #1e1e24);
  --pk-surface2:        light-dark(#f0f0f2, #26262e);
  --pk-border:          light-dark(#e2e2e5, #303038);
  --pk-text:            light-dark(#1a1a1e, #f0f0f2);
  --pk-text2:           light-dark(#52525b, #b4b4bc);
  --pk-muted:           light-dark(#8a8a94, #7a7a84);
  --pk-accent:          light-dark(#3b5bdb, #6b8cff);
  --pk-accent-contrast: light-dark(#ffffff, #10101a);
  --pk-red:             light-dark(#d92d20, #ff6961);
  --pk-green:           light-dark(#12876b, #3ecf8e);
  --pk-yellow:          light-dark(#b45309, #fbbf24);
  --pk-blue:            light-dark(#1d4ed8, #7dd3fc);
  /* A status colour as a quiet background: the friendly notice (adr/114). */
  --pk-yellow-soft:     color-mix(in srgb, var(--pk-yellow) 12%, var(--pk-surface));

  /* The required-field asterisk (.pk-required, adr/057). A reference, not a
     colour of its own: the accent rather than --pk-red, because red is what
     a field turns when it FAILED, and a field nobody has touched yet has not
     failed anything. A consumer who wants it otherwise changes this one line. */
  --pk-required-mark: var(--pk-accent);

  /* Text drawn ON a filled status/accent surface (method badge, negate
     button). Its own token rather than a hardcoded #fff, because the status
     colours above are dark in the light palette and light in the dark one —
     white-on-yellow is unreadable in dark mode. */
  --pk-on-filled: light-dark(#ffffff, #10101a);

  /* The page a mail preview is drawn on (mail-templates.js). White in both
     themes on purpose: a mail is written for a white page and a mail
     program shows it on one, so the preview must not invert it. */
  --pk-mail-page: light-dark(#ffffff, #ffffff);
  /* The camera's view (camera.js) is dark in both themes: a picture is
     framed by black, and its messages stand on it in light text. */
  --pk-camera-bg:   light-dark(#1a1a1e, #000000);
  --pk-camera-text: light-dark(#f0f0f2, #f0f0f2);
  --pk-camera-chip: light-dark(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45));

  /* light-dark() takes <color> values only, so a shadow cannot use it
     directly — the colour is tokenised and the geometry stays constant. */
  --pk-shadow-color: light-dark(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.5));
  --pk-shadow: 0 4px 16px var(--pk-shadow-color);

  --pk-radius: 8px;
  --pk-font: system-ui, -apple-system, "Segoe UI", sans-serif;

  /* How wide the application shell (.pk-app-main) is allowed to grow. 960px
     was a reading measure, and it is the wrong one for this library's main
     content: an administrative table with seven columns and a row of action
     buttons does not fit, so it scrolled sideways inside .card-scroll on a
     monitor with room to spare either side. A token rather than a literal so
     a consumer whose pages really are prose can turn it back down in one
     place instead of overriding the rule.
     `none` since adr/085: 1400px was the same mistake one size up. A table
     grows with the attributes a consumer declares, and a cap left a wide
     monitor's edges empty while the row actions scrolled out of sight. */
  --pk-app-max: none;

  /* ─── Stacking order ───────────────────────────────────────────────────
     Previously literals scattered through this file (plus one 99999 set
     inline by dropdown.js). Tooltips sit above the modal so a tooltip
     inside a dialog is not occluded by it. */
  /* The app footer (adr/055) is fixed to the window and page content scrolls
     under it; everything that floats — a dialog, a menu — goes over it. */
  --pk-z-app-footer: 800;
  --pk-z-modal: 900;
  --pk-z-dropdown: 950;
  /* The help panel (help.js, adr/091) stands BESIDE an open dialog — the
     text explains the dialog — so above the modal and its dropdowns, and
     below the confirmation layer, which asks about the dialog and wins. */
  --pk-z-help: 960;
  /* "Problem melden" (problems.js, adr/115) opens ABOVE a dialog — a wizard
     offers it and must come back as it was — and above that dialog's
     dropdowns; under the banner, the help panel that explains it, the
     confirmation layer and the toast. */
  --pk-z-problem: 952;
  /* A questionnaire's preview and QR code (surveys.js, adr/118) open above
     the editor and its dropdowns, the problem layer's place. */
  --pk-z-survey-layer: 952;
  /* The header's "?" floating at phone width (adr/104): over the page and
     the footer, under a dialog — a dialog has a "?" of its own in its frame,
     and the page's would point at the wrong text. */
  --pk-z-help-fab: 850;
  /* The impersonation banner: over a dialog and its dropdowns, so whose
     account this is stays in sight while editing, but UNDER the help panel.
     Both are pinned to the top edge, and a banner above the panel covered
     its head — the ✕ could not be clicked while impersonating. */
  --pk-z-banner: 955;
  /* The confirmation layer sits above the DROPDOWN, not just above the
     modal. A dropdown opened inside a dialog paints at 950 so it can escape
     the dialog's own clipping — put the confirmation at 901 and a select
     somebody left open would render on top of the question. Below the toast,
     which has to stay readable over everything. */
  --pk-z-modal-2: 975;
  /* The notification stack (notify.js, adr/065): over a dialog, because a
     notification arriving while somebody edits is exactly when it has to be
     seen, and under the toast, which answers what they just did. */
  --pk-z-notify: 990;
  /* PK.camera({ fullscreen: true })'s layer on <body> (camera.js): over
     the dialog it was opened from, under the notifications and the toast
     that answer what the picture is for. */
  --pk-z-camera: 980;
  --pk-z-toast: 1000;
  /* PK.imageViewer (imagepreview.js): one picture over everything, dialogs
     and a toast included — it fills the window, so nothing under it is
     readable anyway. */
  --pk-z-viewer: 1050;
  --pk-z-tooltip: 1100;

  /* ─── Motion ───────────────────────────────────────────────────────────
     Nothing in this file animates with a literal duration; every component
     reads a token from here. That lets a consumer retune the whole system,
     and lets the reduced-motion blocks below neutralise it in one place.
     JS reads these too, via PK.cssMs() — see web/js/theme.js.

     Names are --pk- prefixed even where lifted verbatim from a
     transitions.dev snippet (--modal-open-dur, --shake-distance, ...): the
     unprefixed names would collide with a consumer's own properties. */
  --pk-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Read by JS as a boolean: 1 = animate, 0 = reduced. */
  --pk-motion: 1;

  /* A button's hover, which since v0.44.0 is a change of colour rather than
     a brightness filter — .btn-ghost has nothing for a filter to act on. */
  --pk-btn-dur: 150ms;

  --pk-modal-open-dur: 250ms;
  --pk-modal-close-dur: 150ms;
  --pk-modal-scale: 0.96;

  /* The help panel's slide in from the right edge (adr/091). */
  --pk-help-dur: 200ms;
  /* The floating "?" at phone width snapping to an edge (adr/104). */
  --pk-help-fab-dur: 280ms;

  --pk-tt-in-dur: 150ms;
  --pk-tt-out-dur: 50ms;
  --pk-tt-delay: 80ms;
  --pk-tt-scale: 0.98;

  --pk-tabs-dur: 250ms;
  /* camera.js' focus ring after a tap. */
  --pk-camera-focus-dur: 700ms;

  /* A notification card (notify.js): slides down into the stack at the top
     right and fades out when closed. --pk-notify-rise is a displacement,
     zeroed in both reduced-motion blocks. --pk-notify-top is where the
     stack starts — under the header rather than over the account button. */
  --pk-notify-in-dur: 250ms;
  --pk-notify-out-dur: 150ms;
  --pk-notify-rise: -8px;
  --pk-notify-top: 72px;

  /* The width of the arrow on the edge of a horizontal bar that scrolls
     inside itself (.pk-nav, .pk-tabs), including the fade it paints — and,
     as scroll-padding, how far from that edge an entry scrolled into view
     comes to rest, so it is never under the arrow. A length, not a motion:
     nothing for the reduced-motion blocks. */
  --pk-nav-fade: 32px;

  /* The action menu (PK.createMenu). Adapted from transitions.dev's "Menu
     dropdown": the panel scales in from --pk-menu-pre-scale and leaves at
     --pk-menu-closing-scale, which is nearer 1 on purpose — a panel shrinking
     as it goes reads as being thrown away, and this one is usually coming
     back. --pk-menu-level-shift is how far a second level slides when the
     panel changes what it is showing. */
  --pk-menu-open-dur: 250ms;
  --pk-menu-close-dur: 150ms;
  --pk-menu-pre-scale: 0.97;
  --pk-menu-closing-scale: 0.99;
  --pk-menu-level-dur: 200ms;
  --pk-menu-level-shift: 12px;

  --pk-shake-distance: 6px;
  --pk-shake-overshoot: 4px;
  --pk-shake-dur-a: 80ms;
  --pk-shake-dur-b: 60ms;
  --pk-revert-hold: 3000ms;
  /* How long a copy button says "Copied!" before it says "Copy" again
     (platformlog.js). A hold, not a motion — like --pk-revert-hold it is in
     neither reduced-motion block, where 1ms would make the confirmation
     unreadable. */
  --pk-copied-hold: 1500ms;
  --pk-revert-dur: 280ms;

  --pk-stack-open: 350ms;
  --pk-stack-close: 250ms;
  --pk-stack-rise: 60px;
  --pk-stack-blur: 2px;
  --pk-stack-scale: 0.97;
  --pk-stack-peek: 12px;
  --pk-stack-spread-gap: 8px;
  --pk-stack-depth-scale: 0.06;
  --pk-stack-depth-fade: 0.4;
  --pk-stack-depth1-blur: 1px;
  --pk-stack-depth2-blur: 2px;

  --pk-check-box: 150ms;
  --pk-check-draw: 350ms;
  --pk-check-uncheck: 150ms;
  --pk-check-delay: 0ms;
  /* getTotalLength() of the check path PK.renderCheckbox emits, rounded up.
     If that path's `d` ever changes, re-measure: too small under-draws the
     tick, too large delays its start. */
  --pk-check-len: 15;

  --pk-skel-dur: 1400ms;
  /* How long a fetch has to take before a skeleton is drawn at all, and how
     long one stays once it has been. A skeleton that appears and is replaced
     inside a few frames is a flicker rather than feedback, and so is one that
     vanishes the instant it arrives — the two tokens cover the same flash
     from either side, and either alone leaves one of them.

     Deliberately NOT repeated in the reduced-motion blocks above, the same
     way --pk-revert-hold is not: they animate nothing. Collapsing them to
     1ms would restore precisely the flashing they exist to prevent, which is
     the opposite of what a reader asking for less motion wants. The shimmer
     itself is already stopped outright there. */
  --pk-skel-delay: 200ms;
  --pk-skel-min: 400ms;
  --pk-reveal-dur: 400ms;
  --pk-reveal-blur: 2px;
  --pk-spin-dur: 600ms;

  --pk-clear-dur: 1000ms;
  --pk-clear-out-dur: 400ms;
  --pk-clear-in-dur: 400ms;
  --pk-clear-out-fly: 12px;
  --pk-clear-in-fly: 12px;
  --pk-clear-blur: 2px;
  /* Read by PK._clearDissolve through a cubic-bezier sampler, not by the
     stylesheet — the tween is per-frame JS, so the curve has to be applied in
     JS too. Same shape as --pk-ease; kept as their own tokens because the
     effect this is ported from exposes them separately. */
  --pk-clear-out-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pk-clear-in-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pk-glow-delay: 50ms;
  --pk-glow-peak-at: 0.15;
  --pk-glow-opacity: 0.42;
  --pk-glow-spread: 1.5;

  /* The stepper's rolling digits. The SAME effect as the clear dissolve
     above, read the same way — through PK.cssMs/cssNum/cssRaw in forms.js,
     because the tween is per-frame JS and the curve has to be sampled there.

     -dur is the envelope and -out-dur/-in-dur are the legs inside it, which
     is what the dissolve does and what gives both their tail: the digits
     have settled well before the run ends, and what is left is the glow
     falling away under them. A single duration for everything — which this
     was, at 260ms for the whole thing — is over before the eased curve has
     anywhere to decelerate, and reads as a jump rather than a roll.

     Shorter than the dissolve all the same: this fires on every click of a
     control somebody may click ten times in a row, and a second click
     aborts the run in flight. */
  --pk-step-roll-dur: 620ms;
  --pk-step-roll-out-dur: 300ms;
  --pk-step-roll-in-dur: 300ms;
  --pk-step-roll-fly: 10px;
  --pk-step-roll-blur: 2px;
  --pk-step-roll-ease: cubic-bezier(0.22, 1, 0.36, 1);

  --pk-drop-dur: 150ms;
  /* The progress bar's width tween. Short on purpose: it exists to stop the
     bar stuttering between upload progress events, not to animate anything a
     reader is meant to notice. */
  --pk-progress-dur: 120ms;

  /* The calendar popover (datepicker.js). Its own tokens rather than the
     menu's, although the values match today: a calendar is a bigger box than
     a menu and somebody tuning one should not silently retune the other.
     datepicker.js reads --pk-date-close-dur through PK.cssMs to know when to
     remove the panel, so the two can never disagree about it. */
  --pk-date-open-dur: 250ms;
  --pk-date-close-dur: 150ms;
  --pk-date-pre-scale: 0.97;

  /* The phone layout of a datatable (adr/110): the filter bar unfolding
     under its "Filter" button, and the rows of a page reached by a swipe
     coming in from the side they were swiped from. */
  --pk-filter-open-dur: 200ms;
  --pk-filter-rise: 6px;
  --pk-swipe-dur: 220ms;
  --pk-swipe-shift: 32px;
}

:root[data-pk-theme="light"] { color-scheme: light; }
:root[data-pk-theme="dark"] { color-scheme: dark; }

/* ─── Reduced motion ──────────────────────────────────────────────────────
   Three states, mirroring the theme: an absent data-pk-motion follows the
   OS, "reduced" forces motion off, "full" forces it on even when the OS asks
   for less. That third state is deliberate — without it, someone with a
   system-wide reduce-motion setting could never turn the animations on.

   Durations collapse to 1ms rather than 0s: a 0s transition is allowed to
   skip transitionend entirely in some engines, and 1ms is imperceptible.

   The attribute block MUST come after the media query — both selectors have
   the same specificity (:not() takes its argument's), so source order is
   what lets an explicit choice win. */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-pk-motion="full"]) {
    --pk-motion: 0;
    --pk-btn-dur: 1ms;
    --pk-modal-open-dur: 1ms;
    --pk-modal-close-dur: 1ms;
    --pk-modal-scale: 1;
    --pk-help-dur: 1ms;
    --pk-help-fab-dur: 1ms;
    --pk-tt-in-dur: 1ms;
    --pk-tt-out-dur: 1ms;
    --pk-tt-delay: 0ms;
    --pk-tt-scale: 1;
    --pk-tabs-dur: 1ms;
    --pk-camera-focus-dur: 1ms;
    --pk-notify-in-dur: 1ms;
    --pk-notify-out-dur: 1ms;
    --pk-notify-rise: 0px;
    --pk-menu-open-dur: 1ms;
    --pk-menu-close-dur: 1ms;
    --pk-menu-pre-scale: 1;
    --pk-menu-closing-scale: 1;
    --pk-menu-level-dur: 1ms;
    /* A displacement, not a duration — a 1ms slide still jerks the whole
       level twelve pixels on the one frame it gets. */
    --pk-menu-level-shift: 0px;
    --pk-revert-dur: 1ms;
    --pk-stack-open: 1ms;
    --pk-stack-close: 1ms;
    --pk-stack-rise: 0px;
    --pk-stack-blur: 0px;
    --pk-stack-scale: 1;
    --pk-stack-depth1-blur: 0px;
    --pk-stack-depth2-blur: 0px;
    --pk-check-box: 1ms;
    --pk-check-draw: 1ms;
    --pk-check-uncheck: 1ms;
    --pk-reveal-dur: 1ms;
    --pk-reveal-blur: 0px;
    --pk-clear-dur: 1ms;
    --pk-clear-out-dur: 1ms;
    --pk-clear-in-dur: 1ms;
    --pk-clear-blur: 0px;
    /* Displacements, not durations — shortening the run would still jerk the
       text a dozen pixels on the one frame it gets. */
    --pk-clear-out-fly: 0px;
    --pk-clear-in-fly: 0px;
    --pk-step-roll-dur: 1ms;
    --pk-step-roll-out-dur: 1ms;
    --pk-step-roll-in-dur: 1ms;
    /* A displacement again: the digits must swap, not slide. */
    --pk-step-roll-fly: 0px;
    --pk-step-roll-blur: 0px;
    --pk-drop-dur: 1ms;
    --pk-progress-dur: 1ms;
    --pk-date-open-dur: 1ms;
    --pk-date-close-dur: 1ms;
    --pk-date-pre-scale: 1;
    --pk-filter-open-dur: 1ms;
    /* Displacements: the fields and the rows appear, they do not slide. */
    --pk-filter-rise: 0px;
    --pk-swipe-dur: 1ms;
    --pk-swipe-shift: 0px;
  }
}

:root[data-pk-motion="reduced"] {
  --pk-motion: 0;
  --pk-btn-dur: 1ms;
  --pk-modal-open-dur: 1ms;
  --pk-modal-close-dur: 1ms;
  --pk-modal-scale: 1;
  --pk-help-dur: 1ms;
  --pk-help-fab-dur: 1ms;
  --pk-tt-in-dur: 1ms;
  --pk-tt-out-dur: 1ms;
  --pk-tt-delay: 0ms;
  --pk-tt-scale: 1;
  --pk-tabs-dur: 1ms;
  --pk-camera-focus-dur: 1ms;
  --pk-notify-in-dur: 1ms;
  --pk-notify-out-dur: 1ms;
  --pk-notify-rise: 0px;
  --pk-menu-open-dur: 1ms;
  --pk-menu-close-dur: 1ms;
  --pk-menu-pre-scale: 1;
  --pk-menu-closing-scale: 1;
  --pk-menu-level-dur: 1ms;
  --pk-menu-level-shift: 0px;
  --pk-revert-dur: 1ms;
  --pk-stack-open: 1ms;
  --pk-stack-close: 1ms;
  --pk-stack-rise: 0px;
  --pk-stack-blur: 0px;
  --pk-stack-scale: 1;
  --pk-stack-depth1-blur: 0px;
  --pk-stack-depth2-blur: 0px;
  --pk-check-box: 1ms;
  --pk-check-draw: 1ms;
  --pk-check-uncheck: 1ms;
  --pk-reveal-dur: 1ms;
  --pk-reveal-blur: 0px;
  --pk-clear-dur: 1ms;
  --pk-clear-out-dur: 1ms;
  --pk-clear-in-dur: 1ms;
  --pk-clear-blur: 0px;
  --pk-clear-out-fly: 0px;
  --pk-clear-in-fly: 0px;
  --pk-step-roll-dur: 1ms;
  --pk-step-roll-out-dur: 1ms;
  --pk-step-roll-in-dur: 1ms;
  --pk-step-roll-fly: 0px;
  --pk-step-roll-blur: 0px;
  --pk-drop-dur: 1ms;
  --pk-progress-dur: 1ms;
  --pk-date-open-dur: 1ms;
  --pk-date-close-dur: 1ms;
  --pk-date-pre-scale: 1;
  --pk-filter-open-dur: 1ms;
  --pk-filter-rise: 0px;
  --pk-swipe-dur: 1ms;
  --pk-swipe-shift: 0px;
}

/* A looping animation cannot be neutralised by shortening it — a 1ms
   infinite loop is worse than the animation itself. Those are stopped
   outright. The selector list is duplicated for the same source-order
   reason as above; :where() holds both at zero specificity so a component
   rule still wins. */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-pk-motion="full"]) :where(.pk-dt-skel-bar, .pk-explorer-spinner, .pk-spinner) {
    animation: none;
  }
}

:root[data-pk-motion="reduced"] :where(.pk-dt-skel-bar, .pk-explorer-spinner, .pk-spinner) {
  animation: none;
}

/* Generic utility — ported from llmgateway's theme.css (`.hidden { display:
   none !important; }`). Several components (api-explorer.js's collapsible
   categories/endpoints) toggle this class via classList and rely on it
   existing; without it, toggling the class has no visual effect. */
.hidden { display: none !important; }

/* Buttons */

.btn {
  font-family: var(--pk-font);
  font-size: 14px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  background: var(--pk-surface);
  color: var(--pk-text);
  padding: 6px 14px;
  cursor: pointer;
  line-height: 1.4;
  /* Named properties rather than `all`, which llmgateway uses (theme.css:161)
     and which would also transition the opacity change on :disabled — a
     button fading out as it is turned off reads as the page still loading. */
  transition: color var(--pk-btn-dur) ease-out,
              border-color var(--pk-btn-dur) ease-out;
}

.btn:hover { filter: brightness(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--pk-accent);
  border-color: var(--pk-accent);
  color: var(--pk-accent-contrast);
}

/* A ghost button is still a BUTTON.
 *
 * It used to be `border-color: transparent` and nothing else, which left it
 * inheriting .btn's `color: var(--pk-text)` — the body text colour, exactly.
 * Measured on the catalog screen: the label of "Neue Kategorie" and the
 * paragraph beside it were both rgb(26, 26, 30), on no background, inside no
 * border. It was prose that happened to be clickable, and there was no hover
 * feedback either: .btn:hover's `filter: brightness(0.97)` has nothing to act
 * on when the background and the border are both transparent.
 *
 * llmgateway has had the answer since the beginning (theme.css:164-165) — a
 * real border in --border, the quieter --text2 for the label, and a hover
 * that takes both to the accent. Copied rather than invented: this was a
 * regression against the source while extracting, the same kind as the raw
 * <select> that v0.43.0 removed, not a difference of taste.
 *
 * Nothing moves. .btn already declares `border: 1px solid`, so the box was
 * always that size and only the colour was invisible. */
.btn-ghost {
  background: transparent;
  border-color: var(--pk-border);
  color: var(--pk-text2);
}

/* :not(:disabled) because .btn:disabled here only dims — unlike llmgateway,
   which adds `pointer-events: none` (theme.css:172) and so never reaches its
   hover rule at all. A disabled control in this library stays hoverable on
   purpose: adr/035's rule is dim it and say why, and the "why" is a tooltip
   that a pointer-events: none element could not show. So the guard has to be
   in the selector, or a button that refuses the click would still light up
   under the cursor as though it would take it. */
.btn-ghost:hover:not(:disabled) {
  border-color: var(--pk-accent);
  color: var(--pk-accent);
}

.btn-action {
  padding: 4px 8px;
  font-size: 13px;
  min-width: 32px;
}

/* The datatable's download button carries an SVG where its neighbours ↩
   and ↻ carry a glyph (datatable.js, sheetIcon). On the text baseline the
   icon's descender space made this one button a pixel taller than the two
   beside it; centred on the line it is the same height. */
.pk-dt-export svg {
  vertical-align: middle;
}

/* Full-width button — the submit button of a login or reset form, which
   every consumer so far has written as an inline style="width:100%". */
.btn-block {
  display: block;
  width: 100%;
}

/* Applied by PK.withBusy() while an async handler is in flight. The button
   is also disabled; this only stops the hover feedback from suggesting it is
   still clickable. */
.btn.is-busy { cursor: progress; filter: none; }

/* Inline "something went wrong" text. llmgateway has .text-error but relies
   on a var(--error, ...) fallback for a token it never defines
   (llmgw-issues.md #29) — here the token exists. */
.text-error { color: var(--pk-red); }
.text-muted { color: var(--pk-muted); }

/* ─── Toasts ──────────────────────────────────────────────────────────────
   A Sonner-style stack: at most three toasts are visible, the newest at
   depth 0 and older ones scaled, blurred and peeking out behind it; hovering
   fans them out. Adapted from transitions.dev's "Banner stacking".

   Two changes against portal-kit's previous toast, both converging on
   llmgateway (which this package was extracted from):

   - The container moved from top-right to BOTTOM-right, matching llmgateway
     (theme.css:400). That is also what makes the stack geometry work at all:
     the snippet anchors banners at the bottom and grows the stack upward.
   - The fill is a neutral surface with a coloured left border, again as in
     llmgateway (.toast.success/.error/.info/.warning), instead of a
     saturated background with hardcoded white text. In a stack of three,
     four saturated cards under a blur read as mud; and `color: #fff` was
     simply wrong on the light palette. */

.pk-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--pk-z-toast);
  width: 320px;
  max-width: calc(100vw - 48px);
}

/* The stack is its own positioned box inside the fixed container: banners
   are absolutely positioned against it, and its height is driven by the
   depth-0 banner (see PK.toast's height bookkeeping in toast.js). */
.pk-toast-stack {
  position: relative;
  height: 0;
}

.pk-toast {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--pk-font);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  border-left: 3px solid var(--pk-border);
  background: var(--pk-surface);
  color: var(--pk-text);
  box-shadow: var(--pk-shadow);
  /* Centre origin so an arriving toast scales like a toast; the push-back
     depths switch to the bottom edge, which they can do freely because the
     swap happens at identity. */
  transform-origin: 50% 50%;
  /* Explicit blur(0) rather than an unset filter — blur() to none is not
     reliably interpolated, and the cross-blur would snap. */
  filter: blur(0);
  will-change: transform, opacity, filter;
  transition:
    transform var(--pk-stack-open) var(--pk-ease),
    opacity var(--pk-stack-open) var(--pk-ease),
    filter var(--pk-stack-open) var(--pk-ease);
}

.pk-toast-success { border-left-color: var(--pk-green); }
.pk-toast-error { border-left-color: var(--pk-red); }
.pk-toast-info { border-left-color: var(--pk-blue); }
.pk-toast-warning { border-left-color: var(--pk-yellow); }

.pk-toast[data-depth="0"] {
  z-index: 3;
  transform: translateY(0) scale(1);
  opacity: 1;
}

.pk-toast[data-depth="1"] {
  z-index: 2;
  transform-origin: 50% 100%;
  transform: translateY(calc(var(--pk-stack-peek) * -1))
             scale(calc(1 - var(--pk-stack-depth-scale)));
  opacity: calc(1 - var(--pk-stack-depth-fade));
  filter: blur(var(--pk-stack-depth1-blur));
}

.pk-toast[data-depth="2"] {
  z-index: 1;
  transform-origin: 50% 100%;
  transform: translateY(calc(var(--pk-stack-peek) * -2))
             scale(calc(1 - var(--pk-stack-depth-scale) * 2));
  opacity: calc(1 - var(--pk-stack-depth-fade) * 1.6);
  filter: blur(var(--pk-stack-depth2-blur));
}

/* Spread: the newest stays put, older ones climb one banner height each
   (100% = the banner's own height). Driven by a class rather than :hover,
   because the gaps between spread banners belong to no element — toast.js
   owns that hit-testing. */
.pk-toast-stack.is-spread .pk-toast[data-depth="1"],
.pk-toast-stack.is-spread .pk-toast[data-depth="2"] {
  opacity: 1;
  filter: blur(0);
}

.pk-toast-stack.is-spread .pk-toast[data-depth="1"] {
  transform: translateY(calc((100% + var(--pk-stack-spread-gap)) * -1)) scale(1);
}

.pk-toast-stack.is-spread .pk-toast[data-depth="2"] {
  transform: translateY(calc((100% + var(--pk-stack-spread-gap)) * -2)) scale(1);
}

.pk-toast.is-enter {
  transition: none;
  transform: translateY(var(--pk-stack-rise)) scale(var(--pk-stack-scale));
  opacity: 0;
  filter: blur(var(--pk-stack-blur));
}

.pk-toast.is-leaving {
  z-index: 0;
  transform-origin: 50% 100%;
  transform: translateY(calc(var(--pk-stack-peek) * -3))
             scale(calc(1 - var(--pk-stack-depth-scale) * 3));
  opacity: 0;
  filter: blur(var(--pk-stack-blur));
  transition:
    transform var(--pk-stack-close) var(--pk-ease),
    opacity var(--pk-stack-close) var(--pk-ease),
    filter var(--pk-stack-close) var(--pk-ease);
}

.pk-toast-msg {
  display: block;
  padding-right: 16px;
}

.pk-toast-dismiss {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  padding: 0 2px;
  line-height: 1;
  font-size: 14px;
  cursor: pointer;
  color: var(--pk-muted);
}

.pk-toast-dismiss:hover { color: var(--pk-text); }

/* Notifications (notify.js, adr/065)

   A toast's look — the surface, the border, the coloured edge — in a
   different place and with a different lifetime: top right, where the toast
   is not, and until it is closed. They are not stacked behind one another as
   toasts are: each is something to read and perhaps to act on, so all of
   them are laid out, newest on top, and the column scrolls when there are
   more than fit. */
.pk-notify-stack {
  position: fixed;
  top: var(--pk-notify-top);
  right: 24px;
  z-index: var(--pk-z-notify);
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - var(--pk-notify-top) - 24px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* The column is as tall as its cards; the empty space around them must
     not swallow clicks meant for the page underneath. */
  pointer-events: none;
}

.pk-notify-stack:empty { display: none; }

.pk-notify {
  position: relative;
  pointer-events: auto;
  box-sizing: border-box;
  font-family: var(--pk-font);
  font-size: 14px;
  padding: 10px 36px 12px 14px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  border-left: 3px solid var(--pk-blue);
  background: var(--pk-surface);
  color: var(--pk-text);
  box-shadow: var(--pk-shadow);
  transform: translateY(0);
  opacity: 1;
  transition:
    transform var(--pk-notify-in-dur) var(--pk-ease),
    opacity var(--pk-notify-in-dur) var(--pk-ease);
}

.pk-notify.is-enter {
  transition: none;
  transform: translateY(var(--pk-notify-rise));
  opacity: 0;
}

.pk-notify.is-leaving {
  opacity: 0;
  transition: opacity var(--pk-notify-out-dur) var(--pk-ease);
}

.pk-notify-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* pre-line: the sender separates paragraphs with a blank line, and a mail
   keeps them — so does the card. */
.pk-notify-body {
  margin-top: 4px;
  color: var(--pk-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.pk-notify-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--pk-accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pk-notify-link:hover { color: var(--pk-text); }

.pk-notify-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  border-radius: var(--pk-radius);
  padding: 2px 6px;
  line-height: 1;
  font-size: 16px;
  cursor: pointer;
  color: var(--pk-muted);
}

.pk-notify-close:hover { color: var(--pk-text); }

/* The profile's notifications tab: the browser-permission line under the
   operating-system channel, with its button beside the text. */
.pk-notify-perm {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
}

/* A phone: the full width, less the gutter, from the top edge — the header
   there is a single line and the account button sits in the footer or the
   menu. */
@media (max-width: 600px) {
  .pk-notify-stack {
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
}

/* Modal */

/* The backdrop keeps the display:none/flex toggle (`.show`) so it stays out
   of the accessibility tree and the tab order when closed. The animation
   rides on a second class, `.is-open`, which modal.js adds one forced reflow
   after `.show` — that reflow, not a rAF hop, is what makes the transition
   have a start value to interpolate from. Closing swaps `.is-open` for
   `.is-closing` and removes `.show` once --pk-modal-close-dur has elapsed.
   Adapted from transitions.dev's "Modal open / close". */
.pk-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  z-index: var(--pk-z-modal);
  overflow-y: auto;
  opacity: 0;
  transition: opacity var(--pk-modal-open-dur) var(--pk-ease);
}

.pk-modal-backdrop.show { display: flex; }
.pk-modal-backdrop.is-open { opacity: 1; }

/* Scroll lock. The backdrop scrolls its own overflow, so letting the page
   behind it scroll too means a wheel gesture past the end of the dialog
   silently moves the page underneath. A class rather than an inline
   body.style.overflow, so the value the consumer's own CSS sets is restored
   untouched when the modal closes. */
body.pk-modal-open { overflow: hidden; }

/* The confirmation layer (modal.js, #pkConfirmBackdrop). Its own scrim, so
   the dialog underneath is visibly dimmed a second time and it is never in
   doubt which of the two is being answered — llmgateway gets the same effect
   for free by keeping the second backdrop's own background (theme.css:235
   there), and it is worth keeping rather than making this one transparent. */
.pk-modal-backdrop-2 { z-index: var(--pk-z-modal-2); }

/* A question is short, and it is CENTRED rather than parked at the shared
   5vh — at the top it lands on the title of the dialog it is asking about
   and reads as part of it.
   `margin: auto 0` rather than `align-items: center` on the backdrop: this
   one scrolls its own overflow, and a flex item centred by alignment gets
   its top clipped once it is taller than the viewport, where an auto margin
   simply stops centring. */
.pk-modal-backdrop-2 .pk-modal {
  max-width: 28rem;
  margin: auto 0;
}
/* PK.showInfoLayer: something to read, not a question — a dialog's width
   (480px, 720px with wide), and a phone's at most. */
.pk-modal-backdrop-2 .pk-modal.pk-modal-info { max-width: 100%; }

.pk-modal-backdrop.is-closing {
  opacity: 0;
  transition: opacity var(--pk-modal-close-dur) var(--pk-ease);
}

.pk-modal {
  font-family: var(--pk-font);
  background: var(--pk-surface);
  color: var(--pk-text);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow);
  width: 480px;
  max-width: 100%;
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  transform-origin: center;
  transform: scale(var(--pk-modal-scale));
  transition: transform var(--pk-modal-open-dur) var(--pk-ease);
  will-change: transform;
}

.pk-modal-backdrop.is-open .pk-modal { transform: scale(1); }

.pk-modal-backdrop.is-closing .pk-modal {
  transform: scale(var(--pk-modal-scale));
  transition: transform var(--pk-modal-close-dur) var(--pk-ease);
}

.pk-modal-wide { width: 720px; }
/* For a dialog holding a datatable. A filter bar, five or six columns and
   a pagination row do not fit in 720px, and the .card-scroll around the
   table would grow its own horizontal scrollbar — a second scroll axis
   inside something that already scrolls vertically. `max-width` rather
   than `width`, so a narrow viewport still shrinks it; composes with
   .pk-modal-wide, which supplies the width. Ported from llmgateway's
   .modal-xwide, which exists there for this one case as well. */
.pk-modal-xwide { width: 1100px; max-width: 100%; }
/* The whole window less the backdrop's gutter, for a table wider still.
   Composes with .pk-modal-wide like xwide does. */
.pk-modal-full { width: 100%; max-width: 100%; }
/* The filter bar in a dialog hugs its controls instead of spanning the
   width, which on two short filters reads as an empty card. Also
   llmgateway's (.modal-body .dt-filter-card). */
.pk-modal .pk-filter-bar { width: fit-content; max-width: 100%; }
.pk-modal-tall .pk-modal-body { max-height: 60vh; }

.pk-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--pk-muted);
}

/* PK.lockModal() hides the dismiss affordance while an async save is in
   flight. Previously an inline style.display — a class keeps the "no inline
   styles" rule intact and leaves the button's own display value alone. */
.pk-modal-locked .pk-modal-close { display: none; }

/* The dialog's "?" (adr/091), left of the ✕; the title keeps clear of both
   while it is shown. */
.pk-modal-help {
  position: absolute;
  top: 12px;
  right: 40px;
}
.pk-modal:has(> .pk-modal-help:not(.hidden)) .modal-title { padding-right: 56px; }

/* Separator and secondary heading for modals that stack several independent
   sections (change password / change email / API keys ...). Both existed as
   hand-rolled inline styles in the first consumer; a modal body is exactly
   the place a component library should be supplying these. */
.pk-modal-sep {
  border: none;
  border-top: 1px solid var(--pk-border);
  margin: 16px 0;
}

.modal-subtitle {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* The horizontal padding is for the FOCUS RING, not for looks.
   `overflow-y: auto` cannot coexist with `overflow-x: visible` — CSS computes
   the visible axis to `auto` — so this box clips horizontally whether or not
   anything was meant to scroll that way. Fields in a modal are width: 100%
   (.form-group input) and the ring is `outline: 2px` at `outline-offset: 2px`,
   i.e. 4px OUTSIDE the border box, so it was sliced off flush at both edges
   while remaining intact top and bottom.
   The negative margin cancels the padding's effect on layout, so nothing
   moves: .pk-modal's own 20px absorbs it. Two neighbours already document
   this same clip — the tooltip note above, and .pk-clear's comment about why
   its overflow:hidden is scoped to the animation.
   The same 4px top and bottom since v0.112.1: the scroll box clips
   vertically too, and a field that is the LAST thing in a dialog or tab —
   the sub-users tab's "new name" — lost the bottom of its ring. */
.pk-modal-body {
  overflow-y: auto;
  max-height: 50vh;
  padding: 4px;
  margin: -4px;
}

/* Anything too wide for .pk-modal-body needs its OWN horizontal scroller.
   The comment above explains why the body computes `overflow-x: auto`; the
   consequence for CONTENT is that the scrollbar lands on the whole panel, so
   dragging it slides the tab bar and every label sideways along with the one
   table that was actually too wide, and the rightmost column stays clipped
   until the reader thinks to drag. Wrap the wide thing instead and only it
   moves. `.card-scroll` does the same job for a table on a page; this is the
   version without the card's surface and border, for use inside a modal. */
.pk-table-scroll {
  overflow-x: auto;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-right: 24px;
}

/* .pk-actions is the same row outside a dialog — a Save at the foot of a
   card, a panel, a page. The two share a rule rather than the page reusing a
   class called "modal-actions", which is what the branding screen did while
   it still was one. Note that dropdown.js looks for .modal-actions
   specifically, and only inside .pk-modal: it is the bottom edge a dropdown
   panel must not slide under, and a page has no such edge. */
.modal-actions,
.pk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--pk-text2);
  margin-bottom: 4px;
}

/* The required-field marker (adr/057). PK.fieldRule({required:true}),
   PK.markRequired and a dropdown's `required` option put .pk-required on the
   field's caption; nobody types a "*" into a label, which is how llmgateway
   ended up with required fields that carried none (llmgw-issues.md #107).

   The asterisk is silent to assistive technology — the alternative text after
   the slash is empty — because the control itself carries aria-required,
   which a screen reader announces as "required" in its own language. Reading
   "star" as well would be noise. The first declaration is the fallback for a
   browser that does not know the alt-text syntax and drops the second. */
.pk-required::after {
  content: "*";
  content: "*" / "";
  color: var(--pk-required-mark);
  font-weight: 600;
  margin-left: 3px;
}

/* A .form-group is a stacked label-over-field row, so its field spans the
   row. Without this, the bare input[type=…] rule below leaves a field at the
   browser's intrinsic ~20-character width while any field that happened to
   pick up a wrapper — .pk-pw-wrap from PK.enhancePasswordFields(),
   .input-wrap from PK.enhanceInputs() — is 100%. That is exactly why a login
   form's e-mail field rendered narrower than the password field under it. */
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  box-sizing: border-box;
}

/* The error HOST PK.fieldError() puts around a field. It sits OUTSIDE every
   field wrapper (.input-wrap / .pk-clear / .pk-pw-wrap) rather than being one
   of them, and carries the error state, the shake and the message — never any
   sizing of the field inside it.

   Outside, not inside, because a tight wrapper's layout is not the message's
   to borrow (see adr/020). Concretely: .pk-pw-wrap used to be
   display:inline-flex, so a message appended into it became a flex ITEM and
   sat beside the password field on the same line, overlapping it, instead of
   underneath. A wrapper exists to size and overlay the field; whatever it has
   to do to manage that is exactly what the message must not inherit.

   The declaration is scoped to .pk-field-own — the host PK.fieldError had to
   BUILD, because the field sat in no container of its own. A field that does
   sit in one (.form-group, .pk-row-list-field) has that container adopted as
   the host instead of a new div being pushed into the tree, and forcing
   display:block on it would flatten a .pk-row-list-field's flex column. See
   adr/025, "The error host is a container that already exists". */
.pk-field-own { display: block; }

/* field-corner:begin ─────────────────────────────────────────────────────
   The right-hand corner of a text field and everything that sits in it: the
   clear ✕ (PK.enhanceInputs), the password eye (PK.enhancePasswordFields) and
   the calendar button (PK.datePicker). Every rule that places or sizes them,
   or reserves room for them, is in this block, and ci.yml ("A control in the
   field's corner") refuses one outside it. The ✕ used to sit at a fixed
   `right: 0.5rem` whatever else was there, and under a number field's spin
   buttons.

   The sizes are tokens, so a field reserves exactly what its buttons take.
   Each button spans the field's full height and its token's width: the
   glyph stays small, the target does not — 28 px with a mouse, 40 px on a
   touch screen, where the 11 px ✕ was hardly ever hit. */
:root {
  --pk-corner-clear: 1.75rem;
  --pk-corner-btn: 1.75rem;
}
@media (pointer: coarse) {
  :root {
    --pk-corner-clear: 2.5rem;
    --pk-corner-btn: 2.5rem;
  }
}

/* Flex, not the default block, and this is about the overlaid buttons rather
   than about layout. A block wrapper around an inline-level <input> is a LINE
   box: it carries the strut's descender space under the field, so the
   wrapper's centre sits below the field's centre — and the corner's buttons
   used to be positioned at `top: 50%` OF THE WRAPPER. The x then
   rode visibly low, by however much the inherited font's descender comes to,
   which is why it was worst in the API Explorer: that toolbar sets a
   font-family but no font-size, so the strut is the page's 16px against a 13px
   field.

   Every overlaid element here is position:absolute and therefore out of the
   flex flow, so nothing but that stray line-box slack is removed. dropdown.js
   used to set `display:flex` on its own wrapper by hand for exactly this
   reason; that line is gone now. */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input, .input-wrap textarea {
  width: 100%;
  box-sizing: border-box;
  padding-right: 1.8rem;
}

/* What the corner holds, reserved with a selector a component's own
   `padding: …` shorthand on its input does not outrank by coming later in
   the file (0,2,1 against the usual 0,1,1 of `.component input`). A date
   field with both buttons reserves both. */
.input-wrap:has(> .input-clear-btn) input { padding-right: var(--pk-corner-clear); }
.pk-pw-wrap:has(> .pk-pw-toggle-btn) input { padding-right: var(--pk-corner-btn); }
.pk-date-wrap:has(> .pk-date-btn) input { padding-right: var(--pk-corner-btn); }
.pk-date-wrap:has(> .pk-date-btn):has(> .input-clear-btn) input {
  padding-right: calc(var(--pk-corner-btn) + var(--pk-corner-clear));
}

/* A number field with the ✕ has no spin buttons: the browser draws them in
   the same corner, 8 px wide — as small a target as the ✕ was, and absent on
   a phone anyway. The arrow keys still step. Where stepping is the point of
   the field, PK.renderStepper is the control. */
.input-wrap:has(> .input-clear-btn) input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.input-wrap:has(> .input-clear-btn) input[type="number"]::-webkit-inner-spin-button,
.input-wrap:has(> .input-clear-btn) input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-clear-btn,
.pk-pw-toggle-btn,
.pk-date-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--pk-muted);
  line-height: 1;
}

/* Overlay "x" clear button — pairs with PK.clearInput() (validators.js).
   Ported from llmgateway's theme.css .input-clear-btn/.input-wrap rules.

   The :has(:not(:placeholder-shown)) rule below is llmgateway's, and it has
   a bug portal-kit inherited: :placeholder-shown can only match when the
   input carries a placeholder attribute at all. On an input WITHOUT one —
   which is most modal fields — :not(:placeholder-shown) is permanently true
   and the x is shown even when the field is empty. Recorded as
   llmgw-issues.md #27.

   The fix is the .has-value class, maintained by PK.enhanceInputs() on every
   input event. The :has() rule is kept as the no-JS fallback, narrowed to
   inputs that actually declare a placeholder, where it behaves correctly. */
.input-clear-btn {
  width: var(--pk-corner-clear);
  font-size: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s, color 0.1s;
}

@media (pointer: coarse) {
  .input-clear-btn { font-size: 0.95rem; }
}

.input-clear-btn:hover { color: var(--pk-text); }

.input-wrap:has(input[placeholder]:not(:placeholder-shown)) .input-clear-btn,
.input-wrap.has-value .input-clear-btn,
.pk-clear.has-value .input-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

/* The eye, from v0.186.0 on every password field: PK.enhanceInputs calls
   PK.enhancePasswordFields first. */
.pk-pw-toggle-btn {
  width: var(--pk-corner-btn);
  font-size: 0.95rem;
}

/* The calendar shares its corner with the ✕, which moves left by the
   button's width. */
.pk-date-btn {
  width: var(--pk-corner-btn);
  border-radius: calc(var(--pk-radius) - 3px);
  transition: color var(--pk-tabs-dur) var(--pk-ease);
}
.pk-date-wrap .input-clear-btn { right: var(--pk-corner-btn); }

/* A date is ten characters. Stretched across a form row (.input-wrap's
   width: 100%) the field read as a text box, its calendar a long way from
   the date it belongs to. It is as wide as the date and both corner
   buttons, wherever it stands; a row of two (from – to) still fits. */
.pk-date-wrap {
  max-width: calc(8.5rem + var(--pk-corner-btn) + var(--pk-corner-clear));
}

.pk-pw-wrap {
  position: relative;
  /* Flex for the same reason .input-wrap is: it makes the wrapper exactly the
     field's height, so the eye toggle, which spans it top to bottom, is
     centred on the field rather than on a taller line box.

     This was inline-flex until v0.11.0, when it became block because a
     validation message appended into it turned into a flex item beside the
     field. That message now lives in the .pk-field outside every wrapper
     (adr/020), so nothing is left in here to become an item — the toggle is
     absolutely positioned and out of the flow. */
  display: flex;
  align-items: center;
  width: 100%;
}

.pk-pw-wrap input {
  width: 100%;
  box-sizing: border-box;
}

.pk-clear {
  position: relative;
}
/* field-corner:end */

/* Every text-like field, by SUBTRACTION rather than by enumeration.
 *
 * This used to read `input[type="text"], input[type="email"],
 * input[type="password"], input[type="number"], textarea`, and an
 * enumeration has two failure modes that both bit:
 *
 *   1. An `<input>` with NO type attribute has the IDL default "text" but no
 *      attribute node, so `input[type="text"]` does not match it. There is no
 *      bare `input { … }` rule to catch it either, so such a field fell all
 *      the way through to the browser's default — 2px inset border, square
 *      corners, the OS font. Six fields in catalog-admin.js were in that
 *      state, and enhanceInputs made it worse rather than better: it reads
 *      the missing type as "text" (forms.js), wraps the field and hangs the
 *      ✕ on it, so the unstyled box got wider and more conspicuous.
 *   2. `search`, `tel` and `url` were never in the list at all, although
 *      forms.js's CLEARABLE_TYPES has always had them.
 *
 * llmgateway does not have this trap because it keys on a CLASS
 * (`.form-input`, theme.css:148 there) — 66 of its 155 inputs have no type
 * and it costs nothing. portal-kit deliberately styles the ELEMENT instead,
 * so a consumer does not have to remember a class; that decision is right
 * and stays. Writing it as an attribute selector merely swapped the class
 * you must remember for an attribute you must remember, which is what
 * adr/020 argues against in general terms. Subtraction has no such edge:
 * a new input type is styled by default and only the controls that are not
 * text boxes are named.
 *
 * `:not()` takes the specificity of its most specific argument, so this is
 * still 0,1,1 — nothing in the cascade moves. */
input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"],
          [type="range"], [type="color"], [type="submit"], [type="button"],
          [type="reset"], [type="image"]),
textarea {
  font-family: var(--pk-font);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  background: var(--pk-surface);
  color: var(--pk-text);
  /* Constant border WIDTH across every state, so the error tween below never
     shifts the inner content by a pixel. Only the colour interpolates. */
  transition: border-color 150ms ease-out;
}

/* iOS Safari zooms the page into any focused field whose text is smaller
   than 16px, and never zooms back out: after the first tap a wizard or a
   dialog is wider than the screen and has to be scrolled sideways. So on a
   touch screen every text field is 16px. !important because components
   size their own fields (13px, 12px) and dropdown.js writes an inline
   size on its search box; one rule here beats them all rather than one
   override per component. The number wheel keeps its 20px (input.pk-wheel-input,
   which the generic 0,1,1 text-field rule above used to beat down to 14px).
   maximum-scale=1 in the viewport would stop the zoom too, but Android
   then forbids pinching altogether. */
@media (pointer: coarse) {
  input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"],
            [type="range"], [type="color"], [type="submit"], [type="button"],
            [type="reset"], [type="image"], .pk-wheel-input),
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* ─── Focus ───────────────────────────────────────────────────────────────
   portal-kit had no focus styling at all, and the one :focus rule it did
   carry (.sd-search input) REMOVED the ring without replacing it. Keyboard
   users had nothing to follow. :focus-visible rather than :focus so a mouse
   click does not paint a ring. */
:where(.btn, input, textarea, select, .sd-trigger, .sd-trigger-clear, .pk-tab, .pk-nav-item, .pk-check input, .pk-lang-btn, .input-clear-btn, .pk-pw-toggle-btn, .pk-stepper-btn, .pk-menu-item, .pk-menu-choice, .pk-usermenu-trigger, .pk-cal-day, .pk-cal-pick, .pk-cal-zoom, .pk-cal-nav, .pk-cal-today, .pk-date-btn, .pk-dt-sort-btn, .pk-info-icon, .pk-notify-close, .pk-notify-link, .pk-help-btn, .pk-help-icon-btn, .pk-help-panel a, .pk-mail-ph, .pk-app-footer-more, .pk-action-more):focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
}

/* ─── Field error state ───────────────────────────────────────────────────
   Adapted from transitions.dev's "Error state shake". Driven by
   PK.fieldError() / PK.clearFieldError() (web/js/forms.js).

   Neither llmgateway nor portal-kit had any per-field error state: a failed
   validation produced a toast in a corner naming a field that, in a scrolled
   modal body, the user could not even see (llmgw-issues.md #32). */

/* Descendant selectors, not child ones: the field sits one or two wrappers
   deep inside its host (.pk-field > .input-wrap.pk-clear > input), so a `>`
   would miss it. .pk-field.is-error is 0,2,1 and therefore beats the base
   input[type="text"] rule (0,1,1) outright — the previous `.is-error > input`
   was also 0,1,1 and won on source order alone, which a consumer stylesheet
   loading after theme.css could silently reverse. */
.pk-field.is-error input,
.pk-field.is-error textarea,
.pk-field.is-error select,
.pk-field.is-error .sd-trigger {
  border-color: var(--pk-red);
  /* The error border auto-reverts on the hold timer, so its fade-out uses
     the slower revert duration, matching the message fade. */
  transition: border-color var(--pk-revert-dur) ease-out;
}

/* Error message reveal. `visibility` is delayed by --pk-revert-dur on hide
   so the text stays painted for the whole opacity fade-out; entering
   .is-error drops that delay to 0 so it appears immediately. */
.pk-error-msg {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--pk-red);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--pk-revert-dur) ease-out,
    visibility 0s linear var(--pk-revert-dur);
}

.pk-field.is-error > .pk-error-msg {
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--pk-revert-dur) ease-out,
    visibility 0s linear 0s;
}

/* Multi-segment keyframe with per-stop easing, so each leg of the shake
   follows its own curve. The %-stops are cumulative durations as a fraction
   of the total (80, 60, 80, 60 = 280ms): 28.57%, 57.14%, 78.57%, 100%.
   Recompute them if --pk-shake-dur-a/-b change.

   PK.fieldError() puts this on the .pk-field host, not on the field itself,
   so the wrapper, the field and the message travel together — an overlaid
   clear or reveal button sitting still while the field slides out from under
   it reads as a glitch rather than as a rejection. */
.pk-shaking {
  animation: pk-shake calc(var(--pk-shake-dur-a) * 2 + var(--pk-shake-dur-b) * 2) linear;
}

@keyframes pk-shake {
  0% { transform: translateX(0); animation-timing-function: var(--pk-ease); }
  28.57% { transform: translateX(var(--pk-shake-distance)); animation-timing-function: var(--pk-ease); }
  57.14% { transform: translateX(calc(var(--pk-shake-distance) * -1)); animation-timing-function: var(--pk-ease); }
  78.57% { transform: translateX(var(--pk-shake-overshoot)); animation-timing-function: var(--pk-ease); }
  100% { transform: translateX(0); }
}

/* A shake is a position change, not a duration — shortening it to 1ms would
   still jerk the field. Under reduced motion it is suppressed entirely and
   the red border plus the message carry the signal on their own. */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-pk-motion="full"]) .pk-shaking {
    animation: none;
    transform: none;
  }
}

:root[data-pk-motion="reduced"] .pk-shaking {
  animation: none;
  transform: none;
}

/* ─── Checkbox ────────────────────────────────────────────────────────────
   Emitted by PK.renderCheckbox() (web/js/forms.js); the tick draws itself in
   via stroke-dashoffset. Adapted from transitions.dev's "Checkbox check",
   with one deliberate departure: the snippet uses a <button role="checkbox">
   and this keeps a real <input type="checkbox">. A button would break form
   semantics and, concretely, dropdown.js's multi-select, which reads
   cb.checked. The input is clipped rather than display:none — the latter
   would take it out of the tab order and off the keyboard entirely.

   Before this, portal-kit had no checkbox rule at all and the OS drew its
   own light-blue widget straight onto the dark palette (llmgw-issues.md
   #31). */
.pk-check {
  /* The containing block of its hidden input. Without it the input does not
     scroll with a dialog's body, and the focus a click gives it scrolls the
     body to where the input wrongly stands. */
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--pk-text);
}

/* A checkbox inside a .form-group is a <label> too, and `.form-group label`
   outranks `.pk-check` — it turned the row into a block with the caption
   jammed against the box, in grey caption type. */
.form-group .pk-check {
  display: inline-flex;
  margin-bottom: 0;
  font-size: 14px;
  color: var(--pk-text);
}

.pk-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pk-check-box {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1px solid var(--pk-border);
  border-radius: 4px;
  background: var(--pk-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--pk-check-box) var(--pk-ease),
    border-color var(--pk-check-box) var(--pk-ease);
}

.pk-check input:checked + .pk-check-box {
  background: var(--pk-accent);
  border-color: var(--pk-accent);
}

.pk-check input:focus-visible + .pk-check-box {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
}

.pk-check input:disabled + .pk-check-box { opacity: 0.5; }
.pk-check:has(input:disabled) { cursor: not-allowed; opacity: 0.6; }

.pk-check-box svg {
  width: 10px;
  height: 10px;
  overflow: visible;
}

.pk-check-box svg path {
  fill: none;
  stroke: var(--pk-accent-contrast);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--pk-check-len);
  stroke-dashoffset: var(--pk-check-len);
  transition: stroke-dashoffset var(--pk-check-uncheck) var(--pk-ease);
}

/* Transitioning the offset (rather than toggling it) is what lets a
   mid-draw uncheck reverse cleanly instead of snapping. */
.pk-check input:checked + .pk-check-box svg path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset var(--pk-check-draw) var(--pk-ease) var(--pk-check-delay);
}

/* ─── Stepper ─────────────────────────────────────────────────────────────
   [−] [ 12 ] [+], built by PK.renderStepper and wired by PK.enhanceSteppers.
   Filed here beside the checkbox because these are the same kind of thing:
   a control this library draws around a real <input> the browser still owns
   (adr/040).

   The reason it exists is the one thing a native number field cannot do —
   be disabled at one end only. Each button carries its own `disabled`, so
   "no more of these" and "you may still give one back" are two states and
   not one.

   The digits roll on a change, which is why the field is a positioned,
   clipped box with two layers over it — the same geometry as the clear
   dissolve further down, without the glow. The clip is scoped to
   .is-rolling for exactly the reason it is there: a permanent
   overflow:hidden would cut the focus ring off the field, which
   :focus-visible draws OUTSIDE the border box. */
.pk-stepper {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
}

.pk-stepper-btn {
  flex: 0 0 auto;
  width: 1.75rem;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  font-family: var(--pk-font);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition:
    background var(--pk-btn-dur) var(--pk-ease),
    border-color var(--pk-btn-dur) var(--pk-ease),
    color var(--pk-btn-dur) var(--pk-ease);
}

.pk-stepper-btn:hover:not(:disabled) {
  border-color: var(--pk-accent);
  color: var(--pk-accent);
}

/* Dimmed rather than removed, so the row keeps its shape and the reader can
   see that there IS another direction — the same argument as the dead
   action slots in the tables. */
.pk-stepper-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pk-stepper-field {
  position: relative;
  flex: 0 0 auto;
}

.pk-stepper-field.is-rolling {
  overflow: hidden;
  border-radius: var(--pk-radius);
}

.pk-stepper-input {
  width: 3.5rem;
  text-align: center;
  /* Our two buttons ARE the spinner. The native one beside them would be a
     second pair of controls for the same number, and it ignores the
     disabled-at-one-end state entirely. */
  appearance: textfield;
  -moz-appearance: textfield;
}

/* A stepper with an empty stop shows WORDS there — "no limit" — and 3.5rem
   is a width for two digits. Only those steppers widen; a quantity beside a
   variant keeps the narrow box it was measured for. */
.pk-stepper-input[data-pk-stepper-empty] {
  width: 7.5rem;
}

/* A stepper inside a form group is a field like any other: it fills the
   group, with the buttons fixed and the number elastic between them.

   The elastic element is .pk-stepper-field, not the input. The field is the
   flex item; the input is merely inside it. Until v0.59.0 the input carried
   `flex: 1 1 auto; width: auto` — the flex part was inert on a non-item, and
   `width: auto` beat `.form-group input { width: 100% }`, so the input fell
   back to its intrinsic ~20 characters inside a field that could not shrink.
   In the article dialog's four-column row that was ~244px of stepper in a
   ~161px column: the + sat on top of the next field and could not be
   clicked. Now the field takes the room that is left, may shrink below its
   content (min-width: 0), and the input fills exactly that.

   A row list needs none of it: `.pk-row-list-field` is a flex column, and the
   stepper there is no direct child of a form group. */
.form-group > .pk-stepper {
  display: flex;
  width: 100%;
}

.form-group > .pk-stepper .pk-stepper-field {
  flex: 1 1 auto;
  min-width: 0;
}

.form-group > .pk-stepper .pk-stepper-input {
  width: 100%;
  box-sizing: border-box;
}

.pk-stepper-input::-webkit-outer-spin-button,
.pk-stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.pk-stepper-roll-out,
.pk-stepper-roll-in {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
  opacity: 0;
  font-family: var(--pk-font);
  font-size: 14px;
  color: var(--pk-text);
}

/* The layers own the glyphs for the length of the roll, so the field's own
   text does not double-render underneath them. */
.pk-stepper-field.is-rolling > input {
  -webkit-text-fill-color: transparent;
}

/* The same glow the clear dissolve draws (see .pk-clear-glow): a stack of
   radial-gradient() ellipses written by JS and faded in and out, reading as
   the old digits smearing into the bottom of the field as they fall out of
   it. Centred rather than starting at the field's padding, because the
   digits are centred — PK._stepRoll asks buildGlowLayers for 'center'. */
.pk-stepper-roll-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  mix-blend-mode: multiply;
}

:root[data-pk-theme="dark"] .pk-stepper-roll-glow { mix-blend-mode: screen; }

@media (prefers-color-scheme: dark) {
  :root:not([data-pk-theme="light"]) .pk-stepper-roll-glow { mix-blend-mode: screen; }
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-pk-motion="full"]) .pk-stepper-roll-glow { opacity: 0 !important; }
}

:root[data-pk-motion="reduced"] .pk-stepper-roll-glow { opacity: 0 !important; }

/* ─── Tooltip ─────────────────────────────────────────────────────────────
   ONE box, portaled to <body> by web/js/tooltip.js and positioned from the
   trigger's rectangle. Adapted from transitions.dev's "Tooltip open/close".

   It used to be a .pk-tt-wrap around every trigger with the box absolutely
   positioned inside it, shown by :hover / :has(:focus-visible). That could
   not work in the two places it was most needed: anything with an overflow
   other than visible establishes a clipping box in BOTH axes — .card-scroll
   and .pk-modal-body are the usual ones — and an absolutely positioned child
   cannot leave it, whatever its z-index. The same reasoning already moved
   .pk-menu and the searchable dropdown's panel to <body> (see the comment
   above .pk-menu); the tooltip was the last component still trapped.

   What the CSS still owns: everything but left/top and the open class. The
   JS writes coordinates and toggles .is-open, so the timing tokens below
   remain the single place a duration is stated. See adr/030. */
.pk-tt {
  position: fixed;
  left: 0;
  top: 0;
  transform: scale(var(--pk-tt-scale));
  transform-origin: 50% 100%;
  z-index: var(--pk-z-tooltip);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--pk-border);
  background: var(--pk-surface);
  color: var(--pk-text);
  font-family: var(--pk-font);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: var(--pk-shadow);
  opacity: 0;
  pointer-events: none;
  /* This rule owns the LEAVE state; transition-delay stays unset so leaving
     plays without one. */
  transition:
    opacity var(--pk-tt-out-dur) ease-out,
    transform var(--pk-tt-out-dur) ease-out;
}

/* .is-open is written by the JS, which shows the box on hover and on
   KEYBOARD focus only. That distinction used to be :has(:focus-visible)
   rather than :focus-within, for a reason worth keeping in view: a mouse
   click focuses the trigger, so :focus-within stays true after the pointer
   has left and pins the tooltip open until the user clicks elsewhere. The
   JS checks el.matches(':focus-visible') to the same end — the same
   distinction this file makes for every focus ring. */
.pk-tt.is-open {
  opacity: 1;
  transform: scale(1);
  transition-duration: var(--pk-tt-in-dur);
  transition-timing-function: ease-out;
  transition-delay: var(--pk-tt-delay);
}

/* The box grows out of the edge facing the trigger. Which side that is comes
   from the measurement, written onto the box itself — there is no wrapper
   left to carry it. */
.pk-tt[data-pk-tooltip-side="bottom"] { transform-origin: 50% 0; }

/* A sentence (PK.infoIcon) wraps instead of running off as one line. */
.pk-tt.is-wrap {
  white-space: normal;
  max-width: min(320px, calc(100vw - 16px));
}

/* PK.infoIcon: the round "i" beside a label that has more to say. llmgateway's
   .info-icon (cmd/gateway/web/theme.css) property for property, in this
   file's tokens — --accent/--bg become --pk-accent/--pk-accent-contrast, and
   IBM Plex Mono, which portal-kit does not load, becomes monospace. It is
   focusable here, because its text is a tooltip and not a title, and so it
   is in the shared focus-ring list above. */
.pk-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--pk-accent);
  color: var(--pk-accent-contrast);
  font-size: .6rem;
  font-weight: 700;
  font-style: normal;
  font-family: monospace;
  cursor: help;
  vertical-align: middle;
  margin-left: .25rem;
  flex-shrink: 0;
}

/* Card / table container */

/* Ported from llmgateway's .card (theme.css:116), which portal-kit's
   extraction never brought along — api-explorer.js has been emitting
   class="card" on its toolbar since day one with no rule behind it, so that
   block rendered with no background, border or radius at all.

   The padding came along in v0.27.0, having been left out on the grounds that
   "the one caller already sets its own" — true while api-explorer.js was that
   one caller. The second was PK.mountBrandingAdmin, which became a page in
   v0.26.0 and had until then been a dialog, drawing its inset from .pk-modal.
   As a page it renders a bare .card, so the tab bar and every field in every
   panel butted straight up against the card border. That is the consumer's
   report "the Appearance page has no padding at all", and a component having
   to remember to add its own is exactly the arrangement that produced it.

   .card-scroll below is deliberately NOT padded: its table brings its own,
   and a horizontal inset there would put the scrollbar in the wrong place. */
.card {
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  margin-bottom: 12px;
  padding: 16px;
}

.card-scroll {
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  overflow-x: auto;
}

/* Only the TABLE scrolls sideways. A .card-scroll holds its title, its
   "New …" button and its filter bar as well, and they are block boxes as
   wide as the VISIBLE strip — so a table wider than that dragged them out
   of view to the left, and the reader scrolled back to filter. Sticky at
   left 0 keeps each one where it was; having exactly the strip's width, it
   has nowhere else to go. The same mechanism as the actions column
   (adr/085), from the other side.

   A sticky box is a stacking context of its own, so what floats out of
   one — the filter bar's searchable dropdown is position: absolute, not
   fixed — gets its z-index only INSIDE it, and the table after it painted
   its header over the open list (spieletage, v0.146.1). z-index 5 lifts
   these boxes over everything a table holds (the actions column is 4), and
   the one with an open dropdown one higher, over its sticky siblings. Far
   below anything that floats on its own (--pk-z-*). */
.card-scroll > :not(table) {
  position: sticky;
  left: 0;
  z-index: 5;
}

.card-scroll > :not(table):has(.sd-dropdown.open) {
  z-index: 6;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pk-border);
  font-weight: 600;
}

/* A header is a full-bleed band, so it cancels the padding its card just
   acquired and puts the gap back underneath itself. Without this its
   border-bottom stops 16px short at both ends and reads as an underlined
   heading rather than a divider.
   Scoped with ">" and to .card: .card-scroll has no padding to cancel, and
   the datatable's header lives there. */
.card > .card-header {
  margin: -16px -16px 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--pk-font);
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--pk-border);
  white-space: nowrap;
}

th { color: var(--pk-text2); font-weight: 600; }

.pk-dt-sortable { cursor: pointer; user-select: none; }
.pk-dt-sortable.sort-active { color: var(--pk-text); }
.pk-dt-sort-indicator { font-size: 10px; color: var(--pk-accent); margin-left: 4px; }

/* The sort button inside a sortable <th> (datatable.js renderSortableHeader).
   It exists so the column can be reached and pressed with a keyboard; it must
   look like nothing at all, because the <th> around it already carries the
   padding, the colour and the cursor.

   Written out property by property rather than with `all: unset`, which would
   also reset `outline` — and the focus ring is a :where() rule of zero
   specificity (see "Focus ring" above), so a shorthand here would silently
   win against it and take the ring away from the one element this whole
   change exists to make focusable. Nothing below touches outline. */
.pk-dt-sort-btn {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  cursor: inherit;
  /* Inline, so colFitWidth's header probe measures the same box it did when
     the label was a bare text node in the <th>. */
  display: inline;
}

/* Column drag-resize. Ported from llmgateway's theme.css:993-999, scoped to
   the class datatable.js puts on a table it manages — the source applies
   `th { position: relative }` to every th on the page, and this repository
   has a hand-built table (the API explorer's endpoint list) that should not
   be touched by a datatable feature.

   table-layout: fixed is what makes a column width mean anything: under the
   automatic layout a browser sizes columns from their content and ignores
   what we set. It also makes the clipping below necessary rather than
   cosmetic — th and td inherit `white-space: nowrap` from the rule above,
   so without `overflow: hidden` a cell narrower than its text would paint
   straight over its neighbour. llmgateway clips only its th, because its td
   are allowed to wrap. */
.pk-dt-resizable { table-layout: fixed; }
.pk-dt-resizable th { position: relative; }
.pk-dt-resizable th,
.pk-dt-resizable td { overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }

/* vertical-align, because a row's cells are not all the same height: one
   holds 14px of text, its neighbour holds 2rem action slots or a thumbnail,
   and the row is as tall as the tallest. The initial value is `baseline`,
   which lines up the TEXT baselines and therefore pushes a cell whose
   content is taller — or which has no line box at all — out of line with
   its neighbours. .pk-action-cell already declared this for itself
   (llmgateway's .action-cell-xs, theme.css:867); every cell in the row
   needs it, or the column that happens to be tallest decides where the
   others sit. */
.pk-dt-resizable th,
.pk-dt-resizable td { vertical-align: middle; }

/* The actions column is the one cell that is never clipped. Its width is
   measured from its own buttons on every render and is not the reader's to
   set (datatable.js, isActionCol), so in the ordinary case nothing overflows
   and this rule does nothing at all. It is the guarantee for the case where
   something does — a consumer's slot wider than it measured — and it says
   which way that should fail: a button drawn over its neighbour is a visible
   mistake, a button silently cut off is not. `clip` rather than the
   inherited ellipsis for the same reason; an ellipsis in a row of icons
   reads as one more icon. */
.pk-dt-resizable th.pk-action-cell,
.pk-dt-resizable td.pk-action-cell {
  overflow: visible;
  text-overflow: clip;
}

/* A visible 4px stripe rather than an invisible hit area: a column border
   nobody can see is a column nobody knows they may drag. It fits inside the
   cell's 12px right padding, so the heading does not have to move over for
   it. touch-action: none keeps the browser from claiming the gesture for
   scrolling, which would cancel the drag on the first touchmove. */
.pk-dt-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  z-index: 1;
  user-select: none;
  touch-action: none;
  background: var(--pk-border);
}

.pk-dt-resize-handle:hover { background: var(--pk-accent); }

/* While a drag is live the cursor has to stay col-resize over everything,
   not just over the 4px it started on — the pointer routinely runs ahead of
   the column edge. */
body.pk-col-resizing,
body.pk-col-resizing * { cursor: col-resize !important; user-select: none !important; }

/* The filter bar's reset with nothing to reset. aria-disabled rather than
   the disabled attribute, so the tooltip explaining why it is inert can
   still be reached by a pointer — the same trade .pk-filter-negate.is-off
   makes below. */
.pk-dt-reset.is-off { opacity: .45; cursor: not-allowed; }

.pk-dt-empty td {
  text-align: center;
  color: var(--pk-muted);
  padding: 24px;
}

/* The totals row under a table (datatable.js renderFooter, adr/105). */
.pk-dt-total td {
  font-weight: 600;
  border-top: 2px solid var(--pk-border);
  border-bottom: none;
}

.pk-dt-skeleton td { padding: 10px 12px; }

/* Gradient shimmer, ported from llmgateway's .skel-bar (theme.css:181).
   portal-kit's extraction had substituted a plain opacity pulse — this is
   the original, and the nicer of the two.

   The width comes in as --pk-skel-w, written per cell by datatable.js. It
   used to be an inline style="width:…", which is the one thing the "no
   inline styles" rule would flag; a custom property is data being passed to
   CSS rather than styling being written from JS. */
.pk-dt-skel-bar {
  display: block;
  width: var(--pk-skel-w, 50%);
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    var(--pk-surface2) 25%,
    var(--pk-border) 50%,
    var(--pk-surface2) 75%);
  background-size: 200% 100%;
  animation: pk-dt-skel-shimmer var(--pk-skel-dur) ease-in-out infinite;
}

@keyframes pk-dt-skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Reveal for the rows that replace the skeleton. transitions.dev's
   "Skeleton loader and reveal" cross-fades two absolutely-positioned layers;
   that cannot work here, because two stacked <tbody> elements cannot be
   positioned over each other. The skeleton rows are replaced outright and
   the incoming rows fade and un-blur in, which is the half of the effect
   that survives the constraint. */
.pk-dt-reveal td {
  animation: pk-dt-reveal var(--pk-reveal-dur) ease-in-out;
}

@keyframes pk-dt-reveal {
  from { opacity: 0; filter: blur(var(--pk-reveal-blur)); }
  to { opacity: 1; filter: blur(0); }
}

.pk-dt-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
}

/* Holds the pagination and PK.renderDataTableControls' cluster on one line
   under a table. They need separate elements — each renders by replacing its
   target's contents — but they are one band of furniture to a reader, and
   stacking them puts two centred rows under every table. Wraps to two lines
   on its own when the width runs out. */
.pk-dt-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.pk-dt-page-info {
  font-size: 13px;
  color: var(--pk-text2);
  min-width: 60px;
  text-align: center;
}

.pk-dt-filter-info {
  font-size: 12px;
  color: var(--pk-muted);
}

.pk-dt-pagesize-sd { width: 70px; }

/* The trigger is 70px; the panel carries a search box and a result count and
   is not. Without this it is squeezed to the trigger's width and its own text
   wraps. Ported from llmgateway's .pg-size-sd .sd-dropdown (theme.css:195),
   minus that rule's hardcoded `bottom: 100%` — this panel's direction is
   decided by measurement in dropdown.js, which gets it right at the foot of a
   table without having to assume that is where it always sits. */
.pk-dt-pagesize-sd .sd-dropdown { min-width: max-content; }
.pk-dt-autorefresh-sd { width: 110px; }

/* Filter bar */

.pk-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pk-border);
}

.pk-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* A filter the page has nothing to offer in — the users page's organization
   tree with a single entry (users-admin.js mountOrgFilter). */
.pk-filter-item[hidden] { display: none; }

.pk-filter-item label {
  font-size: 12px;
  color: var(--pk-muted);
}

.pk-filter-control-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pk-filter-negate {
  border: 1px solid var(--pk-border);
  background: var(--pk-surface);
  color: var(--pk-muted);
  border-radius: var(--pk-radius);
  width: 24px;
  height: 24px;
  flex: none;
  cursor: pointer;
}

.pk-filter-negate.active {
  background: var(--pk-red);
  border-color: var(--pk-red);
  color: var(--pk-on-filled);
}

/* Offered only while the filter beside it holds a value — negating "no
   restriction" is still no restriction, so on an empty box the button has
   nothing to do (see dt.evalFilter). The .active override matters because
   the flag is persisted: a stored negation whose value has since been
   cleared must not go on glowing as though it were doing something.

   .is-off rather than :disabled: the button carries the tooltip that explains
   why it is unavailable, and a disabled control receives no mouse events —
   the tooltip would be unreadable in the one state where it is worth
   reading. datatable.js sets aria-disabled beside the class and refuses the
   click itself. */
.pk-filter-negate.is-off {
  opacity: 0.45;
  cursor: not-allowed;
}

.pk-filter-negate.active.is-off {
  background: var(--pk-surface);
  border-color: var(--pk-border);
  color: var(--pk-muted);
}

/* Dropdowns (searchable single-select — PK.createSearchableDropdown — and
   multi-select — PK.createMultiSelectDropdown). Class names (sd-*) match
   the llmgateway source these were ported from. */

.pk-dropdown {
  position: relative;
  font-family: var(--pk-font);
  font-size: 14px;
}

.sd-wrapper {
  position: relative;
}

.sd-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 6px 10px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  background: var(--pk-surface);
  color: var(--pk-text);
  cursor: pointer;
}

.sd-trigger.open {
  border-color: var(--pk-accent);
}

/* A read-only dropdown (createSearchableDropdown's `disabled`): still shows
   its value, cannot be operated. Dimmed and struck out of the tab order in
   JS, so this is presentation only — _sdToggle and _sdSelect are what
   actually refuse.

   pointer-events: none on the TRIGGER rather than on the container: the
   container is what a tooltip wrapper would sit on, and killing pointer
   events there would take the explanation away with the control. The dashed
   border says "there is a value here that is not yours to change", the same
   vocabulary .pk-badge-status-deleted uses for a row that is present but
   inert. No focus ring to worry about — nothing here is focusable. */
.pk-dropdown.is-disabled .sd-trigger {
  pointer-events: none;
  cursor: not-allowed;
  opacity: .6;
  border-style: dashed;
  background: var(--pk-surface2);
}

.pk-dropdown.is-disabled .sd-trigger-arrow {
  visibility: hidden;
}

.sd-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The ✕ in the trigger takes the trigger's full height (the negative margin
   undoes the trigger's 6px padding) and a corner's width: the 12px glyph
   alone was a target nobody hit on a phone. */
.sd-trigger-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  flex: none;
  min-width: 1.5rem;
  margin: -6px 0;
  color: var(--pk-muted);
  cursor: pointer;
  font-size: 12px;
}

@media (pointer: coarse) {
  .sd-trigger-clear { min-width: var(--pk-corner-clear); font-size: 15px; }
}

.sd-trigger-clear:hover {
  color: var(--pk-text);
}

.sd-trigger-arrow {
  color: var(--pk-muted);
  font-size: 10px;
}

.sd-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 280px;
  overflow: hidden;
  flex-direction: column;
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow);
  z-index: 950;
}

.sd-dropdown.open {
  display: flex;
}

.pk-dropdown.sd-flip .sd-dropdown {
  top: auto;
  bottom: calc(100% + 4px);
}

.sd-search {
  flex: none;
  border-bottom: 1px solid var(--pk-border);
}

.sd-search input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font-family: var(--pk-font);
  font-size: 14px;
  color: var(--pk-text);
}

/* The search box sits inside an already-outlined dropdown panel, so its own
   ring would be a second box drawn 1px inside the first. Suppressed for the
   pointer case only — :focus-visible still paints, so opening the dropdown
   by keyboard shows where focus went. Previously this was a blanket
   `:focus { outline: none }` with nothing put back in its place. */
.sd-search input:focus:not(:focus-visible) {
  outline: none;
}

.sd-options {
  overflow-y: auto;
}

.sd-option {
  padding: 6px 10px;
  cursor: pointer;
}

.sd-option:hover,
.sd-option.sd-kb-focus {
  background: var(--pk-bg);
}

.sd-option.selected {
  color: var(--pk-accent);
  font-weight: 600;
}

.sd-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sd-no-results {
  padding: 10px;
  color: var(--pk-muted);
  font-size: 13px;
}

.sd-result-count {
  padding: 6px 10px;
  color: var(--pk-muted);
  font-size: 12px;
  border-top: 1px solid var(--pk-border);
}

/* Multi-select trigger/panel reuse .sd-trigger visuals via a shared class;
   the panel itself is portaled to document.body with inline positioning
   (see dropdown.js), so only its item-row styling lives here. */
.pk-multiselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Panel rows. These used to be written from JS as style.cssText plus
   onmouseover/onmouseout handlers — the one component that styled itself
   from script rather than from this file. */
.pk-ms-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}

.pk-ms-row:hover { background: var(--pk-bg); }

.pk-ms-sep {
  border-top: 1px solid var(--pk-border);
  margin: 4px 0;
}

.pk-ms-items {
  overflow-y: auto;
  max-height: 240px;
}

.pk-ms-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--pk-muted);
}

/* ─── Catalog (web/js/catalog.js, catalog-admin.js) ───────────────────────
   Every colour is a token declared once with light-dark() further up; there
   is no second @media (prefers-color-scheme) block here, which is adr/017's
   whole point. Nothing animates with a literal duration either — the two
   transitions below use --pk-tabs-dur, which both reduced-motion blocks
   already collapse. */

.pk-catalog-category + .pk-catalog-category { margin-top: 2rem; }

.pk-catalog-category-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--pk-text);
  margin: 0 0 4px;
}

.pk-catalog-category-desc,
.pk-catalog-desc {
  font-size: 13px;
  color: var(--pk-text2);
  margin: 0 0 12px;
}

/* Why the controls under it are dead — a condition the reader can act on,
   not a failure. Louder than .pk-catalog-desc and quieter than a badge:
   it has to be read before the row below it is tried, and it is still a
   sentence about something that is fine. */
.pk-catalog-note {
  font-size: 13px;
  color: var(--pk-text);
  background: var(--pk-surface2);
  border-left: 3px solid var(--pk-accent);
  border-radius: var(--pk-radius);
  padding: 8px 10px;
  margin: 0 0 12px;
}

/* The same line for something that is NOT fine: one of the panel's load
   legs did not answer, so what it shows cannot be trusted as a fact. A
   sibling of .pk-catalog-note rather than a second system, and the only
   difference is the one that matters — --pk-yellow where that one has
   --pk-accent, because the reader has to tell "this is how it is" from
   "this is not what it looks like" at a glance.
 *
 * Yellow and not --pk-red: nothing is broken for good, and a retry is
 * right there. Red is for the destructive confirm (.btn-danger).
 *
 * Nothing here animates, so neither reduced-motion block needs an entry. */
.pk-catalog-failed {
  border-left: 3px solid var(--pk-yellow);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
  margin: 0 0 12px;
}

/* One row per failed leg: the sentence, then its own retry. A panel can
   carry two of these — a failed report makes both the report and the
   article list's "chosen" column unknown — so they stack, and the gap
   belongs to the row rather than the box. */
.pk-catalog-failed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--pk-text);
}

/* Between two stacked rows, not above the first or below the last — the
   box's own padding does those. */
.pk-catalog-failed-row + .pk-catalog-failed-row {
  border-top: 1px solid var(--pk-border);
}

/* The sentence takes the room, the button keeps its own width, and on a
   narrow viewport the button wraps under the text instead of squeezing it
   to one word per line. */
.pk-catalog-failed-row > span { flex: 1 1 16rem; min-width: 0; }
.pk-catalog-failed-row > .btn { flex: 0 0 auto; }

.pk-catalog-empty {
  padding: 2rem;
  text-align: center;
  color: var(--pk-muted);
  font-size: 14px;
}

/* auto-fill rather than auto-fit: a single card should stay card-width
   instead of stretching across the whole row, which is what auto-fit does
   and which makes one shirt look like a banner. */
.pk-catalog-articles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 16px;
}

.pk-catalog-card {
  display: flex;
  flex-direction: column;
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  overflow: hidden;
}

/* A closed article is dimmed and stays readable — the rule the disabled
   action slots follow (adr/035): say why a thing is unusable rather than
   removing it and leaving the reader to guess where it went. */
.pk-catalog-card.is-locked { opacity: 0.65; }

.pk-catalog-image {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  background: var(--pk-surface2);
}

.pk-catalog-body { padding: 12px; }

/* The name, and the countdown to its deadline beside it. Wraps rather than
   squeezing: a card is 17rem at its narrowest, and a long name with
   "noch 12 Tage 04:31:07" beside it does not fit one line of that. */
.pk-catalog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 8px;
  row-gap: 2px;
  margin: 0 0 6px;
}

.pk-catalog-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--pk-text);
  margin: 0;
}

/* Quiet in the card's own type while there is time; the colour is the
   only thing that changes as the deadline nears (catalog.js's
   countdownClass). tabular-nums so the seconds tick in place instead of the
   whole line jittering as a 1 turns into a 0. */
.pk-catalog-countdown {
  font-size: 12px;
  color: var(--pk-text2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pk-catalog-countdown.is-soon { color: var(--pk-yellow); }
.pk-catalog-countdown.is-urgent { color: var(--pk-red); font-weight: 600; }

.pk-catalog-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.pk-catalog-badges:empty { display: none; }

/* The badges are .pk-badge, which this file already defines further down for
   the users and organizations screens — an outlined pill taking its colour
   from the status tokens. The catalog adds MODIFIERS to that family and no
   base class of its own; they live beside the other families rather than
   here, so nothing depends on which block comes first. */

.pk-catalog-variants {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pk-catalog-variant {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: calc(var(--pk-radius) - 3px);
  font-size: 13px;
  color: var(--pk-text);
  transition: background var(--pk-tabs-dur) var(--pk-ease);
}

/* Only the radio row is a <label>, and only a <label> is clickable along its
   whole width. The stepper row is a <div> — its controls are the two buttons
   and the field, and a pointer cursor over the text beside them would be
   promising a click that does nothing. */
label.pk-catalog-variant { cursor: pointer; }

/* A long single choice is a drop-down list (adr/093): the list on the row's
   inset, its "noch n" beside it as a radio row has it. */
.pk-catalog-select {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 8px;
  font-size: 13px;
}

.pk-catalog-select > .pk-dropdown { flex: 1 1 12rem; min-width: 0; }

.pk-catalog-variant:hover { background: var(--pk-surface2); }
.pk-catalog-variant.is-chosen { background: var(--pk-surface2); font-weight: 600; }

/* aria-disabled AND the class: the attribute is what assistive technology
   reads, the class is what the pointer sees, and the input inside carries
   the real `disabled` so nothing can be committed either way. */
.pk-catalog-variant.is-disabled,
.pk-catalog-variant[aria-disabled="true"] {
  color: var(--pk-muted);
  cursor: default;
}

.pk-catalog-variant.is-disabled:hover { background: transparent; }

/* A decline ("Nein", "Nicht da" — adr/090) is the way out, not one of the
   answers: set off by a rule above it, so it never reads as a further
   option of the same kind. The first one only — two declines stand
   together. */
.pk-catalog-variant:not(.is-decline) + .pk-catalog-variant.is-decline,
.pk-catalog-notefield + .pk-catalog-variant.is-decline {
  border-top: 1px solid var(--pk-border);
  margin-top: 4px;
  padding-top: 8px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.pk-catalog-variant-label { flex: 1; }

.pk-catalog-variant-note {
  font-size: 11px;
  color: var(--pk-muted);
  white-space: nowrap;
}

/* The free text under a chosen variant (catalog.js's noteField, adr/052):
   indented to sit under the row it belongs to, caption over field — the
   .form-group shape at the card's smaller type size. */
.pk-catalog-notefield {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 6px;
  padding: 0 8px 0 16px;
  min-width: 0;
}

.pk-catalog-notefield-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 6px;
  font-size: 12px;
  color: var(--pk-text2);
}

/* The card's last line: what this person has chosen and every rule that
   bounds it, in one sentence (catalog.js's ruleLine). Below the controls,
   because it describes their state and changes with every click. */
.pk-catalog-rules {
  font-size: 12px;
  color: var(--pk-text2);
  border-top: 1px solid var(--pk-border);
  margin: 8px 0 0;
  padding-top: 8px;
}

.pk-catalog-rules .is-open { color: var(--pk-accent); }
.pk-catalog-rules .is-met { color: var(--pk-green); }
.pk-catalog-rules .is-over { color: var(--pk-red); font-weight: 600; }

/* .pk-catalog-stepper is gone: the quantity control is PK.renderStepper
   now, and its width and centring are .pk-stepper-input's own. A local copy
   of something the library also ships is exactly what CLAUDE.md's "no
   duplicate" rule is about — here it would have been a copy inside the
   library. */

/* ── the administrative side ── */

/* A note's text, as its author typed it: line breaks kept, long words
   wrapped (adr/051). No height cap and no scroller of its own: it only ever
   stands in a dialog, whose .pk-modal-body already is both, and a long note
   showed two scrollbars side by side — one for the text, one for the
   dialog around it — each moving half of what the reader wanted moved. */
.pk-note-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 8px 12px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
}

/* Once it is Markdown (adr/051, amendment v0.198.0) the blocks make the lines;
   .pk-help-text brings the typography. */
.pk-note-body.pk-note-md { white-space: normal; }
.pk-note-md h1 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; }
.pk-note-md > :last-child { margin-bottom: 0; }
.pk-note-md img[data-pk-note-picture] { cursor: zoom-in; }

.pk-note-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pk-note-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pk-note-image {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 150px;
  padding: 6px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
}
.pk-note-image-thumb {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.pk-note-image-thumb img {
  display: block;
  width: 100%;
  height: 90px;
  object-fit: contain;
}
.pk-note-image-name {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.pk-note-image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  cursor: pointer;
}

.pk-catalog-thumb {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: cover;
  border-radius: calc(var(--pk-radius) - 3px);
  display: block;
  background: var(--pk-surface2);
}

/* A column of pictures (PK.thumbHeader / PK.thumbCell, adr/111). The cell
   is as wide as its picture plus the row's own inset; the frame is drawn
   when there is no picture too, so every row is as high as one with. The
   picture is CONTAINED, not cropped: a box cover is upright or landscape,
   and cutting its title off is the one thing a thumbnail must not do. */
th.pk-dt-thumb,
td.pk-dt-thumb {
  width: calc(2.25rem + 16px);
  padding-left: 8px;
  padding-right: 8px;
}
.pk-thumb {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: calc(var(--pk-radius) - 3px);
  background: var(--pk-surface2);
  overflow: hidden;
}
.pk-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pk-thumb[data-pk-image-preview] { cursor: zoom-in; }
/* No picture (PK.noPictureHtml): a crossed-out picture in the muted text
   colour, centred in whatever box holds it — a table's thumbnail, a
   proposal's cover, a gallery tile. */
.pk-no-picture {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 1.5rem;
  color: var(--pk-muted);
}
.pk-no-picture svg { width: 60%; height: 60%; max-width: 3rem; max-height: 3rem; }
.pk-thumb[data-pk-image-preview]:focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: -2px; /* inside: a resizable table clips its cells */
}

/* The large picture beside a [data-pk-image-preview] (imagepreview.js,
   adr/111) — tooltip.js's arrangement: one box in <body>, position: fixed,
   the JS writes left/top and .is-open. The size is a cap, not a frame: the
   picture keeps its own proportions inside 360 × 360. */
.pk-imgprev {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--pk-z-tooltip);
  padding: 4px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  background: var(--pk-surface);
  box-shadow: var(--pk-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--pk-tt-out-dur) ease-out;
}
.pk-imgprev.is-open {
  opacity: 1;
  transition: opacity var(--pk-tt-in-dur) ease-out;
}
.pk-imgprev img {
  display: block;
  max-width: min(360px, calc(100vw - 32px));
  max-height: min(360px, calc(100vh - 32px));
  border-radius: calc(var(--pk-radius) - 3px);
}
/* Waiting for the trigger's own picture (imagepreview.js): a spinner in a
   box of a fixed size, never the picture shown before. */
.pk-imgprev > .pk-spinner { display: none; }
.pk-imgprev.is-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
}
.pk-imgprev.is-loading > .pk-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  color: var(--pk-text2);
}
.pk-imgprev.is-loading img { display: none; }

/* PK.imageViewer (imagepreview.js) — one picture as large as the window.
   Dark in both themes: a picture is looked at on black. The stage takes the
   gestures itself (touch-action: none), so the browser neither scrolls nor
   pinches the page under it; the JS sizes the <img> to the picture's
   proportions and writes its transform. */
.pk-viewer {
  position: fixed;
  inset: 0;
  z-index: var(--pk-z-viewer);
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.97);
  color: #fff;
  font-family: var(--pk-font);
  opacity: 0;
  transition: opacity 160ms ease-out;
}
.pk-viewer.is-open { opacity: 1; }
.pk-viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) 8px 8px 16px;
}
.pk-viewer-caption {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pk-viewer-close {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
}
.pk-viewer-close:hover { background: rgba(255, 255, 255, 0.28); }
.pk-viewer-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pk-viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-in;
}
.pk-viewer.is-zoomed .pk-viewer-stage { cursor: grab; }
.pk-viewer-stage img {
  display: block;
  flex: none;
  max-width: none;
  transform-origin: center;
  -webkit-user-drag: none;
}
.pk-viewer.is-animating .pk-viewer-stage img { transition: transform 200ms var(--pk-ease); }
.pk-viewer-stage > .pk-spinner {
  display: none;
  position: absolute;
  width: 32px;
  height: 32px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}
.pk-viewer.is-loading .pk-viewer-stage > .pk-spinner { display: inline-block; }
.pk-viewer-foot {
  display: flex;
  justify-content: center;
  padding: 8px 16px max(12px, env(safe-area-inset-bottom));
}
.pk-viewer-action { min-height: 44px; min-width: 12rem; }
/* Paging (v0.179.0): "2 / 5" beside the caption, ‹ › at the stage's sides
   for a mouse — a phone swipes, so a coarse pointer does not get them. */
.pk-viewer-count { flex: none; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.75); }
.pk-viewer-nav {
  appearance: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
}
.pk-viewer-prev { left: 12px; }
.pk-viewer-next { right: 12px; }
.pk-viewer-nav:hover { background: rgba(255, 255, 255, 0.28); }
.pk-viewer-nav:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pk-viewer-nav:disabled { opacity: 0.25; cursor: default; }
@media (pointer: coarse) { .pk-viewer-nav { display: none; } }

.pk-catalog-hint {
  font-size: 12px;
  color: var(--pk-text2);
  margin: 0 0 12px;
}

/* "Received from X" beside the category name. Quieter than the title and on
   the same line, because it qualifies the title rather than announcing
   something: this is a catalog somebody above this organization defines,
   which is why most of the screen is read-only. */
.pk-catalog-received {
  font-size: 12px;
  font-weight: 400;
  color: var(--pk-text2);
  margin-left: 8px;
}

.pk-catalog-received:empty { display: none; }

/* The category strip, above the screen's own tabs: one tab per category
   plus the control that creates one. The button is NOT inside the tablist
   — a tablist's children are views, and one that opens a modal would be
   announced as a tab and reachable with the arrow keys.
 *
 * margin-bottom is 16px, the stacking value used everywhere else here
 * (.card-header, .pk-actions, .pk-tab-panel). It was 8px, which is the
 * INTRA-component value — .pk-check's gap, .pk-row-list-row's gap — and two
 * bars 8px apart, both painting --pk-surface2 at the same 999px radius,
 * read as one block rather than two. */
.pk-catalog-catbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* The strip is only as wide as its tabs. .pk-tabs is inline-flex precisely
   so that it hugs its content, and this used to carry `flex: 1 1 auto` —
   which blockified it and stretched it across the row, so one category
   rendered as a full-width grey band with a small pill parked at the left.
   `min-width: 0` stays: it is what lets the scroller below actually shrink
   instead of forcing the row wider.

   The other extreme is new here: a catalog can have twenty categories.
   Since v0.60.1 every .pk-tabs scrolls inside itself (see the rule after
   .pk-nav's), so this wrapper rarely has anything left to scroll; it stays
   for a consumer stylesheet that caps the bar differently. The pill is unaffected —
   tabs.js positions it from the active button's offsetLeft/offsetWidth
   relative to the positioned .pk-tabs, which is inside the scroller. */
.pk-catalog-catbar > div:first-child {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

/* Deleting a category takes its articles, its variants and everything
   anybody chose with it (adr/038). It sits at the bottom of the settings
   tab, separated, rather than one click from the strip somebody uses to
   move between categories. */
.pk-catalog-danger {
  margin-top: 16px;
  border-color: var(--pk-red);
}

/* Three fields on a row on a wide dialog, stacked on a narrow one. The
   breakpoint is the modal's own, not the viewport's — a wide modal on a
   phone is still narrow. */
.pk-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 12px;
}

/* ─── Date picker (web/js/datepicker.js) ──────────────────────────────────
   A calendar popover over an ordinary text field. It is portaled into
   <body> and positioned as position: fixed, exactly like .pk-menu and for
   the same reason (dropdown.js, nearestClippingAncestor): a panel drawn
   inside a modal or a .card-scroll is clipped by it.

   Every colour is a token, and every token is already declared once with
   light-dark() further up — there is no second @media (prefers-color-scheme)
   block here, which is adr/017's whole point. */

/* The trigger's colours. Its place and size are in the field-corner block:
   it shares that corner with the clear ✕. */
.pk-date-btn:hover,
.pk-date-btn[aria-expanded="true"] { color: var(--pk-accent); }

.pk-date-btn:disabled { opacity: 0.5; cursor: default; }


.pk-cal {
  position: fixed;
  z-index: var(--pk-z-dropdown);
  width: 17.5rem;
  max-width: calc(100vw - 16px);
  padding: 8px;
  box-sizing: border-box;
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow);
  font-family: var(--pk-font);
  transform-origin: top left;
  transform: scale(var(--pk-date-pre-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--pk-date-open-dur) var(--pk-ease),
    opacity var(--pk-date-open-dur) var(--pk-ease);
  will-change: transform, opacity;
}

.pk-cal[data-origin="bottom-left"] { transform-origin: bottom left; }

.pk-cal.is-open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

.pk-cal.is-closing {
  transform: scale(var(--pk-date-pre-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--pk-date-close-dur) var(--pk-ease),
    opacity var(--pk-date-close-dur) var(--pk-ease);
}

.pk-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}

.pk-cal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--pk-text);
}

.pk-cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  appearance: none;
  border: 0;
  border-radius: calc(var(--pk-radius) - 3px);
  background: transparent;
  color: var(--pk-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--pk-tabs-dur) var(--pk-ease);
}

.pk-cal-nav:hover { background: var(--pk-surface2); color: var(--pk-text); }

/* The title goes up a level (days → months → years). A button that looks
   like the title it always was, with the hover every other control has. */
.pk-cal-zoom {
  appearance: none;
  border: 0;
  border-radius: calc(var(--pk-radius) - 3px);
  background: transparent;
  font-family: inherit;
  padding: 4px 8px;
  cursor: pointer;
  transition: background var(--pk-tabs-dur) var(--pk-ease);
}

.pk-cal-zoom:hover { background: var(--pk-surface2); }

/* The month and year views: twelve cells, three to a row, as tall together
   as the day grid with its weekday row, so the panel does not change height
   under the pointer when the view does. */
/* Month and year pickers: four rows of three, split the same way and for the
   same reason as .pk-cal-grid below. The row height that was grid-auto-rows
   is now the row's own height, which is what grid-auto-rows set it to. */
.pk-cal-picks {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pk-cal-picks-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  height: calc((12rem + 10px + 21px - 6px) / 4);
}

.pk-cal-pick {
  appearance: none;
  border: 0;
  border-radius: calc(var(--pk-radius) - 3px);
  background: transparent;
  color: var(--pk-text);
  font-family: inherit;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  transition:
    background var(--pk-tabs-dur) var(--pk-ease),
    color var(--pk-tabs-dur) var(--pk-ease);
}

.pk-cal-pick:hover { background: var(--pk-surface2); }
.pk-cal-pick.is-today { box-shadow: inset 0 0 0 1px var(--pk-accent); }
.pk-cal-pick.is-selected { background: var(--pk-accent); color: var(--pk-accent-contrast); }
.pk-cal-pick.is-selected:hover { background: var(--pk-accent); }
.pk-cal-pick[disabled] {
  color: var(--pk-muted);
  opacity: 0.45;
  cursor: default;
  text-decoration: line-through;
}
.pk-cal-pick[disabled]:hover { background: transparent; }

/* The month grid is a COLUMN OF ROWS, and the seven-column grid sits on each
   row rather than on the whole calendar.

   That is not a layout preference. role="gridcell" is only a cell if it is
   inside a role="row", so datepicker.js wraps each week in one — and the
   obvious way to let those wrappers pass the 7-column grid through,
   `display: contents`, is the one thing that must not be used here: on a
   role="row" it is the known case where browsers drop the element from the
   accessibility tree, which would delete the rows this exists to add. So the
   grid moves inward instead, to where the cells actually are.

   The weekday strip is the grid's first row (role="row" of columnheaders), so
   it keeps the same 7-column grid and loses its margin-bottom — the parent's
   gap is now the space under it. */
.pk-cal-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pk-cal-weekdays,
.pk-cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.pk-cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--pk-muted);
  padding: 2px 0;
}

.pk-cal-day {
  appearance: none;
  border: 0;
  border-radius: calc(var(--pk-radius) - 3px);
  background: transparent;
  color: var(--pk-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  /* Square-ish and fixed: six rows are always rendered, so the panel's
     height must not depend on which month is showing. */
  height: 2rem;
  padding: 0;
  cursor: pointer;
  transition:
    background var(--pk-tabs-dur) var(--pk-ease),
    color var(--pk-tabs-dur) var(--pk-ease);
}

.pk-cal-day:hover { background: var(--pk-surface2); }

/* A day from the neighbouring month. Dimmed rather than blank: the six-row
   grid needs something in those cells, and an empty one makes the first week
   look like a rendering fault. */
.pk-cal-day.is-outside { color: var(--pk-muted); }

/* Today is marked by a ring, the selected day by a fill — so a day that is
   both still reads as both. */
.pk-cal-day.is-today { box-shadow: inset 0 0 0 1px var(--pk-accent); }

.pk-cal-day.is-selected {
  background: var(--pk-accent);
  color: var(--pk-accent-contrast);
}

.pk-cal-day.is-selected:hover { background: var(--pk-accent); }

/* Out of the min/max range. Dimmed and struck through rather than removed,
   which is the rule the action slots and the disabled dropdown already
   follow (adr/035): say why a control is unusable instead of leaving the
   reader to guess where it went. */
.pk-cal-day[disabled] {
  color: var(--pk-muted);
  opacity: 0.45;
  cursor: default;
  text-decoration: line-through;
}

.pk-cal-day[disabled]:hover { background: transparent; }

.pk-cal-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.pk-cal-today {
  appearance: none;
  border: 0;
  border-radius: calc(var(--pk-radius) - 3px);
  background: transparent;
  color: var(--pk-accent);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background var(--pk-tabs-dur) var(--pk-ease);
}

.pk-cal-today:hover { background: var(--pk-surface2); }
.pk-cal-today:disabled { color: var(--pk-muted); cursor: default; }
.pk-cal-today:disabled:hover { background: transparent; }

/* API Explorer (PK.buildAPIExplorer, web/js/api-explorer.js). Scoped,
   component-specific classes — portal-kit has no general utility-class
   layer (see modal/dropdown/datatable above), so this doesn't reuse
   llmgateway's .flex-center-lg/.mono/.card-title/etc. vocabulary. */

/* No padding of its own: this element is class="card pk-explorer-toolbar",
   and .card carries the inset since v0.27.0. Declaring one here again would
   simply double it. */
.pk-explorer-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--pk-font);
}

.pk-explorer-label {
  font-size: 13px;
  color: var(--pk-text2);
  white-space: nowrap;
}

.pk-explorer-key-wrap {
  flex: 1;
  min-width: 200px;
}

.pk-explorer-input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--pk-font), monospace;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  background: var(--pk-surface);
  color: var(--pk-text);
}

/* The explorer's key field is a 13px field, and the dissolve mirror defaults
   to the 14px of a normal form input. Without this the value would change
   size at the moment it starts flying away. */
.pk-explorer-key-wrap .pk-clear-mirror,
.pk-explorer-key-wrap .pk-clear-placeholder {
  font-size: 13px;
}

.pk-explorer-role {
  font-size: 13px;
  color: var(--pk-muted);
}

.pk-explorer-category { margin-bottom: 12px; }

/* Endpoint list. A real table, so the column headers actually sit above
   their values — the flex layout this replaced could not: its path cell is
   content-width, so every row offset the following cells differently, and a
   header built from the same classes could only ever align the outermost
   columns. Widths use the usual table trick — `width: 1%` plus the
   inherited `white-space: nowrap` shrinks a column to its content, leaving
   the path column all the remaining space. */
.pk-explorer-th-toggle,
.pk-explorer-th-method,
.pk-explorer-th-auth,
.pk-explorer-ep-row > td:first-child,
.pk-explorer-ep-row > td:nth-child(2),
.pk-explorer-ep-row > .pk-explorer-auth { width: 1%; }

.pk-explorer-th-auth,
.pk-explorer-ep-row > .pk-explorer-auth { text-align: right; }

.pk-explorer-ep-row { cursor: pointer; }
.pk-explorer-ep-row:hover { background: var(--pk-bg); }

/* Collapse chevron. Ported from llmgateway's .collapse-arrow
   (theme.css:594-595): a ▶ glyph pointing RIGHT while collapsed, rotated
   90° to point DOWN while expanded. An earlier version of this rule was a
   CSS border-triangle pointing down, rotated 180° (i.e. up) when open —
   both orientations inverted, and not what the source does. The source's
   `margin-right: .4rem` is deliberately dropped: the chevron sits in its
   own table cell, which already brings its own padding. */
.pk-explorer-arrow::before {
  content: '▶';
  display: inline-block;
  font-size: 0.55rem;
  color: var(--pk-muted);
  transition: transform var(--pk-tt-in-dur) var(--pk-ease);
}

.pk-explorer-arrow.open::before { transform: rotate(90deg); }

.pk-explorer-method-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--pk-on-filled);
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 52px;
  text-align: center;
}

.pk-explorer-path {
  font-family: monospace;
  font-size: 13px;
}

.pk-explorer-desc {
  font-size: 13px;
  color: var(--pk-text2);
}

.pk-explorer-auth {
  font-size: 12px;
  color: var(--pk-muted);
}

/* The detail row's single full-width cell. `white-space: normal` undoes the
   generic `th, td { white-space: nowrap }` — without it the description and
   the whole try-it-out form would be forced onto one line. */
.pk-explorer-ep-body {
  white-space: normal;
  padding: 10px 12px 12px 28px;
}

.pk-explorer-error { color: var(--pk-red); }

.pk-explorer-section { margin-bottom: 8px; }

.pk-explorer-label-sm {
  display: block;
  font-size: 12px;
  color: var(--pk-text2);
  margin-bottom: 4px;
}

.pk-explorer-param-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pk-explorer-param-name {
  font-family: monospace;
  font-size: 12px;
  color: var(--pk-muted);
  white-space: nowrap;
}

/* The flex role belongs to whichever box is the row's actual child. Since
   v0.11.0 PK.enhanceInputs() wraps this field in an .input-wrap to hang the
   clear button on, so the WRAPPER is the flex item and `flex: 1` on the input
   stopped doing anything — the field collapsed from filling its row to its
   ~20-character intrinsic width. min-width: 0 because a flex item's default
   `min-width: auto` would floor it at that same intrinsic width. */
.pk-explorer-param-input,
.pk-explorer-param-row .input-wrap { flex: 1; min-width: 0; }

.pk-explorer-body-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pk-explorer-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
}

.pk-explorer-send-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pk-explorer-status {
  font-family: monospace;
  font-size: 12px;
}

.pk-explorer-time {
  font-family: monospace;
  font-size: 12px;
  color: var(--pk-muted);
}

.pk-explorer-url-row { margin-top: 4px; }

.pk-explorer-resp { margin-top: 10px; }

.pk-explorer-resp-actions {
  display: flex;
  gap: 6px;
}

.pk-explorer-pre {
  background: var(--pk-bg);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  padding: 10px;
  font-family: monospace;
  font-size: 12px;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}

.pk-explorer-spinner {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--pk-border);
  border-top-color: var(--pk-accent);
  border-radius: 50%;
  vertical-align: middle;
  animation: pk-explorer-spin var(--pk-spin-dur) linear infinite;
}

@keyframes pk-explorer-spin {
  to { transform: rotate(360deg); }
}

/* Password reveal toggle (PK.enhancePasswordFields, web/js/password.js).
   Generic wrapper + button pair auto-applied to every input[type="password"]
   — visual design (eye glyph, button styling) ported from llmgateway's
   togglePwVis/.pw-toggle-btn, adapted into an overlay so it works as a
   drop-in for any password field rather than requiring markup changes per
   page. Its place and size are in the field-corner block. */
.pk-pw-toggle-btn:hover { color: var(--pk-text); }

/* ─── Sliding indicator (tabs and nav share it) ───────────────────────────
   Adapted from transitions.dev's "Tabs sliding". One pill element per bar;
   its width/height and offset are written inline by JS from the active
   item's measured box, so the transition tweens between two real positions.
   Labels sit above it on z-index 1.

   Both PK.createTabs() (web/js/tabs.js) and PK.renderAppHeader()/
   PK.renderNav() (web/js/layout.js) drive this through the same internal
   measure-and-write routine — see positionPill() in tabs.js. */

.pk-tabs,
.pk-nav {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: var(--pk-surface2);
}

/* The wrapper a PK.createTabs panel should carry, and the air between the
   bar and the panel under it.
 *
 * A .pk-tabs bar deliberately has no outer margin — it is a chip, and what
 * surrounds it is its container's business. That left the panel's spacing to
 * whatever its first child happened to declare: branding's and profile's
 * panels start with a .form-group (margin-bottom, not top) or .pk-actions
 * (margin-top: 16px), so they look right by accident, and catalog's
 * Attributes panel starts with a .pk-field-hint and sat flush against the
 * bar. Class invented by catalog-admin.js and styled nowhere until now.
 *
 * Panels are toggled with .hidden rather than unmounted (tabs.js), so only
 * the visible one contributes anything. */
.pk-tab-panel { margin-top: 16px; }

/* A horizontal bar scrolls INSIDE ITSELF instead of pushing the page
   sideways. inline-flex sizes the bar to its content, and a flex item's
   min-width: auto refuses to go below that content, so a consumer with six
   entries had a 640px nav in a 375px viewport and the whole document
   scrolled horizontally for it (v0.59.1); at 375px the profile dialog's four
   tabs came to about 90px more than the dialog, and the dialog body —
   overflow-x: auto, see .pk-modal-body — scrolled sideways with every field
   in it (v0.60.1). max-width caps the bar at whatever its container offers,
   min-width: 0 lets a flex line (.pk-app-header, .pk-catalog-catbar) shrink
   it, and the overflow goes to the bar. A bar that fits is unchanged.
 *
 * The pill needs nothing: it is position: absolute inside the scroll
 * container, so it scrolls with the entries, and positionPill's offsetLeft
 * is measured from the content's origin, not the visible strip.
 *
 * The scrollbar is hidden because a pill-shaped bar with a scrollbar under
 * it is two widgets. What is behind an edge is reached with the arrows
 * below; scroll-padding keeps an entry the browser scrolls to on keyboard
 * focus out from under them. */
.pk-nav:not(.pk-nav-vertical),
.pk-tabs {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  scroll-padding-inline: var(--pk-nav-fade);
}

.pk-nav:not(.pk-nav-vertical)::-webkit-scrollbar,
.pk-tabs::-webkit-scrollbar { display: none; }

/* The global ring sits 2px OUTSIDE the element, and a scroll container clips
   in both axes — the bar's 3px padding would show one pixel of it. Inside a
   scrolling bar the ring is drawn inward instead. */
.pk-nav:not(.pk-nav-vertical) .pk-nav-item:focus-visible,
.pk-tabs .pk-tab:focus-visible {
  outline-offset: -2px;
}

/* ─── Arrows on a bar that overflows (v0.77.0, adr/062) ────────────────────
   Until v0.77.0 the edge with more behind it only faded out, and a mouse
   could not get there at all: no scrollbar to drag, and the wheel scrolls
   the page. tabs.js's PK.watchStrip writes data-pk-more ("start" / "end" /
   "both") from the scroll position, and the arrow on that edge appears;
   clicking it pages the bar. An unmarked bar — every bar wide enough for
   its entries — shows none.
 *
 * The arrows are the bar's first and last child, sticky to its edges, with a
 * negative margin that cancels their own width and the bar's 3px gap: their
 * net width is zero, so no entry moves and the pill measures what it always
 * did. z-index 2 puts them over the entries (z-index 1).
 *
 * Sticky offsets count from the bar's padding edge, not its border, so at
 * left/right: 0 an arrow stopped 3px short of the rim and a sliver of the
 * entry behind it showed through. They sit at -3px, the bar's padding, and
 * pad their chevron back in by the same 3px.
 *
 * The fade is PAINTED, not masked. A mask-image on the bar, which is what
 * both bars used before, would fade the arrows out together with the
 * entries; a gradient from the bar's own colour to transparent on the arrow
 * itself looks the same and leaves the arrow opaque. */
.pk-strip-arrow {
  position: sticky;
  z-index: 2;
  display: none;
  flex: none;
  align-self: stretch;
  align-items: center;
  box-sizing: border-box;
  width: var(--pk-nav-fade);
  padding: 0;
  border: 0;
  font: inherit;
  color: var(--pk-text2);
  cursor: pointer;
}

.pk-strip-arrow:hover { color: var(--pk-text); }

.pk-strip-arrow-prev {
  left: -3px;
  justify-content: flex-start;
  padding-left: 3px;
  margin-right: calc(-1 * var(--pk-nav-fade) - 3px);
  background: linear-gradient(to right, var(--pk-surface2) 60%, transparent);
}

.pk-strip-arrow-next {
  right: -3px;
  justify-content: flex-end;
  padding-right: 3px;
  margin-left: calc(-1 * var(--pk-nav-fade) - 3px);
  background: linear-gradient(to left, var(--pk-surface2) 60%, transparent);
}

.pk-nav[data-pk-more="start"] > .pk-strip-arrow-prev,
.pk-nav[data-pk-more="both"] > .pk-strip-arrow-prev,
.pk-nav[data-pk-more="end"] > .pk-strip-arrow-next,
.pk-nav[data-pk-more="both"] > .pk-strip-arrow-next,
.pk-tabs[data-pk-more="start"] > .pk-strip-arrow-prev,
.pk-tabs[data-pk-more="both"] > .pk-strip-arrow-prev,
.pk-tabs[data-pk-more="end"] > .pk-strip-arrow-next,
.pk-tabs[data-pk-more="both"] > .pk-strip-arrow-next {
  display: flex;
}

/* The round button the arrow draws; the chevron is drawn rather than typed,
   like .pk-menu-item-chevron, because a literal "‹" changes shape with
   every font a consumer's branding sets. */
.pk-strip-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pk-surface);
  box-shadow: 0 1px 2px var(--pk-shadow-color);
}

.pk-strip-chevron::before {
  content: "";
  width: 6px;
  height: 6px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}

.pk-strip-arrow-next .pk-strip-chevron::before { transform: translateX(-1px) rotate(45deg); }
.pk-strip-arrow-prev .pk-strip-chevron::before { transform: translateX(1px) rotate(-135deg); }

.pk-nav-vertical {
  flex-direction: column;
  align-items: stretch;
  border-radius: var(--pk-radius);
}

.pk-tab,
.pk-nav-item {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--pk-font);
  font-size: 14px;
  line-height: 1.4;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--pk-text2);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--pk-tabs-dur) var(--pk-ease);
}

.pk-nav-vertical .pk-nav-item {
  text-align: left;
  border-radius: calc(var(--pk-radius) - 2px);
}

.pk-tab:hover,
.pk-nav-item:hover,
.pk-tab[aria-selected="true"],
.pk-nav-item[aria-current="page"] {
  color: var(--pk-text);
}

/* width/height and transform are written inline by JS so the transition has
   a previous measured position to interpolate from. On first paint and on
   resize JS suspends the transition, writes, forces a reflow and restores it
   — otherwise the pill visibly flies in from the left on every page load. */
.pk-tabs-pill {
  position: absolute;
  top: 3px;
  left: 0;
  z-index: 0;
  height: calc(100% - 6px);
  width: 0;
  border-radius: 999px;
  background: var(--pk-surface);
  box-shadow: 0 1px 2px var(--pk-shadow-color);
  transform: translateX(0);
  transition:
    transform var(--pk-tabs-dur) var(--pk-ease),
    width var(--pk-tabs-dur) var(--pk-ease),
    opacity var(--pk-tabs-dur) var(--pk-ease);
  will-change: transform, width;
  pointer-events: none;
}

.pk-nav-vertical .pk-tabs-pill {
  left: 3px;
  top: 0;
  width: calc(100% - 6px);
  height: 0;
  border-radius: calc(var(--pk-radius) - 2px);
  transition:
    transform var(--pk-tabs-dur) var(--pk-ease),
    height var(--pk-tabs-dur) var(--pk-ease);
  will-change: transform, height;
}

/* Suspends the tween for a measure-and-snap write. */
.pk-tabs-pill.pk-no-anim { transition: none; }

/* ─── App header ──────────────────────────────────────────────────────────
   PK.renderAppHeader() has emitted .pk-app-header/.pk-app-title/.pk-app-user
   since it was written, with no rule anywhere in this file behind any of
   them — every consumer had to restyle the framework's own markup in its own
   stylesheet. These are those rules, brought home. A consumer that already
   carries its own copies must delete them, or its later-loading sheet wins
   the cascade and silently overrides the navigation. */
.pk-app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--pk-surface);
  border-bottom: 1px solid var(--pk-border);
}

/* The navigation follows the title at the header's gap, and the account
   button is pushed to the far edge. It used to be justify-content:
   space-between, which did the same while all three fit on one line — and,
   the moment the account button wrapped, spread whatever was left of the
   first line between the title and the nav instead (adr/055). With the
   footer, the nav is centred instead — see below. */
.pk-app-title {
  flex: none;
  font-family: var(--pk-font);
  font-weight: 600;
  color: var(--pk-text);
}

.pk-app-header > .pk-app-user { margin-left: auto; }

/* With the footer the header holds the title and the pages alone, and it
   stays ONE line: the nav shrinks and scrolls inside itself, as it already
   does at phone width, rather than wrapping under the title. */
body.pk-has-footer .pk-app-header { flex-wrap: nowrap; }
body.pk-has-footer .pk-app-header > .pk-app-user:empty { display: none; }

/* On that one line the nav stands in the middle of the WINDOW, not beside
   the title: the title and an empty twin after the nav share the free space
   equally. The title never gives up its own width (max-content is what
   flex: none gave it), so when the line gets tight the twin goes first, the
   nav moves up to the title's gap and then shrinks and scrolls as before
   (adr/059). */
body.pk-has-footer .pk-app-header > .pk-app-title { flex: 1 1 0; min-width: max-content; }
body.pk-has-footer .pk-app-header::after { content: ""; flex: 1 1 0; min-width: 0; }

/* ─── The nav as a menu, at phone width (adr/068) ─────────────────────────
   Until then the header's nav scrolled inside itself (adr/062), and on a
   375px header with a footer that left one entry and an arrow — the title
   keeps its width. Below the breakpoint the strip goes and the button
   PK.renderAppHeader put beside it opens the same entries as a PK.createMenu
   (layout.js, wireBurger). A breakpoint rather than "whenever it overflows":
   a tablet still gets the strip and its arrows, and a header that switches
   form as a label changes language would be worse than either. Only the
   header's nav; a standalone PK.renderNav is the consumer's to place. */
.pk-nav-burger { display: none; }

@media (max-width: 600px) {
  .pk-app-header > .pk-nav:not(.pk-nav-vertical) { display: none; }
  body.pk-has-footer .pk-app-header::after { content: none; }

  .pk-nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    margin-left: auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--pk-border);
    border-radius: var(--pk-radius);
    background: transparent;
    color: var(--pk-text2);
    cursor: pointer;
  }

  .pk-nav-burger:hover,
  .pk-nav-burger[aria-expanded="true"] {
    border-color: var(--pk-accent);
    color: var(--pk-accent);
  }

  /* Without a footer the account button follows on the same line; the
     burger has taken the push to the far edge. */
  .pk-nav-burger ~ .pk-app-user { margin-left: 0; }
}

/* The middle bar is the span, the outer two its shadows: one element, drawn
   in currentColor, so hover and the theme colour it for free. */
.pk-nav-burger-bars {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.pk-app-title a {
  color: inherit;
  text-decoration: none;
}

.pk-app-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--pk-font);
  font-size: 14px;
  color: var(--pk-text2);
}

/* ─── App footer ──────────────────────────────────────────────────────────
   PK.renderAppFooter (layout.js), turned on by PK.bootApp's `footer`
   (adr/055). Fixed to the window, because what it holds — the account — is
   something to reach from anywhere on a long page, not something at the end
   of it. The body is padded by its height so the last row of a page is never
   underneath it; the toasts move up by the same amount. */
:root { --pk-app-footer-h: 44px; }

body.pk-has-footer { padding-bottom: var(--pk-app-footer-h); }
body.pk-has-footer .pk-toast-container { bottom: calc(var(--pk-app-footer-h) + 12px); }

.pk-app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--pk-z-app-footer);
  box-sizing: border-box;
  min-height: var(--pk-app-footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 20px;
  background: var(--pk-surface);
  border-top: 1px solid var(--pk-border);
  font-family: var(--pk-font);
  font-size: 12px;
  color: var(--pk-text2);
}

.pk-app-footer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: 0 8px;
}

/* "·" between the items, drawn rather than written, so a link that is left
   out (no imprint configured) leaves no stray separator behind. */
.pk-app-footer-meta > * + *::before {
  content: "·";
  margin-right: 8px;
  color: var(--pk-text2);
}

.pk-app-footer-meta a {
  color: var(--pk-accent);
  text-decoration: none;
}

.pk-app-footer-meta a:hover { text-decoration: underline; }

.pk-app-footer .pk-app-user { flex: none; }

/* One line in the bar: the name, then its context, where the header stacked
   them. Two lines would make the footer as tall as the header it is there
   to relieve. */
.pk-app-footer .pk-usermenu-trigger { padding: 2px 8px; }
.pk-app-footer .pk-usermenu-text {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}
.pk-app-footer .pk-usermenu-name { font-size: 13px; }
.pk-app-footer .pk-usermenu-caret { transform: rotate(-135deg) translate(-2px, -2px); }

/* At phone width the copyright goes first — it is the one item nobody
   came to the footer for. */
@media (max-width: 560px) {
  .pk-app-footer { padding: 2px 12px; }
  .pk-app-footer-copy { display: none; }
  .pk-app-footer-meta > .pk-app-footer-copy + *::before { content: none; margin: 0; }
}

/* ─── Action menu ─────────────────────────────────────────────────────────
   PK.createMenu (web/js/dropdown.js). Adapted from transitions.dev's "Menu
   dropdown", with the snippet's unprefixed custom properties renamed to
   --pk-* (an unprefixed --dropdown-open-dur would collide with a consumer's
   own) and its @media (prefers-reduced-motion) block dropped: the tokens are
   neutralised in the two blocks at the top of this file instead, so the
   attribute form of the setting works too.

   The panel is portaled to <body> and positioned in JS (position: fixed), for
   the same reason the searchable dropdown is: anything with an overflow other
   than visible establishes a clipping box in both axes, and a header is very
   often inside one. */
.pk-menu {
  position: fixed;
  z-index: var(--pk-z-dropdown);
  min-width: 220px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 4px;
  box-sizing: border-box;
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow);
  font-family: var(--pk-font);
  transform-origin: top left;
  transform: scale(var(--pk-menu-pre-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--pk-menu-open-dur) var(--pk-ease),
    opacity var(--pk-menu-open-dur) var(--pk-ease);
  will-change: transform, opacity;
}

.pk-menu[data-origin="top-right"] { transform-origin: top right; }
.pk-menu[data-origin="top-center"] { transform-origin: top center; }
.pk-menu[data-origin="bottom-left"] { transform-origin: bottom left; }
.pk-menu[data-origin="bottom-center"] { transform-origin: bottom center; }
.pk-menu[data-origin="bottom-right"] { transform-origin: bottom right; }

.pk-menu.is-open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

.pk-menu.is-closing {
  transform: scale(var(--pk-menu-closing-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--pk-menu-close-dur) var(--pk-ease),
    opacity var(--pk-menu-close-dur) var(--pk-ease);
}

/* The level wrapper exists so that changing WHAT the panel shows can be
   animated separately from the panel appearing. pk-menu-level-in is applied
   only when a level is pushed or popped, never on the first render. */
.pk-menu-level-in {
  animation: pk-menu-level var(--pk-menu-level-dur) var(--pk-ease);
}

@keyframes pk-menu-level {
  from { transform: translateX(var(--pk-menu-level-shift)); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.pk-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  padding: 8px 10px;
  border-radius: calc(var(--pk-radius) - 3px);
  color: var(--pk-text);
  cursor: pointer;
  transition: background var(--pk-tabs-dur) var(--pk-ease);
}

.pk-menu-item:hover,
.pk-menu-item:focus-visible {
  background: var(--pk-surface2);
}

.pk-menu-item[disabled] {
  color: var(--pk-muted);
  cursor: default;
}

.pk-menu-item[disabled]:hover { background: transparent; }

.pk-menu-item[aria-checked="true"] { color: var(--pk-accent); }

.pk-menu-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.pk-menu-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-menu-item-meta {
  font-size: 12px;
  color: var(--pk-text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Drawn rather than typed: a literal "›" is a character whose shape and
   weight change with every font a consumer's branding sets. */
.pk-menu-item-chevron {
  flex: none;
  width: 6px;
  height: 6px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
}

.pk-menu-item-chevron-back { transform: rotate(-135deg); }

.pk-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--pk-border);
}

/* A row of mutually exclusive small choices — a language switch is the case
   this exists for. Deliberately not a submenu: two options are not worth a
   level, and not a modal either. */
.pk-menu-choices {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
}

.pk-menu-choices-label {
  font-size: 14px;
  color: var(--pk-text);
}

.pk-menu-choices-set {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: var(--pk-surface2);
}

.pk-menu-choice {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--pk-text2);
  cursor: pointer;
  transition:
    background var(--pk-tabs-dur) var(--pk-ease),
    color var(--pk-tabs-dur) var(--pk-ease);
}

.pk-menu-choice:hover { color: var(--pk-text); }

.pk-menu-choice[aria-checked="true"] {
  background: var(--pk-surface);
  color: var(--pk-text);
  box-shadow: 0 1px 2px var(--pk-shadow-color);
}

/* ─── The header's user button ────────────────────────────────────────────
   One control where six used to sit: the person's name, their role and
   organization under it, and everything else behind PK.createMenu. */
.pk-usermenu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pk-radius);
  padding: 4px 8px;
  font-family: var(--pk-font);
  color: var(--pk-text);
  cursor: pointer;
  transition:
    background var(--pk-tabs-dur) var(--pk-ease),
    border-color var(--pk-tabs-dur) var(--pk-ease);
}

.pk-usermenu-trigger:hover,
.pk-usermenu-trigger[aria-expanded="true"] {
  background: var(--pk-surface2);
  border-color: var(--pk-border);
}

.pk-usermenu-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.pk-usermenu-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-usermenu-sub {
  font-size: 12px;
  line-height: 1.2;
  color: var(--pk-text2);
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shown only when there is more than one organization to switch to, which is
   the whole of its meaning: it is not decoration on the button, it is the
   answer to "is there anything behind this". */
.pk-usermenu-orgs {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--pk-accent);
  color: var(--pk-accent-contrast);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.pk-usermenu-caret {
  flex: none;
  width: 6px;
  height: 6px;
  border-bottom: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  opacity: 0.55;
}

/* At phone width the button keeps the name and drops everything that is
   only context — the menu itself still says which organization is active. */
@media (max-width: 480px) {
  .pk-usermenu-sub { display: none; }
  .pk-usermenu-name { max-width: 14ch; }
}

.pk-app-main {
  max-width: var(--pk-app-max);
  margin: 24px auto;
  padding: 0 16px;
}

/* ─── Auth pages ──────────────────────────────────────────────────────────
   Login and password-reset shells. Every app built on portal-kit needs both
   pages and they looked the same in each one, hand-copied — this is that
   layout, generalised. */
.pk-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.pk-login-card {
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow);
  padding: 32px;
  width: 320px;
  max-width: 100%;
  box-sizing: border-box;
}

.pk-login-card h1 {
  font-family: var(--pk-font);
  font-size: 18px;
  margin: 0 0 20px;
  color: var(--pk-text);
}

/* The name and the subtitle stand centred under the logo, which is centred
   too (.pk-brand-logo-block). The privacy page's card is a text to read and
   keeps its heading at the left. */
.pk-login-card:not(.pk-privacy-card) > h1,
.pk-login-subtitle { text-align: center; }

/* The privacy page (adr/083, privacy.js): the login card's frame, wide
   enough to read a statement in, starting at the top rather than centred —
   a long text centred vertically opens in its middle. */
.pk-privacy-page { align-items: flex-start; }
.pk-login-card.pk-privacy-card { width: 760px; line-height: 1.55; }
.pk-privacy-card h1 { margin-bottom: 4px; }
.pk-privacy-app { margin-bottom: 20px; }
.pk-privacy-card h2 {
  font-family: var(--pk-font);
  font-size: 15px;
  margin: 28px 0 8px;
  color: var(--pk-text);
}
.pk-privacy-text p { margin: 0 0 12px; color: var(--pk-text); }
.pk-privacy-services { list-style: none; margin: 0 0 20px; padding: 0; }
.pk-privacy-service {
  padding: 10px 0;
  border-top: 1px solid var(--pk-border);
  color: var(--pk-text);
}
.pk-privacy-service-name { font-weight: 600; margin-bottom: 2px; }
.pk-privacy-term { color: var(--pk-muted); }

/* The installation's subtitle, under the name. Name and subtitle read as
   one block, so the gap between them is smaller than the gap down to the
   form — expressed with :has() rather than a class on the heading, because
   login.js builds the two halves independently and the heading must not
   have to know whether a subtitle follows it. */
.pk-login-card h1:has(+ .pk-login-subtitle) {
  margin-bottom: 4px;
}

.pk-login-subtitle {
  font-family: var(--pk-font);
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 20px;
  color: var(--pk-text2);
}

/* A sentence on an auth card that is not a subtitle — the reset card's
   "this link has expired" explanation. Body size, secondary colour, and the
   same bottom margin a form-group leaves before the next control. */
.pk-login-text {
  font-family: var(--pk-font);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px;
  color: var(--pk-text2);
}

/* The two halves of the auth card — the sign-in form and the
   forgot-password panel — plus the collapsible form inside the latter.
   PK.mountLogin swaps them by setting the hidden property; this rule is what
   makes that mean "gone". It is stated explicitly rather than left to the UA
   default because everything these wrappers contain (.form-group,
   .btn-block) sets its own display and would win over [hidden] if the
   attribute were toggled on those elements instead. */
.pk-login-section[hidden] { display: none; }

/* The panel's own heading, under the installation name. Ported from
   llmgateway's .org-sel-title (theme.css:650), which is the same thing one
   card-swap earlier: a second-level title for the half of the card that has
   replaced the form. */
.pk-login-section-title {
  font-family: var(--pk-font);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 12px;
  color: var(--pk-text);
}

/* An answer that has to stay on screen — the reset-link confirmation, or the
   report that the request never left. Ported from llmgateway's .status-msg
   (theme.css:646-649) in portal-kit's own idiom: the toast's coloured left
   edge (.pk-toast-success/.pk-toast-error) over a plain surface, so success
   and failure are told apart without a second pair of colour tokens. */
.pk-login-status {
  font-family: var(--pk-font);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--pk-border);
  border-left: 3px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
  color: var(--pk-text);
}

.pk-login-status[hidden] { display: none; }
.pk-login-status.success { border-left-color: var(--pk-green); }
.pk-login-status.error { border-left-color: var(--pk-red); }

.pk-login-links {
  margin-top: 12px;
  text-align: center;
  font-family: var(--pk-font);
  font-size: 13px;
}

.pk-login-links a {
  color: var(--pk-accent);
  text-decoration: none;
}

/* The second step of the two-step card (adr/042 §6). The address the
   person typed, shown as text where the field was — in the body colour,
   because it is the answer to "who", not an explanation — and allowed to
   break anywhere, since an address has no spaces to break at. The "or"
   between the password field and the sign-in link button sits centred in
   the same secondary colour every other aside on the card uses. */
.pk-login-identity {
  color: var(--pk-text);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.pk-login-or {
  font-family: var(--pk-font);
  font-size: 13px;
  text-align: center;
  margin: 12px 0;
  color: var(--pk-text2);
}

/* Footer of the login card (PK.mountLogin): build identity, a link to the
   public API documentation, and the language switcher. Ported from
   llmgateway's .login-footer/.lang-row/.lang-btn, which every consumer would
   otherwise hand-copy — llmgateway itself carries three copies of it. */
.pk-login-footer {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--pk-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--pk-font);
  font-size: 12px;
  color: var(--pk-muted);
}

.pk-login-footer a {
  color: var(--pk-accent);
  text-decoration: none;
}

.pk-login-footer a:hover { text-decoration: underline; }

.pk-login-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pk-login-version { white-space: nowrap; }

.pk-lang-row {
  display: flex;
  gap: 4px;
}

.pk-lang-btn {
  font-family: var(--pk-font);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  background: none;
  color: var(--pk-muted);
  cursor: pointer;
  transition: color 150ms ease-out, border-color 150ms ease-out;
}

.pk-lang-btn:hover,
.pk-lang-btn.active {
  color: var(--pk-accent);
  border-color: var(--pk-accent);
}

/* ─── Display settings dialog ─────────────────────────────────────────────
   PK.showDisplaySettingsModal (web/js/display-settings.js). A segmented row
   of radio inputs — three states each, not a checkbox, so "follow the OS" is
   a choice the user can actually make and see. */
/* position: relative is load-bearing: it is what the .pk-tabs-pill inside
   this group positions against. .pk-tabs/.pk-nav have carried it all along;
   this group did not, because until v0.13.0 it had no pill to position. */
.pk-ds-group {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--pk-surface2);
}

/* Above the pill, which is z-index: 0 — same stacking arrangement as
   .pk-tab/.pk-nav-item. */
.pk-ds-option {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
  cursor: pointer;
}

.pk-ds-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.pk-ds-option-label {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--pk-text2);
  transition: color var(--pk-tabs-dur) var(--pk-ease);
}

/* Colour only. The background and the shadow that used to live here WERE the
   indicator — a second, non-sliding imitation of .pk-tabs-pill that happened
   to borrow the same duration token, which is why it read as a tab bar that
   had stopped working. The pill is now the real one, drawn behind these
   labels and moved by positionPill. */
.pk-ds-option input:checked + .pk-ds-option-label {
  color: var(--pk-text);
}

.pk-ds-option input:focus-visible + .pk-ds-option-label {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
}

.pk-ds-hint {
  margin: 6px 0 0;
  font-size: 12px;
}

/* ─── Generic spinner ─────────────────────────────────────────────────────
   Used by PK.withBusy() for an in-flight button. Same construction as
   .pk-explorer-spinner, which predates it and stays where it is. */
.pk-spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid var(--pk-border);
  border-top-color: currentColor;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: pk-spin var(--pk-spin-dur) linear infinite;
}

@keyframes pk-spin { to { transform: rotate(360deg); } }

.pk-busy { position: relative; }
.pk-busy > .pk-spinner { margin-right: 6px; }

/* ─── Input clear, with dissolve ──────────────────────────────────────────
   Adapted from transitions.dev's "Input clear with dissolve". The wrapper and
   its layers are built by PK.enhanceInputs() for every eligible field — this
   used to be opt-in per wrapper, which in practice meant no field anywhere
   had it, because nothing produced the markup (adr/020).

   The mirror renders the value so the real input's glyphs can be hidden
   while the animation owns them — otherwise the text double-renders during
   the fly-up. The transitions
   themselves live in JS (per-frame transform/opacity/filter writes): the
   streak's rise/peak/fall envelope cannot be expressed as a static keyframe,
   which is the one place in this file where per-frame JS is unavoidable. */
/* The clip is scoped to the animation, and this is load-bearing rather than
   tidy. Now that PK.enhanceInputs() puts .pk-clear on ordinary form fields
   rather than only on a hand-marked one, a permanent overflow:hidden here
   would clip the focus ring off every field it touches — :focus-visible draws
   the outline 2px OUTSIDE the input's border box, and this wrapper is exactly
   the input's size. Nothing needs clipping at rest anyway: the glow only
   exists while a clear is running, and the mirror clips itself.

   The border-radius belongs to the same rule — the glow is a rectangle of
   gradients, and without a radius the clip has square corners over a rounded
   field. It was missing entirely before, so the effect's own description of
   clipping "to its rounded box" stated an intent rather than the behaviour. */
.pk-clear.is-clearing {
  overflow: hidden;
  border-radius: var(--pk-radius);
}

.pk-clear-mirror,
.pk-clear-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  /* The field's own reserve for the ✕, so the value the mirror shows wraps
     off where the field's text did. */
  padding-right: var(--pk-corner-clear);
  box-sizing: border-box;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  z-index: 2;
  font-family: var(--pk-font);
  font-size: 14px;
}

.pk-clear-mirror { opacity: 0; color: var(--pk-text); }

/* Invisible at rest: the field's own native placeholder is what shows there.
   This stand-in only exists so the empty state can fly in from above while the
   value falls out, and PK._clearDissolve drives its opacity for the length of
   the run. */
.pk-clear-placeholder { opacity: 0; color: var(--pk-muted); }

/* ...and for exactly that length, the native one is hidden, so the two are
   never painted on top of each other. Suppressing it here rather than stripping
   the attribute in JS keeps the placeholder available to assistive technology,
   where it is frequently the field's only accessible name. */
.pk-clear.is-clearing > input::placeholder { color: transparent; }

/* The mirror takes over the glyphs ONLY while a clear is animating, and the
   real input is hidden only for exactly that long.
 *
 * The transitions.dev snippet keys both off `.has-value` as well, because in
 * its demo the mirror is kept in sync with the value at all times. Here the
 * mirror is populated by PK.clearInput at the moment the animation starts, so
 * keying the resting state off .has-value hid the real text behind an empty
 * mirror and the field rendered blank as soon as it had a value. */
.pk-clear.is-clearing .pk-clear-mirror { opacity: 1; }

.pk-clear.is-clearing > input { -webkit-text-fill-color: transparent; }

/* JS writes a stack of radial-gradient() layers into background during a
   clear, then animates opacity. multiply darkens the input underneath; the
   dark palette flips to screen so the same alphas lighten instead of
   vanishing. */
.pk-clear-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  mix-blend-mode: multiply;
}

:root[data-pk-theme="dark"] .pk-clear-glow { mix-blend-mode: screen; }

@media (prefers-color-scheme: dark) {
  :root:not([data-pk-theme="light"]) .pk-clear-glow { mix-blend-mode: screen; }
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-pk-motion="full"]) .pk-clear-glow { opacity: 0 !important; }
}

:root[data-pk-motion="reduced"] .pk-clear-glow { opacity: 0 !important; }

/* ─── Two flicker guards, and they must not fight ─────────────────────────
   There are two different flashes on a page like this, and each needs its own
   guard:

     1. UNSTYLED CONTENT — the card drawn at the top left of the window as a
        bare stack of form controls, then jumping into place once the
        stylesheet lands. Guarded by `pk-cloak`.
     2. THE WRONG PERSON'S CONTENT — a correctly styled application shell,
        shown for the moment between the first paint and the auth check coming
        back, right before an unauthenticated redirect. Guarded by
        `pk-app-page`, ported from llmgateway's `body.app-page` pattern.

   (1) cannot be solved from this file, because in the window where it happens
   this file is precisely what has not arrived. So the consumer puts
   `class="pk-cloak"` on <html> and an INLINE <style> at the top of <head> that
   hides the body, and the rules here hand over to (2) or reveal the page. No
   JavaScript, so it holds with scripting off too. The snippet is in
   web/README.md; it carries a timed fallback, so a stylesheet that never
   arrives cannot leave a blank page.

   SPECIFICITY IS LOAD-BEARING HERE, and getting it wrong is not a subtle
   failure — it un-hides the application shell to logged-out visitors. v0.11.0
   shipped a bare `html.pk-cloak body { visibility: visible }`, which is 0-1-2
   and therefore beat `body.pk-app-page` at 0-1-1: the cloak silently switched
   guard (2) off for every consumer that adopted it. Hence the explicit,
   non-overlapping selectors below — none of them depends on a one-point
   margin, and the cloaked and uncloaked forms are both spelled out. */

/* The page itself, on the pages that are portal-kit's: the application
   shell (body.pk-app-page) and the sign-in and reset shells (the body that
   holds .pk-login-page). A bare `body` stays unstyled on purpose — a
   consumer embedding a component into a page of its own keeps its document
   — but these two are this library's pages, and every consumer's app.css
   carried the same four lines for them until v0.98.0 (adr/079). A
   consumer's rule still wins: its stylesheet loads after this one. */
body.pk-app-page,
body:has(> .pk-login-page) {
  margin: 0;
  background: var(--pk-bg);
  color: var(--pk-text);
  font-family: var(--pk-font);
}

/* Guard (2), on its own. */
body.pk-app-page { visibility: hidden; }

/* Guard (1) lifts — but never over the top of guard (2), which is what the
   :not() is for. Without it this rule matches an app page too. */
html.pk-cloak body:not(.pk-app-page) { visibility: visible; }

/* Both lift together once the consumer's auth check resolves. The cloaked
   forms are 0-3-2, comfortably past the inline cloak's 0-1-2; the two without
   `html.pk-cloak` are 0-2-1, for a consumer that has not adopted it. */
html.pk-cloak body.pk-app-page.pk-authenticated,
html.pk-cloak body.pk-app-page.pk-public,
body.pk-app-page.pk-authenticated,
body.pk-app-page.pk-public { visibility: visible; }

/* An app page being read WITHOUT a session (a public route — see
   web/js/router.js) still shows the header, because it still needs a title, a
   language switcher and a way to sign in. What it must not show is anything
   that only means something to a signed-in user: a link to a private page
   that will bounce the reader straight to the login screen, a "Log out" for a
   session that does not exist, or a settings dialog with no account to save
   against. PK.renderAppHeader marks those with data-pk-auth="required"
   (layout.js).

   llmgateway does the same job with `.public-docs .sidebar { display: none }`
   (theme.css:68) — correct for an application that knows its entire
   navigation is private, too blunt for a library whose consumer may have
   public entries it wants a stranger to see.

   Specificity: 0-2-1, against .pk-nav-item's 0-1-0 and .btn's 0-1-0, so it
   wins on rank and does not depend on source order. `display: none` is not
   set on those by anything else, so nothing here rides on a one-point
   margin — the failure mode this file has been bitten by before. */
body.pk-public [data-pk-auth="required"] { display: none; }

/* And the mirror: a "Sign in" offered to someone already signed in. Both
   directions declared means the header can be rendered once, before the
   session check resolves, instead of being deferred or rebuilt after it. */
body.pk-authenticated [data-pk-auth="anonymous"] { display: none; }

/* A nav whose every entry was dropped by the two rules above is
   still a .pk-nav: 3px of padding on --pk-surface2, which drew a 6x6px grey
   dot beside the title on a public page of an app whose pages are all
   private (v0.78.1). So the bar goes too once no entry would show. The
   pill and the strip arrows are not .pk-nav-item and do not count; neither
   takes any room while the bar has nothing to measure or scroll.
 *
 * Keyed to the same body class and attribute as the rules above rather than
 * to "no visible child", which CSS cannot ask — so an entry hidden some other
 * way still leaves its bar standing, as before. In the centred header
 * (adr/059) the title and its ::after twin share the line without it, which
 * is what an absent nav already looked like. A vertical nav is the same
 * empty box and goes the same way; its logo is rendered before the <nav>,
 * not inside it, and stays. */
body.pk-public .pk-nav:not(:has(> .pk-nav-item:not([data-pk-auth="required"]))),
body.pk-authenticated .pk-nav:not(:has(> .pk-nav-item:not([data-pk-auth="anonymous"])))
  { display: none; }

/* ─── File drop zone and upload progress ──────────────────────────────────
   Ported from llmgateway's .drop-zone/.file-upload-zone (theme.css:852),
   with the colours moved onto tokens — the source hardcodes
   rgba(124,106,247,.08) for the drag fill, which is its accent written out
   by hand and no longer tracks it.

   The progress bar has no counterpart there at all: every upload in
   llmgateway is a fetch() behind an indeterminate spinner, so there is
   nothing to draw. PK.uploadFile reports real bytes (web/js/files.js).

   Nothing above declares border, background or width on these selectors, so
   no rule here depends on out-ranking another by a point of specificity. */
.pk-dropzone {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 24px 16px;
  border: 2px dashed var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text2);
  font-family: var(--pk-font);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--pk-drop-dur) var(--pk-ease),
              background-color var(--pk-drop-dur) var(--pk-ease);
}

.pk-dropzone:hover {
  border-color: var(--pk-accent);
}

/* The zone is keyboard-operable — PK.dropZone gives it a role and a tab
   stop — so it needs a ring like any other control. portal-kit had no focus
   styling at all before v0.9.0, and a new interactive component does not get
   to reintroduce that. */
.pk-dropzone:focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
}

.pk-dropzone-over {
  border-color: var(--pk-accent);
  background: var(--pk-surface2);
  color: var(--pk-text);
}

/* The file input the zone proxies for. Hidden rather than absent, because it
   is what actually opens the picker. */
.pk-dropzone input[type="file"] {
  display: none;
}

.pk-progress {
  overflow: hidden;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--pk-surface2);
}

.pk-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--pk-accent);
  transition: width var(--pk-progress-dur) linear;
}

/* An upload whose total size the browser never reported: the bar cannot say
   how far along it is, so it says nothing rather than inventing a figure. */
.pk-progress-indeterminate .pk-progress-bar {
  width: 35%;
  opacity: 0.6;
}

.pk-progress-label {
  margin-top: 6px;
  font-family: var(--pk-font);
  font-size: 12px;
  color: var(--pk-text2);
  text-align: center;
}

/* ─── Installation branding ───────────────────────────────────────────────
   The logo slot, the branding admin dialog and the custom-CSS editor.

   Note what is NOT here: the tokens branding actually overrides. Those are
   the ordinary ones at the top of this file — --pk-accent, --pk-radius,
   --pk-font and the rest — and /branding.css redeclares them in its own
   :root, loaded last. That is the whole mechanism, and it works precisely
   because this file never declares a colour anywhere but in that one block
   (adr/017). A component that hardcoded a colour would be the one thing an
   installation could not rebrand.

   --pk-brand-logo and --pk-brand-name are written by /branding.css and are
   deliberately NOT declared here: an unset custom property computes to the
   empty string, which is how PK.hasBrandLogo tells "no logo" from "a logo",
   synchronously, on the first paint. Declaring a fallback here would make
   every installation look like it had one. */

:root {
  /* The logo's box in the app header. Height is the real constraint — it
     has to sit on a line with the title text — and the width is a cap
     rather than a size, since background-size: contain keeps the aspect
     ratio and a narrower mark simply occupies less of it. Retune both from
     a consumer stylesheet if a particular logo needs it. */
  --pk-brand-logo-height: 28px;
  --pk-brand-logo-width: 132px;
  /* The block variant: the login card and a vertical navigation, where the
     logo is the widest thing rather than the shortest. */
  --pk-brand-logo-login-height: 56px;

  /* The custom-CSS editor's type. The textarea and the highlighted layer
     underneath it must measure identically to the pixel or the caret drifts
     away from the glyphs, so both read these and neither states a number of
     its own. */
  --pk-code-font: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pk-code-line-height: 1.5;
  /* How long the editor waits before re-highlighting. Read by
     PK.cssMs('--pk-editor-debounce') rather than hardcoded in the JS, so the
     two cannot disagree — and so reduced motion can switch the debouncing
     off, since there the repaint is exactly what is being avoided. */
  --pk-editor-debounce: 120ms;
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-pk-motion="full"]) {
    --pk-editor-debounce: 1ms;
  }
}

:root[data-pk-motion="reduced"] {
  --pk-editor-debounce: 1ms;
}

/* The logo is a background image rather than an <img>, because the URL lives
   in a custom property — the only way a stylesheet can carry one — and
   moving a custom property into a src attribute would mean JavaScript
   reading it back out and re-injecting it on every render.

   contain, not cover: a logo is not a photograph, and cropping one is worse
   than leaving space around it. */
.pk-brand-logo {
  display: inline-block;
  flex: none;
  /* The width token is the box until PK.fitBrandLogos has measured the
     image, and the cap afterwards (adr/055). */
  width: var(--pk-brand-logo-width);
  height: var(--pk-brand-logo-height);
  max-width: 100%;
  background-image: var(--pk-brand-logo);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
  vertical-align: middle;
}

/* Centred above whatever it introduces — the login card's heading, a
   vertical nav's first entry. Full width, so background-position can centre
   the mark inside it whatever its aspect ratio turns out to be. */
.pk-brand-logo-block {
  display: block;
  width: 100%;
  height: var(--pk-brand-logo-login-height);
  margin: 0 0 20px;
  background-position: center;
}

/* Inside the header title the logo and the text sit on one line with a gap
   between them. PK.renderAppHeader puts the logo INSIDE .pk-app-title, and
   inside its link when there is one, so the mark is part of the "back to the
   start page" target rather than a decoration beside it. */
.pk-app-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pk-app-title a {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* The version under the application name (PK.setAppHeaderVersion, bootApp's
   versionEndpoint): name and version stack in one column beside the logo,
   the version small and muted like the account button's second line. It
   never wraps — at phone width a version broken over two lines would make
   the header taller than the name it annotates. */
.pk-app-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  line-height: 1.2;
}

.pk-app-version {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--pk-text2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* A vertical navigation's logo needs no rule of its own: PK.renderNav emits
   the same .pk-brand-logo-block before the <nav>, and the block form above
   is already what a mark introducing a column wants. It sits OUTSIDE the
   <nav> deliberately — .pk-nav draws a pill-shaped surface with its own
   padding, and a logo inside it would be sitting on that surface. */

/* ─── Branding admin dialog ───────────────────────────────────────────── */

/* One colour token per row: the token's name, its light half, its dark half,
   and a reset. A grid rather than a table because the middle two columns
   each hold two controls — a swatch and the text it writes into — and a
   table cell would have to grow a flex container anyway. */
.pk-brand-colors {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
  font-family: var(--pk-font);
  font-size: 13px;
}

.pk-brand-colors-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--pk-text2);
}

.pk-brand-token {
  font-family: var(--pk-code-font);
  font-size: 12px;
  color: var(--pk-text);
  overflow-wrap: anywhere;
}

/* The swatch and the text field are one control in two parts: the swatch can
   only express #rrggbb, and the text field is the value actually saved —
   which is why rgba() and hsl() do not silently lose their alpha the moment
   the dialog is opened. */
.pk-brand-color-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pk-brand-color-pair input[type="color"] {
  flex: none;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--pk-border);
  border-radius: calc(var(--pk-radius) - 3px);
  background: var(--pk-surface);
  cursor: pointer;
}

.pk-brand-color-pair input[type="text"] {
  min-width: 0;
  flex: 1 1 auto;
  font-family: var(--pk-code-font);
  font-size: 12px;
}

/* Tokens the server still holds that the stylesheet no longer declares.
   Called out rather than hidden: a merging PUT never removes a key on its
   own, so without somewhere to see and delete them they would sit in the
   database forever after a token was renamed. */
.pk-brand-orphans {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--pk-yellow);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
}

.pk-brand-orphans-title {
  margin-bottom: 4px;
  font-family: var(--pk-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--pk-text);
}

.pk-brand-orphan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-family: var(--pk-code-font);
  font-size: 12px;
  color: var(--pk-text2);
}

/* THE ASSET FIELD: a drop zone, an upload with a progress bar, and the
   uploaded files shown back as preview tiles. PK.assetField (files.js) owns
   all of it; branding's three pickers and the catalog's article picture are
   two configurations of the same thing.

   The `.pk-brand-asset*` names are kept as ALIASES rather than renamed away,
   for the reason the row list below states: the web-font gallery writes
   `.pk-brand-assets` and `.pk-brand-asset-name` markup of its own, and it is
   a gallery rather than a picker, so it is not a caller of the component.
   New markup uses `.pk-asset-*`. */
.pk-asset-grid,
.pk-brand-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

/* A field showing its one picture offers no drop zone. Dropping a second
   file onto a slot that already holds one has no unambiguous meaning, and a
   zone under a picture reads as "add another", which a single-value field
   cannot do. Replacing is remove, then drop. */
.pk-asset-field.has-value > .pk-asset-zone { display: none; }

/* Positioning context for the ✕. The tile itself cannot be it: the ✕ is the
   tile's SIBLING, because a <button> inside a <button> is not valid markup. */
.pk-asset-wrap {
  position: relative;
  display: inline-flex;
}

.pk-asset,
.pk-brand-asset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 116px;
  padding: 8px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  cursor: pointer;
  font-family: var(--pk-font);
  font-size: 11px;
  color: var(--pk-text2);
  text-align: center;
}

/* A tile that is not a picker is not clickable either. */
div.pk-asset { cursor: default; }

.pk-asset:focus-visible,
.pk-brand-asset:focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
}

.pk-asset[aria-pressed="true"],
.pk-brand-asset[aria-pressed="true"] {
  border-color: var(--pk-accent);
  color: var(--pk-text);
}

/* Top right of the tile, overlapping its corner. Small, quiet and always
   there rather than revealed on hover: a control that appears only under a
   pointer is a control a keyboard and a touch screen cannot find. */
.pk-asset-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--pk-border);
  border-radius: 50%;
  background: var(--pk-surface);
  color: var(--pk-text2);
  font-family: var(--pk-font);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.pk-asset-remove:hover {
  border-color: var(--pk-red);
  color: var(--pk-red);
}

.pk-asset-remove:focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
}

/* The checkerboard is what makes a transparent logo readable in both themes:
   against a flat surface colour a white mark is invisible in the light
   palette and a dark one is invisible in the dark palette. Same two squares
   either way, at low contrast. */
.pk-asset-preview,
.pk-brand-asset-preview {
  width: 100%;
  height: 56px;
  background-color: var(--pk-surface2);
  background-image:
    linear-gradient(45deg, var(--pk-border) 25%, transparent 25%),
    linear-gradient(-45deg, var(--pk-border) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--pk-border) 75%),
    linear-gradient(-45deg, transparent 75%, var(--pk-border) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  border-radius: calc(var(--pk-radius) - 3px);
}

.pk-asset-preview img,
.pk-brand-asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* PK.assetField({ large: true }): a picture worth looking at — a game's
   cover — rather than a logo's name tag. Narrower than the dialog on a
   phone. The wrapper takes the width, so the ✕ stands on the tile's corner
   and not out at the field's edge; the preview takes the picture's own
   shape (v0.196.0), so no checkerboard frames a cover that is not 240 × 280. */
.pk-asset-field--large .pk-asset-wrap {
  width: min(240px, 100%);
}
.pk-asset-field--large .pk-asset {
  width: 100%;
  box-sizing: border-box;
}
.pk-asset-field--large .pk-asset-preview {
  height: auto;
  min-height: 56px;
  line-height: 0;
}
.pk-asset-field--large .pk-asset-preview img {
  height: auto;
  max-height: 360px;
}

/* A file that is not a picture (adr/081): a PDF, a ZIP. No checkerboard —
   there is no transparency to read — and no <img>, which would be a broken
   one: the file's suffix stands where the picture would, on a page-like
   card. */
.pk-asset-preview.pk-asset-doc {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pk-surface2);
  border: 1px solid var(--pk-border);
  color: var(--pk-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.pk-asset-size {
  color: var(--pk-text2);
}

/* "1600 × 900 · 412 KB" under a picture's name: smaller and quieter than
   the name, because it is how two alike thumbnails are told apart and not
   what the tile is about. Empty until something is known, and then it
   takes no room. It wraps between its two halves on a narrow tile — the
   JS keeps each half together — instead of ending in an ellipsis that
   hides the size. tabular-nums keeps a row of tiles' numbers aligned. */
.pk-asset-meta {
  width: 100%;
  overflow-wrap: anywhere;
  font-size: 11px;
  color: var(--pk-text2);
  font-variant-numeric: tabular-nums;
}
.pk-asset-meta:empty { display: none; }

/* Larger than the field's fit box — uploaded before the box existed. The
   colour says "look at this", the tooltip says why; nothing blinks. */
.pk-asset-meta.pk-asset-oversize {
  color: var(--pk-yellow);
  font-weight: 600;
}

.pk-asset-name,
.pk-brand-asset-name {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-brand-hint {
  margin: 4px 0 12px;
  font-family: var(--pk-font);
  font-size: 12px;
  color: var(--pk-text2);
}

/* THE ROW LIST: a list of things where each is a handful of fields, with a
   Remove at the end and an Add under the list. Branding's web fonts were
   the first; the catalog's attributes and an article's variants are the
   next two, and a second copy of these three rules under a catalog name
   would be exactly the drift CLAUDE.md's "no local copy" rule is about.

   The .pk-brand-font-* names are kept as aliases rather than renamed away,
   so nothing that already targets them breaks. New markup uses
   .pk-row-list-*. */
/* flex-start, not center: a field that grows for a moment — which is what a
   validation message under one of them does — would otherwise re-centre
   every OTHER control in the row, so marking one field visibly moves three.
   With the fields at the top they stay where they were and only what is
   below the row moves down, which is what a message appearing is supposed
   to look like. In the ordinary case the two are identical, because every
   field in the row is the same height; the one visible difference is a
   .pk-check field, which lines up slightly better (see its margin-top
   below, which exists for exactly that alignment). */
.pk-row-list-row,
.pk-brand-font-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--pk-border);
  font-family: var(--pk-font);
  font-size: 13px;
}

.pk-row-list-row:last-child,
.pk-brand-font-row:last-child { border-bottom: 0; }

/* One labelled control in a row. Every control here used to be bare — the
   font file <select> had no label at all, and the weight was a naked list
   of 100..900 with nothing saying what the numbers were. */
.pk-row-list-field,
.pk-brand-font-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* A field in a row list is as wide as its widest child, and PK.fieldError
   appends one: a whole sentence, on one line, three times the width of the
   dropdown above it. The control the message is about would grow to fit the
   message — which is how a rejected variant made its "Größe" dropdown a
   different size from the "Farbe" one beside it.

   width: 0 keeps the message out of the intrinsic width the browser
   computes for the column (a percentage min-width cannot be resolved while
   that width is still being decided, so it counts as nothing); min-width
   then resolves against the settled width and the message wraps inside it.
   The field is the width of its control, error or no error. */
.pk-row-list-field > .pk-error-msg,
.pk-brand-font-field > .pk-error-msg {
  width: 0;
  min-width: 100%;
}

/* The CAPTION over a control, and only that. `:not(.pk-check)` is
   load-bearing: a checkbox's own <label class="pk-check"> is the control,
   not a caption for one, and this rule is a descendant selector (0,1,1)
   while .pk-check is a class (0,1,0) — so without the exclusion it wins and
   renders a checkbox's text as a 12px semibold field heading. Direct child,
   too, so a caption in a nested control is never reached. */
.pk-row-list-field > label:not(.pk-check),
.pk-brand-font-field > label:not(.pk-check) {
  font-size: 12px;
  font-weight: 600;
  color: var(--pk-text2);
}

/* A checkbox in a row list has no caption above it, so it sits a caption's
   height higher than the controls beside it. Push it down by exactly that
   much — the caption's line box (12px × 1.4) plus the field's 2px gap —
   rather than centring the row, which would misalign everything else. */
.pk-row-list-field > .pk-check,
.pk-brand-font-field > .pk-check {
  margin-top: calc(12px * 1.4 + 2px);
}

.pk-row-list-actions,
.pk-brand-font-actions {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-left: auto;
  align-self: stretch;
}

/* ─── PK.mountOrderedList (adr/079) ────────────────────────────────────
   A short list of names edited where it stands: one grid row per entry —
   the name, an optional second value, ◀ ▶ ✕ — an optional caption row over
   the two columns, an entry's own small list under it, and the "new" field
   below the list. A grid, so the caption cells line up with the columns.
   Taken from spieletage's Standorte and Lagerorte tabs, which carried it
   as .app-location-* and .app-invloc-*. On a phone the second value takes
   a line of its own and the caption row goes. */
/* The sub-users tab (subusers.js, adr/088): a name and its ✕ per row, the
   "new" field under them in the same grid. A row marked for removal says
   so in place of its field until Save. */
.pk-subusers-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pk-subusers-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.pk-subusers-row .form-group { margin: 0; }
.pk-subusers-row.is-removed { align-items: center; }
.pk-subusers-removed { color: var(--pk-text2); text-decoration: line-through; }

.pk-ordered-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pk-ordered-item { display: flex; flex-direction: column; gap: 6px; }
.pk-ordered-list:has(.pk-ordered-sub) > .pk-ordered-item {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--pk-border);
}
.pk-ordered-row {
  display: grid;
  gap: 6px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}
.pk-ordered-list.has-select .pk-ordered-row {
  grid-template-columns: minmax(8rem, 1fr) minmax(12rem, 18rem) auto auto auto;
}
.pk-ordered-row .form-group { margin: 0; }
/* The same row with a checkbox between the name and ◀ ▶ ✕ — a catalog
   attribute's options, whose box says "decline" (catalog-admin.js,
   adr/094). */
.pk-ordered-list.has-check .pk-ordered-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
}
/* In the attribute row list the option list is the field that grows. */
.pk-row-list-field.pk-catalog-options { flex: 1 1 20rem; }
.pk-catalog-options > .pk-ordered-list { margin-bottom: 4px; }
.pk-catalog-options > .btn { align-self: flex-start; }
.pk-ordered-head { font-size: 0.85em; color: var(--pk-text2); }
.pk-ordered-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-left: 12px; }
.pk-ordered-sub > .pk-field-hint { margin: 0; }
.pk-ordered-sub-item.form-group { display: inline-flex; flex-direction: row; gap: 2px; align-items: center; margin: 0; }
.pk-ordered-sub-item input { width: 7rem; }
.pk-ordered-add { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.pk-ordered-add .form-group { flex: 1 1 16rem; margin: 0; }
@media (max-width: 560px) {
  .pk-ordered-list.has-select .pk-ordered-row { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  /* By position — written when PK.createSearchableDropdown still replaced
     its host's class (fixed in v0.157.1); the row's hosts carry none. */
  .pk-ordered-list.has-select .pk-ordered-row:not(.pk-ordered-head) > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .pk-ordered-head { display: none; }
}

/* An uploaded font file, rendered in itself. --pk-font-sample is set on the
   card by branding-admin.js once the FontFace has loaded; until then, and
   for a file that is not a font at all, the fallback below is what shows. */
.pk-brand-font-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 116px;
  padding: 8px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
}

.pk-brand-font-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  font-family: var(--pk-font-sample, var(--pk-font));
  font-size: 20px;
  color: var(--pk-text);
  overflow: hidden;
  white-space: nowrap;
}

/* The file could not be loaded as a font — which is the real type check:
   FontFace rejects a PNG renamed to .woff2, and no extension test would. */
.pk-brand-font-card.pk-font-unreadable {
  border-color: var(--pk-red);
}

.pk-brand-font-card.pk-font-unreadable .pk-brand-font-preview {
  font-family: var(--pk-font);
  font-size: 12px;
  color: var(--pk-red);
  white-space: normal;
  text-align: center;
}

/* ─── Custom-CSS editor ───────────────────────────────────────────────────
   A <textarea> with transparent text over a highlighted <pre>, which is the
   fragile option and is documented as such in adr/023. It holds together
   only while the two layers measure identically, so every property that
   affects layout is declared once on the shared selector below and never on
   one of them alone. If you touch this, change the shared rule — a font-size
   on just one layer moves the caret away from the glyphs by a fraction of a
   character per column, which looks like nothing until column 60. */
.pk-code-editor {
  position: relative;
  width: 100%;
  height: 340px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  overflow: hidden;
}

.pk-code-editor-view,
.pk-code-editor-input {
  margin: 0;
  padding: 10px 12px;
  border: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  font-family: var(--pk-code-font);
  font-size: 13px;
  line-height: var(--pk-code-line-height);
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  overflow: auto;
}

.pk-code-editor-view {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: transparent;
  color: var(--pk-text);
}

.pk-code-editor-view code {
  font: inherit;
  white-space: inherit;
  overflow-wrap: inherit;
}

/* The text is transparent and only the caret is drawn, so what the reader
   sees is the highlighted layer underneath. -webkit-text-fill-color is
   needed as well as color: WebKit ignores a transparent `color` on a
   textarea's own text. The same pair .pk-clear.is-clearing uses. */
.pk-code-editor-input {
  position: relative;
  z-index: 1;
  resize: none;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--pk-text);
}

.pk-code-editor-input::selection {
  background: var(--pk-accent);
  color: transparent;
}

.pk-code-editor-input:focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: -2px;
}

/* Without highlight.js loaded there is no layer underneath, so the textarea
   has to draw its own text. PK.showBrandingModal sets this class in that
   case rather than letting the editor render as an invisible field. */
.pk-code-editor-plain .pk-code-editor-input {
  color: var(--pk-text);
  -webkit-text-fill-color: var(--pk-text);
}

.pk-code-editor-plain .pk-code-editor-input::selection {
  color: var(--pk-text);
}

.pk-code-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-family: var(--pk-font);
  font-size: 12px;
  color: var(--pk-text2);
}

.pk-code-conflict {
  color: var(--pk-red);
  font-weight: 600;
}

/* ─── Badges, action slots and the user listing ────────────────────────────
   Generalized from llmgateway's .badge-role-* / .badge-counter /
   .btn-disabled-slot / .action-cell-xs (theme.css:170, 816-824, 867). Its
   role badges name its own role vocabulary (super_admin/admin/user); here
   the vocabulary is org's two roles plus the five states a directory row can
   be in, and the colours come from the status tokens at the top of this file
   rather than from literals.

   Nothing in this block animates, so it adds no duration token and appears
   in neither reduced-motion block. */

.pk-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--pk-border);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--pk-text2);
}

.pk-badge-role-admin { color: var(--pk-accent); border-color: var(--pk-accent); }
.pk-badge-role-user { color: var(--pk-muted); }

.pk-badge-status-active { color: var(--pk-green); border-color: var(--pk-green); }
.pk-badge-status-inactive { color: var(--pk-yellow); border-color: var(--pk-yellow); }
.pk-badge-status-suspended { color: var(--pk-red); border-color: var(--pk-red); }
.pk-badge-status-deleted { color: var(--pk-red); border-color: var(--pk-red); border-style: dashed; }
.pk-badge-status-no_org { color: var(--pk-muted); border-style: dashed; }

/* The four organization types (orgs-admin.js), from llmgateway's
   .badge-org-* (theme.css:176-179). Four tokens that already exist rather
   than four new colours: the tree has one root, and the ranking accent →
   blue → green → muted reads down it. A team is muted because it is a
   compartment inside an organization and not a tier of its own —
   ValidateHierarchy lets nothing exist below one.

   The type badge and the deleted badge sit side by side on a deleted row:
   what an organization IS does not stop being true when it is deleted, so
   the deleted badge is added beside the type badge rather than replacing
   it. llmgateway does the same (app.html:12123-12126). */
.pk-badge-org-distributor { color: var(--pk-accent); border-color: var(--pk-accent); }
.pk-badge-org-reseller { color: var(--pk-blue); border-color: var(--pk-blue); }
.pk-badge-org-customer { color: var(--pk-green); border-color: var(--pk-green); }
.pk-badge-org-team { color: var(--pk-muted); }

/* Dashed red, exactly as .pk-badge-status-deleted is on the users screen —
   one vocabulary for "this row is soft-deleted" across both listings. */
.pk-badge-org-deleted { color: var(--pk-red); border-color: var(--pk-red); border-style: dashed; }

/* The catalog's own family (web/js/catalog.js), in the same shape as the
   three above: colour and border-colour only, from the status tokens, on
   the .pk-badge base. Not a filled pill — an outlined badge is what this
   library's badges look like, and inventing a second kind would have meant
   a second base class fighting this one in the cascade.
   A plain .pk-badge with no modifier is already the muted case.
   -required and -chosen went with the count badge in v0.59.0: that count is
   the card's rule line now (.pk-catalog-rules), which carries the same two
   colours on its "at least" part. */
.pk-badge-cat-deadline { color: var(--pk-text2); }
.pk-badge-cat-late { color: var(--pk-yellow); border-color: var(--pk-yellow); }
/* Dashed, like the deleted badges: "this is not available to you" and "this
   row is gone" are the same kind of statement about a thing still shown. */
.pk-badge-cat-soldout { color: var(--pk-red); border-color: var(--pk-red); border-style: dashed; }

/* The platform log (web/js/platformlog.js). The level badges in the same
   outlined shape as the families above: llmgateway's badge-red /
   badge-accent / badge-muted (theme.css:54-57) as the status tokens. */
.pk-badge-level-error { color: var(--pk-red); border-color: var(--pk-red); }
.pk-badge-level-warn { color: var(--pk-yellow); border-color: var(--pk-yellow); }
.pk-badge-level-info { color: var(--pk-muted); }

/* Addresses, categories and timestamps line up when they are monospaced. */
.pk-log-mono {
  font-family: var(--pk-code-font);
  font-size: 13px;
}

/* The message column, truncated to one line: the whole text is in the
   dialog a click away (llmgateway's .td-msg). */
.pk-log-msg {
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The whole row opens the dialog; the time is the button a keyboard
   reaches it by, and carries the focus ring every .pk-tbl-link has. */
.pk-log-row { cursor: pointer; }

/* The cronjob screen (web/js/cron.js, adr/069): llmgateway's
   .badge-cronstatus-* (theme.css:799-807) as the status tokens, in the
   outlined shape above. A running run is blue — neither good nor bad yet;
   an aborted one yellow, because nobody knows how far it got. */
.pk-badge-cron-success { color: var(--pk-green); border-color: var(--pk-green); }
.pk-badge-cron-error { color: var(--pk-red); border-color: var(--pk-red); }
.pk-badge-cron-running { color: var(--pk-blue); border-color: var(--pk-blue); }
.pk-badge-cron-aborted { color: var(--pk-yellow); border-color: var(--pk-yellow); }

/* A click on a job row shows its run history below (llmgateway's
   .row-selected). The selected row is tinted with the accent, as a
   selected calendar day is, but faintly: it is a row of text to read. */
.pk-cron-row { cursor: pointer; }
.pk-cron-row.is-selected td {
  background: color-mix(in srgb, var(--pk-accent) 10%, transparent);
}

/* The run history is a second list under the first. */
.pk-cron-runs { margin-top: 16px; }

/* The protocol dialog. */
.pk-cron-run-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pk-cron-error {
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 1px solid var(--pk-red);
  border-radius: var(--pk-radius);
  color: var(--pk-red);
  white-space: pre-wrap;
}
.pk-cron-summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 16px;
  margin: 0 0 12px;
}
.pk-cron-summary dt { color: var(--pk-text2); }
.pk-cron-summary dd { margin: 0; }
.pk-cron-msg { white-space: pre-wrap; }

/* The article list's "Sichtbar für" (adr/087): "alle" recedes, "niemand"
   stands out in the status yellow the late-deadline badge uses. */
.pk-tbl-link.pk-catalog-audience-all { color: var(--pk-muted); }
.pk-tbl-link.pk-catalog-audience-none { color: var(--pk-yellow); font-weight: 600; }

/* The catalog's "zuletzt erinnert" under an article's deadline (adr/069). */
.pk-catalog-reminded {
  font-size: 12px;
  color: var(--pk-text2);
}

.pk-log-limit-note {
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 1px solid var(--pk-yellow);
  border-radius: var(--pk-radius);
  color: var(--pk-text2);
  font-size: 13px;
}

/* The dialog. */
.pk-log-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
}

.pk-log-message {
  padding: 8px 10px;
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
  white-space: pre-wrap;
  word-break: break-word;
}

.pk-log-meta-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pk-log-meta-head label { margin: 0; }

/* The metadata JSON. The token colours are the page's highlight.js theme
   when one is loaded; without it this is plain escaped text. */
.pk-log-pre {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
  color: var(--pk-text);
  font-family: var(--pk-code-font);
  font-size: 12px;
  line-height: var(--pk-code-line-height);
}

.pk-log-pre code.hljs {
  padding: 0;
  background: transparent;
}

/* One level of the organization tree, in the name column. An empty inline
   span repeated `depth` times, NOT a padding computed into a style=
   attribute the way llmgateway does it (app.html:12126,
   padding-left:${depth*1.5+0.75}rem) — this repository allows no inline
   style attributes, and a depth that arrives from data must not be able to
   write CSS. 1.5rem is the source's own step.

   The connector (└) is written by the JS beside these, so a row's indent and
   its marker cannot disagree about how deep it is. */
.pk-tree-indent {
  display: inline-block;
  width: 1.5rem;
}

/* A deleted row, dimmed as a whole so the eye skips it while scanning the
   live tree — it is still at its tree position, which is the point of
   showing it at all. Not display:none and not a separate view: every admin
   who could see the organization while it was live can see it afterwards,
   and the Restore button is on it. */
/* On the cells and not on the <tr>: opacity on the row would make the
   sticky actions cell's background translucent too, and the cells scrolling
   under it would show through (adr/085). The action cell dims its buttons
   instead of itself for the same reason. */
tr.pk-row-deleted > td:not(.pk-action-cell),
tr.pk-row-deleted > td.pk-action-cell > * { opacity: .65; }

/* A value in a cell that opens something — the member count, which opens the
   members dialog. Reads as a link because it behaves like one; the focus
   ring is explicit because a <button> styled this flat would otherwise show
   nothing at all to a keyboard user, and portal-kit had no focus styling at
   all until v0.9.0. */
.pk-tbl-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--pk-accent);
  cursor: pointer;
}

.pk-tbl-link:hover {
  text-decoration: underline;
}

.pk-tbl-link:focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
  border-radius: var(--pk-radius);
}

/* A drilldown the viewer cannot open: the number still reads, the
   affordance does not. Dim it and say why rather than remove it and leave
   the reader to guess whether the link is missing or the data is (adr/035,
   the same rule the disabled action slots follow). Rendered as a <span>, so
   it is out of the tab order by construction; the tooltip carries the
   reason and is reachable on hover. */
.pk-tbl-link.is-disabled,
.pk-tbl-link[aria-disabled="true"] {
  color: var(--pk-text2);
  cursor: default;
}

.pk-tbl-link.is-disabled:hover,
.pk-tbl-link[aria-disabled="true"]:hover {
  text-decoration: none;
}

/* Monospace, for the things that are identifiers rather than prose: a UUID
   column, an IP allowlist typed one entry per line. llmgateway's .mono
   (theme.css:1431's note lists it among the vocabulary this file
   generalizes), reading the editor's font token rather than restating a
   stack — so an installation that changes one changes both. */
.pk-mono { font-family: var(--pk-code-font); }

/* .pk-member-list / .pk-member-row / .pk-member-name were the members
   dialog's own list, with a hand-written search box above it. It is a
   PK.createDataTable now, like every other list of rows in this library —
   so the three classes are gone rather than left behind for somebody to
   build a second half-table out of. */

/* The one action that ADDS something, in the accent rather than the danger
   red .pk-action-danger uses. Both are on .pk-action-slot, so this only
   colours the glyph.

   !important because these slots are .btn-ghost, whose hover takes the
   label to the accent at specificity 0,3,0. Without it the green "+" and
   the red "✕" both turn accent-blue the moment the cursor is on them —
   which is exactly when the colour was doing its job. The class exists to
   set the colour, so it sets the colour; llmgateway guards its .text-red
   the same way (theme.css:31), for the same reason. */
.pk-action-create { color: var(--pk-green) !important; }

/* The count of failed sign-in attempts, riding on the button that clears
   them. Filled rather than outlined, because it is a number to notice.

   ABSOLUTELY positioned, as in llmgateway (.badge-counter, theme.css:824,
   on a pos-relative button at app.html:7737). An inline-block badge with a
   margin is part of the button's content and widens the slot that carries
   it — which is one row's worth of drift in a column whose whole point is
   that the icons sit under each other. */
.pk-badge-counter {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--pk-red);
  color: var(--pk-on-filled);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

/* A dash, a "never", an absent organization: present so the column is not
   empty, quiet so it does not read as data. */
.pk-dim { color: var(--pk-muted); }

/* The actions column. Fixed-width slots: a row that cannot offer an action
   renders a dimmed placeholder in its place, so the column has the same
   width in every row and the buttons stay under each other. */
.pk-action-cell {
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

/* Spacing between slots, rather than a margin on the slot itself: the last
   one then sits flush with the cell's right edge. llmgateway's
   .action-cell-xs > * + * (theme.css:867). */
.pk-action-cell > * + * { margin-left: 4px; }

/* The actions column stays put while the rest of the row scrolls (adr/085) —
   a frozen column, as in a spreadsheet. A table grows with what a consumer
   declares (spieletage-portal's four member attributes made the user list
   wider than most windows), and the buttons are always its LAST column, so
   without this they were the first thing to scroll out of sight, on every
   row at once, with nothing on screen saying they exist.

   `sticky` and not a second table: sticky clings to the nearest scroll
   container, which is the .card-scroll around every datatable here, so the
   column keeps its place in the row, its height, its borders and its
   width measurement, and nothing in datatable.js has to know.

   The background is what makes it work: a sticky cell is painted OVER the
   cells that scroll under it, and a transparent one shows their text
   through its buttons. z-index 4 is above anything a cell holds without
   its own stacking context — the resize handle (1), a stepper's or a clear
   button's glow (3) — and far below anything that floats (--pk-z-*).

   The shadow on its left edge is the "there is more" cue, and only while
   there is: datatable.js puts .pk-scroll-x on the scroller as long as
   content is hidden to the right. A table that fits looks as it did. */
.card-scroll th.pk-action-cell,
.card-scroll td.pk-action-cell {
  position: sticky;
  right: 0;
  z-index: 4;
  background: var(--pk-surface);
}

.card-scroll.pk-scroll-x th.pk-action-cell,
.card-scroll.pk-scroll-x td.pk-action-cell {
  box-shadow: -8px 0 8px -8px var(--pk-shadow-color);
}

/* A FIXED SQUARE, copied from llmgateway's .btn-sm.btn-action
   (theme.css:169: `padding:0; width:2rem; height:2rem;
   justify-content:center`) — not a min-width, which is what this used to be
   and what made the column wander.

   Two reasons a min-width cannot hold this column still, both of which the
   fixed size removes by construction:

   - A slot is a <button> when the action is available and a <span> when it
     is not, and the two do not agree on the box model: the UA stylesheet
     gives form controls box-sizing: border-box, a span is content-box, and
     this file sets no universal rule. `min-width: 30px` therefore meant 30px
     for one and 30 + padding + border for the other, so a row with more
     placeholders was wider — and since the cell is right-aligned, its icons
     started further left than its neighbour's.
   - Glyph widths differ (an emoji is wider than ✎), so any size the content
     can push past is a size that varies per slot.

   box-sizing is stated rather than assumed, for the same reason the bug
   existed. position: relative hosts .pk-badge-counter.

   llmgw-issues.md #79 records the other half: two slots of llmgateway's own
   user row opt out of .btn-action and are sized by their content, which is
   the same latent problem there. */
.pk-action-slot {
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  /* .btn-action above declares min-width: 32px, which would win over a
     2rem width the moment a consumer's root font-size is not 16px. */
  min-width: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

/* Not `display: none` and not `visibility: hidden`: the placeholder holds
   the width AND carries a tooltip saying why the action is unavailable, so
   it has to stay hoverable. It is aria-hidden in the markup — a screen
   reader gets nothing rather than a button that does nothing.

   No display of its own: it must be the same box as the <button> beside it,
   and .pk-action-slot above is where that is decided. Overriding it here
   with inline-block is what this rule used to do, and half of why the two
   measured differently. llmgateway's equivalent, .btn-disabled-slot
   (theme.css:170), likewise sets nothing but the opacity. */
.pk-action-slot-off {
  opacity: 0.2;
  cursor: default;
}

/* !important for the reason given at .pk-action-create above: .btn-ghost's
   hover would otherwise recolour a destructive action to the accent. */
.pk-action-danger { color: var(--pk-red) !important; }

/* A slot that is a toggle (PK.actionSlot's pressed option) and is on: the
   accent, border and glyph, as a picked .pk-asset tile — the same look
   .btn-ghost's hover has, so "on" reads as the state the hover promised.
   Only the colour changes, so the slot keeps its fixed square. */
.pk-action-slot[aria-pressed="true"] {
  border-color: var(--pk-accent);
  color: var(--pk-accent);
}

/* ─── Small form furniture the user dialogs need ───────────────────────── */

/* Explanatory text under a field. Distinct from the error message
   PK.fieldError produces, which is red, transient and about a rejection —
   this one is permanent and part of the form. */
.pk-field-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--pk-text2);
}

/* A declared user attribute the viewer may see and not change (adr/077):
   its value as text where a control would stand, so nobody takes a
   disabled field for a broken one. */
.pk-attr-readonly {
  min-height: 1.5em;
  padding: 6px 0;
  color: var(--pk-text);
}

/* The address attribute's suggestions: a list under the field, in the flow
   rather than floating, so it scrolls with the dialog and never needs
   placing. The look is the searchable dropdown's options. */
.pk-attr-suggest {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--pk-surface);
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow);
}

.pk-attr-suggest[hidden] { display: none; }

.pk-attr-suggest > li[role="option"] {
  padding: 7px 10px;
  border-radius: calc(var(--pk-radius) - 3px);
  color: var(--pk-text);
  font-size: 13px;
  cursor: pointer;
}

.pk-attr-suggest > li[role="option"]:hover,
.pk-attr-suggest > li.is-active { background: var(--pk-surface2); }

.pk-attr-suggest-note { color: var(--pk-muted); }

.pk-attr-suggest-msg {
  padding: 7px 10px;
  color: var(--pk-muted);
  font-size: 13px;
}

/* A search under way: the spinner row on top, the last answer dimmed
   below it (still pickable — it is not wrong, only maybe not the newest). */
.pk-attr-suggest-busy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pk-attr-suggest > li.is-stale { opacity: 0.55; }

/* A field with a button beside it (password + Generate). The input takes the
   room that is left rather than a fixed width, so the row survives a narrow
   viewport; min-width: 0 is what lets a flex item actually shrink. */
.pk-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pk-input-row > input { flex: 1 1 auto; min-width: 0; }
.pk-input-row > .btn { flex: 0 0 auto; }

/* One row of the organization picker in the delete dialog. The checkbox
   itself is .pk-check (PK.renderCheckbox) and already an inline-flex; this
   only puts each on its own line with room to breathe. */
.pk-checkbox-row { padding: 4px 0; }

/* A consequence worth stopping for, inside a dialog: removing somebody's
   last organization deletes the account. */
.pk-warning {
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--pk-yellow);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
  color: var(--pk-text);
  font-size: 13px;
}

/* A notice on a page: something the reader should keep in mind, said
   kindly — a soft background and a coloured edge, no icon and no red.
   The catalog's note for sub-users is the first (adr/114). */
.pk-notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-left: 4px solid var(--pk-accent);
  border-radius: var(--pk-radius);
  color: var(--pk-text);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.pk-notice p { margin: 0; }
.pk-notice p + p { margin-top: 8px; }
.pk-notice-warning {
  border-left-color: var(--pk-yellow);
  background: var(--pk-yellow-soft);
}

/* A destructive confirm button. The status tokens are dark in the light
   palette and light in the dark one, which is why the text on it is
   --pk-on-filled rather than white — the same reason the method badges and
   the negate button use it. */
.btn-danger {
  background: var(--pk-red);
  border-color: var(--pk-red);
  color: var(--pk-on-filled);
}

/* The user listing's own card header: the deleted-rows toggle and the add
   button, kept together at the right-hand end. Wraps rather than overflows
   on a narrow viewport. */
.pk-users-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* The user dialog's "add to organization" block, for an account that
   belongs to none (adr/098, amended): set off from the account fields above
   by a rule, its sentence a step above the first label. */
.pk-users-addorg {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--pk-border);
}
.pk-users-addorg > .pk-ds-hint {
  margin: 0 0 12px;
}

/* ─── The impersonation banner ─────────────────────────────────────────────
   Drawn by PK.setImpersonation, above the page and any dialog — but under
   the help panel (--pk-z-banner). Generalized from
   llmgateway's .impersonation-banner (theme.css:562-564), with its literal
   colours replaced by this file's status tokens — its version is white on
   var(--red) unconditionally, which is unreadable against a light palette
   where --pk-red is itself dark.

   Nothing here animates: an administrator who has lost track of whose
   account they are looking at is not helped by a transition, and a band
   that slides in would be one more thing to sit through on every page. So
   no duration token, and nothing to add to either reduced-motion block. */

.pk-impersonation-banner {
  position: sticky;
  top: 0;
  z-index: var(--pk-z-banner);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--pk-red);
  /* The status colours are dark in the light palette and light in the dark
     one, so the text on them is --pk-on-filled rather than white — the same
     reason the method badges and the negate button use it. */
  color: var(--pk-on-filled);
  font-family: var(--pk-font);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* A parent acting as its own sub-user (adr/088, PK.setImpersonation's
   tone 'info'): the same band in the informational blue. --pk-on-filled
   reads on it in both themes, like on every status colour. */
.pk-impersonation-banner-info { background: var(--pk-blue); }

.pk-impersonation-text { font-weight: 600; }

/* Readable ON the band rather than beside it: a .btn's own surface colour
   would be a light rectangle in the middle of a red one. */
.pk-impersonation-exit {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--pk-on-filled);
}

.pk-impersonation-exit:hover { background: rgba(255, 255, 255, 0.3); }

/* The focus ring is the page's, but its default colour is --pk-accent, which
   on this band has nothing like enough contrast. Everything focusable needs
   a visible ring (adr/017) and that includes the one control here. */
.pk-impersonation-exit:focus-visible {
  outline: 2px solid var(--pk-on-filled);
  outline-offset: 2px;
}

/* ─── The terms (terms.js, adr/102) ───────────────────────────────────────
   The band while an agreement is missing: the impersonation band's shape
   in the informational blue, with nothing to dismiss — it goes when the
   agreement is given. The same reasoning about motion as above: nothing
   animates, so no token and nothing for the reduced-motion blocks. Never
   drawn while an administrator views as somebody, so the two bands do not
   stand on each other. */
.pk-terms-banner {
  position: sticky;
  top: 0;
  z-index: var(--pk-z-banner);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--pk-blue);
  color: var(--pk-on-filled);
  font-family: var(--pk-font);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.pk-terms-banner-text { font-weight: 600; }
.pk-terms-banner-open {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--pk-on-filled);
}
.pk-terms-banner-open:hover { background: rgba(255, 255, 255, 0.3); }
.pk-terms-banner-open:focus-visible {
  outline: 2px solid var(--pk-on-filled);
  outline-offset: 2px;
}

/* The text, in the dialog and in the editor's preview: a framed box, with
   no height cap and no scroller of its own (0.188.3, .pk-note-body's rule of
   0.161.0). In a dialog the .pk-modal-body around it already scrolls, with
   the title and the buttons outside it; a 50vh box inside that showed two
   scrollbars side by side, each moving half of what the reader wanted moved,
   on a phone as on a desktop. The box to tick follows the text, where it
   belongs: read, then agree. */
.pk-terms-meta { margin: 0 0 8px; font-size: 13px; }
/* PK.termsPersonBox: one member's standing, for an administrator. */
.pk-terms-person { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.pk-terms-person.is-missing { color: var(--pk-red); font-weight: 600; }
.pk-terms-person.is-missing .btn { font-weight: normal; }
.pk-terms-intro { margin: 0 0 12px; color: var(--pk-text); }
.pk-terms-text {
  padding: 12px 16px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
  color: var(--pk-text);
}
.pk-terms-text p { margin: 0 0 10px; }
.pk-terms-text p:last-child { margin-bottom: 0; }
.pk-terms-agree { margin-top: 14px; }

.pk-terms-editor textarea { width: 100%; min-height: 14em; }
.pk-terms-preview-head { margin: 14px 0 6px; font-weight: 600; font-size: 13px; }
.pk-terms-warn { margin: 12px 0; }
.pk-terms-editor-actions { display: flex; justify-content: flex-end; }

/* ─── Context help (help.js, adr/091) ─────────────────────────────────────
   The "?" is one component wherever it stands — the header (.pk-app-help),
   a dialog's frame (.pk-modal-help) — and opens the panel at the right
   edge. The panel is not modal: it stands beside the page or the dialog it
   explains, so both stay readable, and it slides rather than scales. */
.pk-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--pk-border);
  border-radius: 50%;
  background: transparent;
  color: var(--pk-text2);
  font-family: var(--pk-font);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--pk-btn-dur) var(--pk-ease), color var(--pk-btn-dur) var(--pk-ease);
}
.pk-help-btn:hover {
  border-color: var(--pk-accent);
  color: var(--pk-accent);
}

/* In the header it comes after everything — after the empty twin that
   centres the nav (adr/059) too, so the nav stays where it was. */
.pk-app-header > .pk-app-help { order: 1; width: 28px; height: 28px; }

/* At phone width the header's "?" floats (adr/104). On a 375px header the
   title, the burger and the account left it no room — it was pushed past
   the right edge — and no corner of the window is free of something it
   would cover. So it leaves the header's flow and stands at an edge of the
   window, where the reader drags it up and down, to the other side, or
   past the edge to tuck it away as a tab. help.js keeps where it stands in
   --pk-help-fab-x/-y and two data attributes on <html>, not on the button,
   so a header redrawn by a language switch draws it in the same place. The
   fallbacks are its first place: bottom right, above the footer. */
:root {
  --pk-help-fab-size: 48px;
  --pk-help-fab-tab: 18px;
}

@media (max-width: 600px) {
  .pk-app-header > .pk-app-help {
    position: fixed;
    left: 0;
    top: 0;
    z-index: var(--pk-z-help-fab);
    width: var(--pk-help-fab-size);
    height: var(--pk-help-fab-size);
    border-color: var(--pk-border);
    background: var(--pk-surface);
    color: var(--pk-accent);
    font-size: 20px;
    box-shadow: var(--pk-shadow);
    transform: translate(
      var(--pk-help-fab-x, calc(100vw - var(--pk-help-fab-size) - 12px)),
      var(--pk-help-fab-y, calc(100vh - var(--pk-app-footer-h) - var(--pk-help-fab-size) - 12px)));
    /* The finger drags it; the page must not scroll or select instead. */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    transition:
      transform var(--pk-help-fab-dur) var(--pk-ease),
      width var(--pk-help-fab-dur) var(--pk-ease),
      border-radius var(--pk-help-fab-dur) var(--pk-ease),
      opacity var(--pk-help-dur) var(--pk-ease);
  }
  /* Under the finger it follows without lag. */
  html.pk-help-fab-dragging .pk-app-header > .pk-app-help { transition: none; }

  /* Tucked: a tab at the edge in the accent colour, with a grip line.
     Narrow to look at, 44px to hit — the ::before reaches past it. */
  html[data-pk-help-fab-tucked] .pk-app-header > .pk-app-help {
    width: var(--pk-help-fab-tab);
    border-color: var(--pk-accent);
    background: var(--pk-accent);
    color: transparent;
  }
  html[data-pk-help-fab-tucked][data-pk-help-fab-side="right"] .pk-app-header > .pk-app-help {
    border-radius: 10px 0 0 10px;
  }
  html[data-pk-help-fab-tucked][data-pk-help-fab-side="left"] .pk-app-header > .pk-app-help {
    border-radius: 0 10px 10px 0;
  }
  html[data-pk-help-fab-tucked] .pk-app-header > .pk-app-help::before {
    content: "";
    position: absolute;
    inset: -12px -14px;
  }
  html[data-pk-help-fab-tucked] .pk-app-header > .pk-app-help::after {
    content: "";
    width: 3px;
    height: 18px;
    border-radius: 2px;
    background: var(--pk-surface);
  }

  /* Out of the way while the panel it opens is up (at this width it covers
     the window) and while somebody types — the keyboard takes the lower
     half, and the "?" would sit on the field or on its Save. */
  body.pk-help-open .pk-app-header > .pk-app-help,
  body.pk-help-fab-typing .pk-app-header > .pk-app-help {
    opacity: 0;
    pointer-events: none;
  }

  /* With the "?" gone from the line the header fits again; should a long
     installation name still not fit, the title is cut off rather than
     pushing the burger and the account out of the window. adr/059's
     min-width: max-content keeps holding from 601px. */
  .pk-app-header > .pk-app-title,
  body.pk-has-footer .pk-app-header > .pk-app-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }
  .pk-app-title > a { min-width: 0; }
}

.pk-help-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--pk-z-help);
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  width: min(420px, 100vw);
  background: var(--pk-surface);
  color: var(--pk-text);
  border-left: 1px solid var(--pk-border);
  box-shadow: var(--pk-shadow);
  font-family: var(--pk-font);
  transform: translateX(100%);
  transition: transform var(--pk-help-dur) var(--pk-ease);
}
.pk-help-panel.show { display: flex; }
.pk-help-panel.is-open { transform: none; }
.pk-help-panel:focus { outline: none; }

.pk-help-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 20px;
  border-bottom: 1px solid var(--pk-border);
}
.pk-help-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
}
.pk-help-icon-btn {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--pk-radius);
  background: transparent;
  color: var(--pk-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.pk-help-icon-btn:hover { background: var(--pk-surface2); color: var(--pk-text); }
/* The back arrow stands before the title, the ✕ after it. */
.pk-help-head > .pk-help-icon-btn[data-pk-help-back] { margin-left: -8px; }

.pk-help-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 24px;
}

/* The text itself: what the Markdown renders to, sized for a side panel. */
.pk-help-text { font-size: 14px; line-height: 1.55; }
.pk-help-text > :first-child { margin-top: 0; }
.pk-help-text h2 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
.pk-help-text h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.pk-help-text p,
.pk-help-text ul,
.pk-help-text ol,
.pk-help-text blockquote,
.pk-help-text table { margin: 0 0 10px; }
.pk-help-text ul,
.pk-help-text ol { padding-left: 20px; }
.pk-help-text li + li { margin-top: 4px; }
.pk-help-text a { color: var(--pk-accent); }
.pk-help-text code {
  font-size: 13px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--pk-surface2);
}
.pk-help-text blockquote {
  padding: 8px 12px;
  border-left: 3px solid var(--pk-accent);
  background: var(--pk-surface2);
  border-radius: 0 var(--pk-radius) var(--pk-radius) 0;
}
.pk-help-text blockquote > :last-child { margin-bottom: 0; }
.pk-help-text img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px 0 12px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
}
.pk-help-text table { border-collapse: collapse; font-size: 13px; }
.pk-help-text th,
.pk-help-text td { padding: 4px 8px; border: 1px solid var(--pk-border); text-align: left; vertical-align: top; }
.pk-help-text kbd {
  font-family: var(--pk-font);
  font-size: 12px;
  padding: 1px 5px;
  border: 1px solid var(--pk-border);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* Beside a dialog, not over it: where the window is wide enough for both,
   the dialog centres in what the panel leaves free, so its fields and its
   Save stay reachable while the text is read. Narrower, the panel covers
   it and ✕ or Escape gives it back. */
@media (min-width: 1100px) {
  body.pk-help-open .pk-modal-backdrop { padding-right: calc(min(420px, 100vw) + 16px); }
}

/* The #help page: every topic, one per line. */
.pk-help-index { padding: 8px 20px 16px; }
.pk-help-index ul { margin: 0; padding-left: 20px; }
.pk-help-index li { margin: 6px 0; }
.pk-help-index a { color: var(--pk-accent); }

/* ─── The mail templates (web/js/mail-templates.js, adr/096) ──────────────
   The branding screen's "E-Mails" tab and the dialog of one kind of mail.
   Nothing here moves, so neither reduced-motion block needs an entry. */
.pk-mail-heading {
  margin: 20px 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--pk-text);
}

/* When the mail is sent (Kind.DescriptionKey): above the fields of every
   language's tab. */
.pk-mail-when {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-left: 3px solid var(--pk-accent);
  background: var(--pk-surface2);
  border-radius: var(--pk-radius);
}
.pk-mail-when-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--pk-text2);
}
.pk-mail-when .pk-field-hint {
  margin: 2px 0 0;
  color: var(--pk-text);
}

/* The placeholders as chips: a click inserts one where the caret was. */
.pk-mail-placeholders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 12px;
}
.pk-mail-placeholders-title {
  width: 100%;
  font-size: 12px;
  color: var(--pk-text2);
}
.pk-mail-ph {
  padding: 2px 8px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
  color: var(--pk-text);
  font-family: var(--pk-code-font);
  font-size: 12px;
  cursor: pointer;
}
.pk-mail-ph:hover {
  border-color: var(--pk-accent);
  color: var(--pk-accent);
}

.pk-mail-body {
  font-family: var(--pk-code-font);
  font-size: 13px;
}
.pk-mail-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.pk-mail-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.pk-mail-subject {
  color: var(--pk-text2);
}

/* The preview: what the server rendered for the caller. */
.pk-mail-preview {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
}
.pk-mail-preview-title {
  margin: 8px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pk-text2);
}
.pk-mail-preview-title:first-child { margin-top: 0; }
.pk-mail-preview-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.pk-mail-preview-key {
  flex: 0 0 110px;
  color: var(--pk-text2);
}
/* A mail is written for a white page whatever theme the reader uses, as a
   mail program shows it; the frame is that page. */
.pk-mail-frame {
  display: block;
  width: 100%;
  height: 320px;
  margin-top: 10px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-mail-page);
}
.pk-mail-text {
  margin: 10px 0 0;
  padding: 10px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  font-family: var(--pk-code-font);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The pictures for mails (adr/096, amendment v0.127.0): the gallery is a
   PK.assetField; "Bild einfügen" sits at the end of the placeholder chips
   and opens a picker below them. Nothing here moves either. */
.pk-mail-images { margin: 4px 0 8px; }

.pk-mail-placeholders .pk-mail-imgbtn {
  padding: 2px 10px;
  font-size: 12px;
}
/* Usable only where the text is HTML. Kept focusable and hoverable, so the
   tooltip saying why reaches a keyboard and a pointer alike. */
.pk-mail-imgbtn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.pk-mail-imgpick {
  margin: -4px 0 12px;
  padding: 10px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface2);
}
.pk-mail-imgpick-width { max-width: 220px; }
.pk-mail-imgpick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pk-mail-imgpick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 136px;
  padding: 8px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  font-family: var(--pk-font);
  font-size: 11px;
  cursor: pointer;
}
.pk-mail-imgpick-item:hover { border-color: var(--pk-accent); }
.pk-mail-imgpick-item:focus-visible {
  outline: 2px solid var(--pk-accent);
  outline-offset: 2px;
}
.pk-mail-imgpick-name,
.pk-mail-imgpick-size {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.pk-mail-imgpick-name { font-family: var(--pk-code-font); }
.pk-mail-imgpick-size { color: var(--pk-text2); }

/* ─── Wizard, camera, choice list, number wheel (adr/108) ─────────────────
   wizard.js and camera.js. The step bar is a .pk-tabs bar whose pills ahead
   of the first open step are disabled; a done step carries a check. */
.pk-wizard-steps { margin-bottom: 16px; }
.pk-wizard-step[disabled] { color: var(--pk-muted); cursor: default; opacity: 0.6; }
.pk-wizard-step[disabled]:hover { color: var(--pk-muted); }
.pk-wizard-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4em;
  height: 1.4em;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 12px;
  line-height: 1;
}
.pk-wizard-step.is-done .pk-wizard-num { background: var(--pk-green); border-color: var(--pk-green); color: var(--pk-on-filled); }
.pk-wizard-body { min-height: 120px; container: pk-wizard / inline-size; }
/* openWizard's zoom (v0.219.0): the control in the title, and the level on
   the dialog's CONTENT — the frame keeps the window's size, and a vh
   inside is divided by --pk-zoom where it matters. Not on a phone. */
.pk-wizard-title { display: flex; align-items: center; gap: 12px; }
.pk-wizard-title > span:first-child { flex: 1; min-width: 0; }
.pk-wizard-zoom { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; }
.pk-wizard-zoom .btn { min-width: 2.6em; }
.pk-wizard-zoom-level { min-width: 3.4em; text-align: center; font-variant-numeric: tabular-nums; color: var(--pk-text2); font-size: 13px; }
@media (min-width: 641px) {
  .pk-modal[data-pk-zoom="1.25"] { --pk-zoom: 1.25; }
  .pk-modal[data-pk-zoom="1.5"] { --pk-zoom: 1.5; }
  .pk-modal[data-pk-zoom="2"] { --pk-zoom: 2; }
  .pk-modal[data-pk-zoom] > #pkModalContent { zoom: var(--pk-zoom, 1); }
}
@media (max-width: 640px) { .pk-wizard-zoom { display: none; } }
.pk-wizard-actions { display: flex; align-items: center; gap: 8px; }
.pk-wizard-spacer { flex: 1; }

.pk-camera { display: flex; flex-direction: column; gap: 10px; }
/* The view takes the picture's own shape (data-shape, from the video's
   size): an upright phone shows an upright picture, drawn "contain" so the
   preview is what capture() takes. */
.pk-camera-view {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 60vh;
  border-radius: var(--pk-radius);
  overflow: hidden;
  background: var(--pk-camera-bg);
  cursor: crosshair;
}
.pk-camera[data-shape="portrait"] .pk-camera-view { aspect-ratio: 3 / 4; }
.pk-camera-video { width: 100%; height: 100%; object-fit: contain; display: block; }
/* fill: the picture covers the view, no bars; capture() takes the part on
   screen. */
.pk-camera[data-fill] .pk-camera-video { object-fit: cover; }
.pk-camera:not([data-state="live"]) .pk-camera-video { visibility: hidden; }
.pk-camera[data-state="paused"] .pk-camera-video { visibility: visible; }
.pk-camera-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  color: var(--pk-camera-text);
  font-size: 14px;
  line-height: 1.5;
  pointer-events: none;
}
.pk-camera[data-state="live"] .pk-camera-msg { display: none; }
/* Over the picture, in the picture's colours — .pk-camera in front so the
   ghost button's own colour (blue on the dark picture) does not win. */
.pk-camera .pk-camera-switch {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--pk-camera-chip);
  border-color: transparent;
  color: var(--pk-camera-text);
}
/* A tap leaves :hover standing on a touch screen, and .btn-ghost's hover
   colour is the accent — the blue frame and text an iPhone showed. */
.pk-camera .pk-camera-switch:hover:not(:disabled) {
  border-color: var(--pk-camera-text);
  color: var(--pk-camera-text);
}
.pk-camera-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
/* Where a tap asked the camera to focus — left/top written by camera.js,
   the one measured value. */
.pk-camera-focus {
  position: absolute;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 2px solid var(--pk-camera-text);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.pk-camera-focus.is-on { animation: pk-camera-focus var(--pk-camera-focus-dur) var(--pk-ease) forwards; }
@keyframes pk-camera-focus {
  0% { opacity: 1; transform: scale(1.4); }
  40% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
/* The floating shutter: a touch screen only, over the bottom of the
   picture, where a phone's camera app has it. A pointer gets the caller's
   own button beside the picture instead (.pk-hide-coarse on it). */
.pk-camera-shutter { display: none; }
@media (pointer: coarse) {
  .pk-camera-shutter {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 16px;
    box-sizing: border-box;
    width: 72px;
    height: 72px;
    margin-left: -36px;
    padding: 0;
    border: 4px solid var(--pk-camera-text);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
  }
  /* border-box: the 3 px gap is inside the 64 px, or the disc is 70 px
     wide and sits 3 px right and low in the ring (an iPhone, 2026-10-16). */
  .pk-camera-shutter span {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    background: var(--pk-camera-text);
    background-clip: content-box;
  }
  .pk-camera-shutter:active span { transform: scale(0.9); }
  .pk-camera:not([data-state="live"]) .pk-camera-shutter { display: none; }
  .pk-hide-coarse { display: none !important; }
}
/* The barcode strip: wide and low, a line across its middle. */
.pk-camera-compact .pk-camera-view,
.pk-camera-compact[data-shape="portrait"] .pk-camera-view { aspect-ratio: auto; height: 140px; }
.pk-camera-compact .pk-camera-video { object-fit: cover; }
.pk-camera-scanline {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: var(--pk-red);
  pointer-events: none;
}
.pk-barcode-field { display: flex; align-items: center; gap: 6px; }
.pk-barcode-field > :first-child { flex: 1; min-width: 0; }
.pk-barcode-field input { width: 100%; }
/* Beside the field, not inside it: the field's ✕ keeps its corner. */
.pk-barcode-btn {
  flex: none;
  width: 42px;
  height: 38px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: transparent;
  color: var(--pk-text2);
  font-size: 18px;
  cursor: pointer;
}
.pk-barcode-btn:hover,
.pk-barcode-btn[aria-pressed="true"] { color: var(--pk-accent); border-color: var(--pk-accent); background: var(--pk-bg); }
.pk-barcode-btn:focus-visible { outline: 2px solid var(--pk-accent); outline-offset: 2px; }
/* While it reads, the scanner is the same compact strip as everywhere
   else (v0.195.0): the whole width, 140 px high. */
.pk-barcode-strip { margin-top: 8px; }

/* The wizard on the whole screen (PK.openWizard size 'screen'): the
   window's height on a desk, the whole phone on a phone — the camera step
   needs the room. The step scrolls, the bar and the buttons stay. */
.pk-modal-screen { height: min(90vh, 900px); }
/* size 'full': the whole window less a 16px gutter, on a desk too. */
.pk-modal-backdrop-fill { padding: 16px; }
/* border-box: the height is the window less the gutter WITH the dialog's
   own padding — content-box made it 40px taller than the window, and the
   backdrop scrolled the title and the buttons off by that much (v0.219.0). */
.pk-modal-screen.pk-modal-full { box-sizing: border-box; height: calc(100dvh - 32px); max-height: calc(100dvh - 32px); }
.pk-modal-screen #pkModalContent { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pk-modal-screen .pk-modal-body { flex: 1; max-height: none; display: flex; flex-direction: column; }
.pk-modal-screen .pk-wizard-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pk-modal-screen .pk-wizard-panel:not(.hidden) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pk-modal-screen .pk-wizard-panel .pk-camera { flex: 1; min-height: 0; }
/* The element the caller mounted the camera into grows too — whatever it
   is, it stands between the panel and the camera. */
.pk-modal-screen .pk-wizard-panel :has(> .pk-camera:not(.pk-camera-compact)) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pk-modal-screen .pk-wizard-panel .pk-camera:not(.pk-camera-compact) .pk-camera-view { flex: 1; min-height: 200px; max-height: none; aspect-ratio: auto; }
/* The cropper likewise (v0.224.0): its stage takes the height the step
   leaves, so the buttons under it stay in view — a fixed 60vh stage under
   a hint and over the turn buttons and the step's own "Übernehmen" ran
   past the window on a laptop and, with Safari's bars, on an iPhone, where
   the page and the dialog then both scrolled. */
.pk-modal-screen .pk-wizard-panel :has(> .pk-crop) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pk-modal-screen .pk-wizard-panel .pk-crop { flex: 1; min-height: 0; }
.pk-modal-screen .pk-wizard-panel .pk-crop-view { flex: 1 1 0; height: auto; min-height: 200px; }
@media (max-width: 640px) {
  .pk-modal-backdrop-screen, .pk-modal-backdrop-fill { padding: 0; }
  .pk-modal-screen.pk-modal-full { height: 100dvh; max-height: 100dvh; }
  .pk-modal-screen {
    box-sizing: border-box;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }
}

/* A phone on its side has little height left for a camera under a title,
   a step bar and the buttons — the bars of the first test (2026-10-18).
   While the step on screen holds a filling camera, the dialog is the whole
   screen and the camera all of it: the title, the steps, the buttons and
   the step's other lines step aside, the shutter moves to the right edge,
   where a phone's camera app has it. Turned upright, everything is back. */
@media (orientation: landscape) and (max-height: 540px) {
  .pk-modal-backdrop-screen:has(.pk-wizard-panel:not(.hidden) .pk-camera[data-fill]:not([data-fs])) { padding: 0; overflow: hidden; }
  /* The body's 4 px focus-ring margin would stick out of the screen. */
  .pk-modal-screen:has(.pk-wizard-panel:not(.hidden) .pk-camera[data-fill]:not([data-fs])) .pk-modal-body { margin: 0; padding: 0; overflow: hidden; }
  .pk-modal-screen:has(.pk-wizard-panel:not(.hidden) .pk-camera[data-fill]:not([data-fs])) {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  .pk-modal-screen:has(.pk-wizard-panel:not(.hidden) .pk-camera[data-fill]:not([data-fs])) :is(.modal-title, .pk-wizard-steps, .pk-wizard-actions, .pk-modal-help) { display: none; }
  /* The ✕ stays — the one way out without turning the phone — in the
     picture's colours, and "Kamera wechseln" moves to the other corner. */
  .pk-modal-screen:has(.pk-wizard-panel:not(.hidden) .pk-camera[data-fill]:not([data-fs])) .pk-modal-close {
    z-index: 2;
    top: 12px;
    right: calc(12px + env(safe-area-inset-right));
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pk-camera-chip);
    color: var(--pk-camera-text);
  }
  .pk-camera[data-fill]:not([data-fs]) .pk-camera-switch { right: auto; left: 8px; }
  .pk-modal-screen .pk-wizard-panel:not(.hidden):has(.pk-camera[data-fill]:not([data-fs])) > :not(:has(.pk-camera)) { display: none; }
  .pk-modal-screen .pk-wizard-panel .pk-camera[data-fill]:not([data-fs]) { gap: 0; }
  .pk-modal-screen .pk-wizard-panel .pk-camera[data-fill]:not([data-fs]) .pk-camera-tools { display: none; }
  .pk-modal-screen .pk-wizard-panel .pk-camera[data-fill]:not([data-fs]) .pk-camera-view { min-height: 0; border-radius: 0; }
  .pk-camera[data-fill]:not([data-fs]) .pk-camera-shutter { left: auto; right: 20px; bottom: auto; top: 50%; margin: -36px 0 0 0; }
}

/* PK.camera({ fullscreen: true }) on a touch screen: while the picture is
   starting or live, the camera stands on a layer of its own on <body>
   (pk-camera-layer, camera.js' place()) and fills the screen, upright or
   turned, without bars — a box cover photographed upright gets an upright
   frame (the iPhone tests of 2026-10-27). Not position: fixed inside the
   dialog: any ancestor with a transform makes that the dialog's box. ✕ top
   right (pk-camera-fs-close) puts the picture back into its box,
   "Vollbild" (pk-camera-fs-open) opens it again; the gallery sits bottom
   left, "Kamera wechseln" top left — where a phone's camera app has them.
   A pointer screen keeps the box. */
.pk-camera-chip { display: none; }
.pk-camera-layer {
  position: fixed;
  inset: 0;
  z-index: var(--pk-z-camera);
  display: flex;
  background: var(--pk-camera-bg);
}
.pk-camera-layer > .pk-camera { flex: 1; min-width: 0; min-height: 0; gap: 0; }
.pk-camera-layer .pk-camera[data-fs] .pk-camera-view {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
}
.pk-camera-layer .pk-camera-tools { display: none; }
@media (pointer: coarse) {
  .pk-camera-chip {
    position: absolute;
    z-index: 2;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--pk-camera-chip);
    color: var(--pk-camera-text);
    cursor: pointer;
  }
  .pk-camera[data-fs="on"][data-state="live"] :is(.pk-camera-fs-close, .pk-camera-fs-pick),
  .pk-camera[data-fs="on"][data-state="starting"] .pk-camera-fs-close,
  .pk-camera[data-fs="off"][data-state="live"] .pk-camera-fs-open { display: flex; }
  .pk-camera-fs-close { top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); }
  .pk-camera-fs-open { top: 8px; left: 8px; }
  .pk-camera-fs-pick { left: calc(24px + env(safe-area-inset-left)); bottom: calc(30px + env(safe-area-inset-bottom)); width: 48px; height: 48px; }
  .pk-camera[data-fs="on"] .pk-camera-switch { top: calc(12px + env(safe-area-inset-top)); right: auto; left: calc(12px + env(safe-area-inset-left)); }
  .pk-camera[data-fs="on"] .pk-camera-shutter { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) and (orientation: landscape) {
  .pk-camera[data-fs="on"] .pk-camera-shutter { left: auto; right: calc(20px + env(safe-area-inset-right)); bottom: auto; top: 50%; margin: -36px 0 0 0; }
  .pk-camera-fs-pick { left: auto; right: calc(32px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* PK.proposalCard: one proposal, ✓ and ✕ under it, round and large enough
   for a thumb. The countdown is a ring running down on ✓. */
.pk-proposal { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 8px 0; }
.pk-proposal-item { width: 100%; text-align: center; }
.pk-proposal-actions { display: flex; gap: 32px; justify-content: center; }
.pk-proposal-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: var(--pk-surface);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--pk-btn-dur) var(--pk-ease), color var(--pk-btn-dur) var(--pk-ease);
}
/* ✓ is the proposed answer: tinted even before it is hovered or focused,
   so a phone shows which one Enter or a quick tap takes. */
.pk-proposal-yes { color: var(--pk-green); background: color-mix(in srgb, var(--pk-green) 14%, var(--pk-surface)); }
.pk-proposal-no { color: var(--pk-red); }
.pk-proposal-yes:hover, .pk-proposal-yes:focus-visible { background: var(--pk-green); color: var(--pk-on-filled); }
.pk-proposal-no:hover, .pk-proposal-no:focus-visible { background: var(--pk-red); color: var(--pk-on-filled); }
.pk-proposal-btn:focus-visible { outline: 3px solid var(--pk-accent); outline-offset: 3px; }
.pk-proposal-ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.pk-proposal-ring circle {
  fill: none;
  stroke: var(--pk-green);
  stroke-width: 2.5;
  stroke-dasharray: 100.53;
  stroke-dashoffset: 100.53;
}
.pk-proposal-yes.is-counting .pk-proposal-ring circle { animation: pk-proposal-countdown var(--pk-proposal-countdown, 3s) linear forwards; }
@keyframes pk-proposal-countdown { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 100.53; } }

.pk-choice-list { display: flex; flex-direction: column; gap: 8px; }
.pk-choice {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--pk-btn-dur) var(--pk-ease), background-color var(--pk-btn-dur) var(--pk-ease);
}
.pk-choice:hover { border-color: var(--pk-accent); }
.pk-choice.is-selected { border-color: var(--pk-accent); background: color-mix(in srgb, var(--pk-accent) 8%, var(--pk-surface)); }
.pk-choice:focus-visible { outline: 2px solid var(--pk-accent); outline-offset: 2px; }
.pk-choice-mark {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--pk-border);
}
.pk-choice.is-selected .pk-choice-mark { border-color: var(--pk-accent); box-shadow: inset 0 0 0 4px var(--pk-surface); background: var(--pk-accent); }
.pk-choice-img { flex: none; width: 48px; height: 48px; object-fit: contain; border-radius: 4px; background: var(--pk-bg); }
.pk-choice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pk-choice-label { font-weight: 600; overflow-wrap: anywhere; }
.pk-choice-hint { font-size: 13px; color: var(--pk-muted); }

/* PK.pictureChoice — a grid of large pictures, one tapped. Two columns at
   phone width, as many 180 px columns as fit beyond it. */
.pk-picture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--pk-picture-min, 180px), calc(50% - 6px)), 1fr)); gap: 12px; }
.pk-picture {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 8px;
  border: 2px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--pk-btn-dur) var(--pk-ease), background-color var(--pk-btn-dur) var(--pk-ease);
}
.pk-picture:hover { border-color: var(--pk-accent); }
.pk-picture.is-selected { border-color: var(--pk-accent); background: color-mix(in srgb, var(--pk-accent) 10%, var(--pk-surface)); }
.pk-picture:focus-visible { outline: 3px solid var(--pk-accent); outline-offset: 2px; }
.pk-picture-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--pk-bg);
  overflow: hidden;
}
.pk-picture-frame img { width: 100%; height: 100%; object-fit: contain; }
.pk-picture-none .pk-picture-frame { font-size: 40px; color: var(--pk-muted); }
.pk-picture-badge { position: absolute; top: 6px; left: 6px; }
.pk-picture-caption { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.pk-picture-sub { font-size: 12px; color: var(--pk-muted); }
.pk-picture-more .pk-picture-frame { font-size: 32px; font-weight: 700; color: var(--pk-accent); }
/* Groups (items[].section, v0.218.0): a line with its label across the
   grid, and the bar of buttons that jump to them. */
.pk-picture-section {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; scroll-margin-top: 8px;
  font-weight: 700; font-size: 18px; color: var(--pk-text);
}
.pk-picture-section::after { content: ''; flex: 1; border-top: 2px solid var(--pk-border); }
.pk-picture-index { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pk-picture-index-btn {
  min-width: 40px; min-height: 40px; padding: 4px 10px;
  border: 1px solid var(--pk-border); border-radius: 8px;
  background: var(--pk-surface); color: var(--pk-text);
  font-weight: 700; font-size: 16px; cursor: pointer;
}
.pk-picture-index-btn:hover { border-color: var(--pk-accent); }
.pk-picture-index-btn:focus-visible { outline: 3px solid var(--pk-accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .pk-picture-index { flex-wrap: nowrap; overflow-x: auto; }
}
/* The filter above the grid and the action under it (v0.178.0). */
.pk-picture-filter { margin-bottom: 12px; }
.pk-picture-filter-input { width: 100%; }
.pk-picture-empty { margin: 0 0 12px; color: var(--pk-muted); }
.pk-picture-action { margin-top: 12px; }
/* With zoom (v0.177.0) the picture opens PK.imageViewer and the row under
   it is the radio: the tile is a frame for the two, not a button. */
.pk-picture-zoomable { cursor: default; }
.pk-picture-zoom {
  appearance: none;
  width: 100%;
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
}
.pk-picture-zoom:focus-visible { outline: 3px solid var(--pk-accent); outline-offset: 2px; }
.pk-picture-lens {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  pointer-events: none;
}
.pk-picture-pick {
  appearance: none;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 6px 2px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pk-picture-pick .pk-choice-mark { margin-top: 1px; }
.pk-picture-pick:focus-visible { outline: 3px solid var(--pk-accent); outline-offset: 2px; border-radius: 4px; }
.pk-picture.is-selected .pk-picture-pick .pk-choice-mark { border-color: var(--pk-accent); box-shadow: inset 0 0 0 4px var(--pk-surface); background: var(--pk-accent); }
.pk-picture-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.pk-wheel {
  position: relative;
  height: 200px;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  border-radius: var(--pk-radius);
  border: 1px solid var(--pk-border);
  overflow: hidden;
}
.pk-wheel:focus-visible { outline: 2px solid var(--pk-accent); outline-offset: 2px; }
.pk-wheel-track {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.pk-wheel-track::-webkit-scrollbar { display: none; }
.pk-wheel-pad { height: 80px; }
.pk-wheel-item {
  height: 40px;
  line-height: 40px;
  text-align: center;
  scroll-snap-align: center;
  font-size: 18px;
  color: var(--pk-muted);
}
.pk-wheel-item.is-current { color: var(--pk-text); font-weight: 700; font-size: 22px; }
.pk-wheel-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 80px;
  height: 40px;
  border-top: 1px solid var(--pk-accent);
  border-bottom: 1px solid var(--pk-accent);
  pointer-events: none;
}
.pk-wheel-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input.pk-wheel-input { width: 7em; font-size: 20px; text-align: right; }
.pk-wheel-unit { font-size: 18px; }
.pk-wheel-note { color: var(--pk-muted); font-size: 14px; }

/* ─── Cropping a picture (crop.js, adr/116) ──────────────────────────────
   Cropper.js brings its own stylesheet for the frame; this is the host
   around it: a dark stage of a fixed height (Cropper.js needs a sized
   container), the tools under it. */
.pk-crop { display: flex; flex-direction: column; gap: 8px; }
.pk-crop-view {
  position: relative;
  width: 100%;
  height: min(60vh, 480px);
  border-radius: var(--pk-radius);
  overflow: hidden;
  background: var(--pk-camera-bg);
}
/* The picture and its frame stand inset in the stage: a handle at the
   very edge of a phone's screen cannot be held — the left one started
   Safari's swipe back, the top and bottom ones were barely reachable (an
   iPhone, 2026-10-27). */
.pk-crop-stage { position: absolute; inset: 14px; }
.pk-crop-img { display: block; max-width: 100%; }
.pk-crop:not([data-state="ready"]) .pk-crop-img { visibility: hidden; }
.pk-crop-wait {
  position: absolute; inset: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center; color: #fff;
}
.pk-crop[data-state="ready"] .pk-crop-wait { display: none; }
.pk-crop-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pk-crop-tools .btn[data-crop="left"],
.pk-crop-tools .btn[data-crop="right"] { font-size: 1.25rem; min-width: 44px; }
.pk-crop:not([data-state="ready"]) .pk-crop-tools .btn { visibility: hidden; }
.pk-crop-hint { margin: 0; color: var(--pk-muted); font-size: 0.875rem; text-align: center; }
/* Cropper.js's handles are 5 px: too small for a finger. */
.pk-crop .cropper-point { width: 14px; height: 14px; opacity: 0.9; }
.pk-crop .cropper-point.point-se { width: 14px; height: 14px; }
.pk-crop .cropper-point.point-n, .pk-crop .cropper-point.point-s { margin-left: -7px; }
.pk-crop .cropper-point.point-e, .pk-crop .cropper-point.point-w { margin-top: -7px; }
.pk-crop .cropper-point.point-ne, .pk-crop .cropper-point.point-nw { top: -7px; }
.pk-crop .cropper-point.point-se, .pk-crop .cropper-point.point-sw { bottom: -7px; }
.pk-crop .cropper-point.point-ne, .pk-crop .cropper-point.point-se, .pk-crop .cropper-point.point-e { right: -7px; }
.pk-crop .cropper-point.point-nw, .pk-crop .cropper-point.point-sw, .pk-crop .cropper-point.point-w { left: -7px; }
.pk-crop .cropper-point.point-n { top: -7px; }
.pk-crop .cropper-point.point-s { bottom: -7px; }
/* A thumb needs a larger handle and more room around it. */
@media (pointer: coarse) {
  .pk-crop-stage { inset: 28px 34px; }
  .pk-crop .cropper-point, .pk-crop .cropper-point.point-se { width: 22px; height: 22px; }
  .pk-crop .cropper-point.point-n, .pk-crop .cropper-point.point-s { margin-left: -11px; }
  .pk-crop .cropper-point.point-e, .pk-crop .cropper-point.point-w { margin-top: -11px; }
  .pk-crop .cropper-point.point-ne, .pk-crop .cropper-point.point-nw, .pk-crop .cropper-point.point-n { top: -11px; }
  .pk-crop .cropper-point.point-se, .pk-crop .cropper-point.point-sw, .pk-crop .cropper-point.point-s { bottom: -11px; }
  .pk-crop .cropper-point.point-ne, .pk-crop .cropper-point.point-se, .pk-crop .cropper-point.point-e { right: -11px; }
  .pk-crop .cropper-point.point-nw, .pk-crop .cropper-point.point-sw, .pk-crop .cropper-point.point-w { left: -11px; }
}

/* ─── Phone width (adr/110) ───────────────────────────────────────────────
   Below PK.phoneQuery (web/js/viewport.js — the same 600px as the burger
   and the docked help button) a datatable shows rows rather than
   furniture, and the footer shows the two links that must be one tap away.
   Every phone-only element is drawn beside the one it stands in for, at
   every width, and this section picks which of the two is visible — so the
   JS never asks the width to decide what to DRAW, and a rotated phone only
   needs the stylesheet to re-apply.

   At the end of the file on purpose: these rules override the component
   rules above at that width, and source order is the tie-breaker. */

.pk-filter-toggle,
.pk-dt-more,
.pk-action-more,
.pk-dt-pg-short,
.pk-app-footer-more {
  display: none;
}

/* A destructive entry of a PK.createMenu — a row's delete folded into its
   ⋮ — in the colour .pk-action-danger gives the icon it stands in for. */
.pk-menu-item.pk-menu-item-danger { color: var(--pk-red); }

.pk-filter-toggle {
  align-items: center;
  gap: 6px;
}
.pk-filter-toggle svg { flex: none; }
.pk-filter-toggle[aria-expanded="true"] { background: var(--pk-surface2); }

/* The number of active filters. A pill in the accent, because it is the
   one thing on the folded bar that has to be noticed. */
.pk-filter-toggle-count {
  box-sizing: border-box;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--pk-accent);
  color: var(--pk-accent-contrast);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.pk-filter-toggle-count[hidden] { display: none; }

/* Three drawn dots, no frame: a narrow strip at the row's right edge.
   Narrow to the eye, not to the thumb — the button is as tall as a touch
   target and the dots sit in its middle. */
.pk-action-more {
  appearance: none;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--pk-radius);
  background: transparent;
  color: var(--pk-text2);
  cursor: pointer;
}
.pk-action-more svg { fill: currentColor; }
.pk-action-more[aria-expanded="true"] { color: var(--pk-accent); background: var(--pk-surface2); }

/* The footer's "Mehr": dressed as the links beside it, because to the
   reader it is one more of them. */
.pk-app-footer-more {
  appearance: none;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--pk-accent);
  cursor: pointer;
}
.pk-app-footer-more-caret {
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(1px) rotate(-135deg);
}

@keyframes pk-filter-in {
  from { opacity: 0; transform: translateY(calc(-1 * var(--pk-filter-rise))); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pk-dt-swipe-next {
  from { opacity: 0; transform: translateX(var(--pk-swipe-shift)); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pk-dt-swipe-prev {
  from { opacity: 0; transform: translateX(calc(-1 * var(--pk-swipe-shift))); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 600px) {
  /* The filter bar: folded behind its button until that is pressed, then
     one field per line, full width. */
  .pk-filter-bar { padding: 8px 12px; gap: 8px; }
  .pk-filter-toggle { display: inline-flex; }
  .pk-filter-bar:not(.is-open) > :not(.pk-filter-toggle) { display: none; }
  /* `backwards`, never `both`: a transform or opacity animation that keeps
     filling after it ended makes every field a stacking context of its own
     for good, and a panel floating out of one — the searchable dropdown,
     position: fixed with z-index 10002 — gets its z-index only INSIDE it.
     The next field ("Filter löschen") painted over the open list, on a
     phone only, because only here do the fields animate (spieletage,
     2026-11-14). The rule after it lifts the field with an open panel over
     its siblings while the 200 ms still run. */
  .pk-filter-bar.is-open > .pk-filter-item {
    flex: 1 1 100%;
    animation: pk-filter-in var(--pk-filter-open-dur) var(--pk-ease) backwards;
  }
  .pk-filter-bar.is-open > .pk-filter-item:has(.sd-dropdown.open, [aria-expanded="true"]) {
    position: relative;
    z-index: 1;
  }
  .pk-filter-bar.is-open .pk-filter-control-wrap > :not(.pk-filter-negate) { flex: 1 1 auto; min-width: 0; }
  /* A filter declared with a width (filterInputs' `width`) gets it as an
     inline style for a wide bar; on a phone the line is the width. */
  .pk-filter-bar .pk-filter-input { width: 100% !important; box-sizing: border-box; }

  /* Reset, refresh and download fold into the ⋯; auto-refresh is not
     offered at all (datatable.js does not run it at this width either). */
  .pk-dt-tools > :not(.pk-dt-more) { display: none; }
  .pk-dt-tools > .pk-dt-more { display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }

  /* A row's actions fold into its ⋮ — where there are two or more. */
  .pk-action-collapsible .pk-action-slot { display: none; }
  /* And an action that does not apply is not shown at all. Its placeholder
     keeps a desktop's column of icons aligned from row to row; on a phone
     it is a row of greyed icons pushing the data off the screen, around
     the one action somebody can actually take. */
  td.pk-action-cell .pk-action-slot-off { display: none; }
  .pk-action-collapsible .pk-action-more { display: inline-flex; }
  /* Pinned to the right edge: the cell shrinks to the dots and gives up
     its right padding, so they sit where a thumb expects them. */
  table.pk-dt-resizable td.pk-action-collapsible {
    width: 1%;
    padding-left: 0;
    padding-right: 0;
    text-align: right;
  }
  /* The long touch on such a row is the menu's, not the browser's text
     selection or its iOS callout. */
  tr.pk-row-has-menu {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  /* The columns the page let go of. */
  table .pk-phone-hide { display: none; }
  /* An action column left with nothing in it (datatable.js wireRowMenus). */
  table.pk-actions-phone-empty .pk-action-cell { display: none; }

  /* No column dragging on a phone, and no widths dragged on a desktop: the
     saved widths arrive as inline styles on the table and its headers
     (datatable.js applyColWidths) and are sized for a screen three times
     as wide — kept, and back the moment the window is. !important because
     an inline style is what it overrides. */
  table.pk-dt-resizable { width: 100% !important; table-layout: auto; }
  table.pk-dt-resizable > thead th { width: auto !important; }
  .pk-dt-resize-handle { display: none; }
  /* And a cell may wrap. One line per row is a desktop's luxury: on a
     phone a date and a name side by side are what pushes the row past the
     edge, and a sideways scroll is what this section exists to avoid. */
  table.pk-dt-resizable th,
  table.pk-dt-resizable td { padding: 8px; }
  table.pk-dt-resizable > tbody td:not(.pk-action-cell) {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Pagination: "‹ 2 / 7 ›", with thumb-sized arrows, and nothing else. The
     page size is whatever was chosen on a wider screen. */
  .pk-dt-controls { padding: 4px 8px; gap: 4px; }
  .pk-dt-pagesize,
  .pk-dt-filter-info,
  .pk-dt-pg-long { display: none; }
  .pk-dt-pg-short { display: inline; }
  .pk-dt-prev,
  .pk-dt-next {
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    font-size: 22px;
    line-height: 1;
  }
  .pk-dt-page-info { min-width: 48px; }
  /* A single page has nothing to turn, so no band at all. */
  .pk-dt-one-page { display: none; }
  .pk-dt-swipe-next > tr { animation: pk-dt-swipe-next var(--pk-swipe-dur) var(--pk-ease) both; }
  .pk-dt-swipe-prev > tr { animation: pk-dt-swipe-prev var(--pk-swipe-dur) var(--pk-ease) both; }
  .card-scroll:has(.pk-dt-swipe-next, .pk-dt-swipe-prev) { overflow-x: hidden; }

  /* The footer: the imprint and the privacy page stay, the rest is under
     "Mehr" — the account button on the right needs the room. */
  .pk-app-footer-meta > .pk-app-footer-more-link { display: none; }
  .pk-app-footer-more { display: inline-flex; }
  /* Three links on one line, and the account button gives way: its name
     is cut with an ellipsis before "Mehr" is pushed onto a second line of
     a bar whose height is fixed. */
  .pk-app-footer { gap: 8px; }
  .pk-app-footer-meta { flex: none; flex-wrap: nowrap; white-space: nowrap; }
  .pk-app-footer .pk-app-user { flex: 0 1 auto; min-width: 0; }
  .pk-app-footer .pk-usermenu-trigger { min-width: 0; max-width: 100%; }
  .pk-app-footer .pk-usermenu-name { flex: 0 1 auto; min-width: 0; max-width: none; }
}

/* ── Problem reports (web/js/problems.js, adr/115) ───────────────────── */

.pk-problem-backdrop { z-index: var(--pk-z-problem); }
body.pk-problem-open { overflow: hidden; }

.pk-problem-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.pk-problem-chip { position: relative; display: inline-block; }
.pk-problem-chip img {
  width: 72px; height: 72px; object-fit: cover; display: block;
  border-radius: var(--pk-radius); border: 1px solid var(--pk-border);
}
.pk-problem-chip-x {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px;
  border-radius: 50%; border: 1px solid var(--pk-border); background: var(--pk-surface);
  color: var(--pk-text); cursor: pointer; line-height: 1; padding: 0;
}
.pk-problem-add { cursor: pointer; }

.pk-problem-items { display: flex; flex-direction: column; gap: 6px; }
.pk-problem-item { border: 1px solid var(--pk-border); border-radius: var(--pk-radius); padding: 6px 10px; }
.pk-problem-item details summary,
.pk-problem-meta summary { cursor: pointer; color: var(--pk-muted); font-size: 0.9em; overflow-wrap: anywhere; }
.pk-problem-item pre,
.pk-problem-meta pre {
  max-height: 240px; overflow: auto; font-size: 0.85em; white-space: pre-wrap;
  overflow-wrap: anywhere; margin: 6px 0 0;
}

.pk-problem-desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
.pk-problem-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.pk-problem-thumb { padding: 0; border: 1px solid var(--pk-border); border-radius: var(--pk-radius); background: none; cursor: zoom-in; }
.pk-problem-thumb img { width: 96px; height: 96px; object-fit: cover; display: block; border-radius: var(--pk-radius); }
.pk-problem-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pk-problem-comment { border-left: 3px solid var(--pk-border); padding: 4px 0 4px 10px; }
.pk-problem-comment.is-handler { border-left-color: var(--pk-accent); }
.pk-problem-handle { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.pk-problem-handle .form-group { min-width: 200px; flex: 1; }
.pk-problem-handle .pk-problem-handle-save { flex: 0 0 auto; min-width: 0; }
.pk-problem-unread { color: var(--pk-accent); }
.pk-problem-unread-row td:first-child { box-shadow: inset 3px 0 0 var(--pk-accent); }

/* llmgateway's status colours (app.html:15284) in the outlined shape. */
.pk-badge-problem-open { color: var(--pk-accent); border-color: var(--pk-accent); }
.pk-badge-problem-acknowledged,
.pk-badge-problem-in_progress { color: var(--pk-blue); border-color: var(--pk-blue); }
.pk-badge-problem-waiting_for_reporter { color: var(--pk-yellow); border-color: var(--pk-yellow); }
.pk-badge-problem-on_hold,
.pk-badge-problem-wont_fix { color: var(--pk-muted); }
.pk-badge-problem-resolved { color: var(--pk-green); border-color: var(--pk-green); }

/* ── The questionnaires (surveys.js, adr/118) ──────────────────────────
   Drawn for a phone first: one column at the whole width, tap targets of
   at least 44 px, nothing beside a question that a thumb could hit by
   mistake. */
.pk-survey-layer { z-index: var(--pk-z-survey-layer); }
.pk-survey-back { margin-bottom: 8px; }
.pk-survey-h { font-size: 1.05rem; margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.pk-survey-h:first-child { margin-top: 0; }
.pk-survey-none { color: var(--pk-muted); margin: 4px 0 12px; }
.pk-survey-dash { padding: 0 16px 16px; }
.pk-survey-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }
.pk-survey-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  font: inherit;
  text-align: left;
}
.pk-survey-card.is-open { cursor: pointer; border-left: 4px solid var(--pk-accent);
  transition: border-color var(--pk-btn-dur) var(--pk-ease); }
.pk-survey-card.is-open:hover { border-color: var(--pk-accent); }
.pk-survey-card.is-open:focus-visible { outline: 2px solid var(--pk-accent); outline-offset: 2px; }
.pk-survey-card.is-answered,
.pk-survey-card.is-closed { opacity: 0.75; }
.pk-survey-card-title { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
.pk-survey-card-intro { color: var(--pk-muted); overflow-wrap: anywhere; }
.pk-survey-card-meta { font-size: 13px; color: var(--pk-muted); }
.pk-survey-card-go { align-self: flex-start; margin-top: 4px; pointer-events: none; }

.pk-survey-page { padding: 16px; max-width: 46rem; margin: 0 auto; }
.pk-survey-title { font-size: 1.4rem; margin: 4px 0 8px; overflow-wrap: anywhere; }
.pk-survey-intro { margin: 0 0 8px; overflow-wrap: anywhere; }
.pk-survey-privacy { font-size: 13px; color: var(--pk-muted); margin: 0 0 16px; }
.pk-survey-done { padding: 16px; border-radius: var(--pk-radius); background: var(--pk-bg); }
.pk-survey-submit { margin-top: 20px; }
.pk-survey-submit .btn { width: 100%; min-height: 48px; font-size: 1.05rem; }
.pk-survey-thanks { text-align: center; padding: 24px 0; }
.pk-survey-thanks-mark { font-size: 40px; color: var(--pk-green); }

.pk-survey-form { display: flex; flex-direction: column; gap: 18px; }
.pk-survey-q { border: 1px solid var(--pk-border); border-radius: var(--pk-radius); padding: 14px; margin: 0; min-width: 0; }
.pk-survey-q.is-invalid { border-color: var(--pk-red); }
.pk-survey-q-text { font-weight: 600; padding: 0 4px; overflow-wrap: anywhere; }
.pk-survey-q-no { color: var(--pk-muted); }
.pk-survey-optional { font-weight: 400; font-size: 13px; color: var(--pk-muted); }
.pk-survey-q-help { font-size: 14px; color: var(--pk-muted); margin: 4px 0 8px; }
.pk-survey-q-hint { font-size: 13px; color: var(--pk-muted); margin: 0 0 8px; }
.pk-survey-q-input { margin-top: 8px; }
.pk-survey-q-input .form-group { margin: 0; }
.pk-survey-q-input textarea,
.pk-survey-q-input input[type="text"] { width: 100%; }
.pk-survey-q-error { color: var(--pk-red); font-size: 14px; margin-top: 8px; }
.pk-survey-q .pk-choice { min-height: 44px; }
.pk-survey-checks { display: flex; flex-direction: column; gap: 4px; }
.pk-survey-checks .pk-check { min-height: 44px; display: flex; align-items: center; }

/* PK.scaleInput: the points as one row of equal buttons, wrapping on a
   narrow phone rather than shrinking below a finger. */
.pk-scale { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-scale-point {
  appearance: none;
  flex: 1 1 0;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  background: var(--pk-surface);
  color: var(--pk-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--pk-btn-dur) var(--pk-ease), background-color var(--pk-btn-dur) var(--pk-ease);
}
.pk-scale-point:hover { border-color: var(--pk-accent); }
/* A single choice as a scale: the same row, with words or emojis in it. */
.pk-scale-choices .pk-scale-point { padding: 6px 8px; line-height: 1.25; overflow-wrap: break-word; }
.pk-scale-words .pk-scale-point { flex: 1 1 7rem; }
.pk-scale-point.is-selected { border-color: var(--pk-accent); background: var(--pk-accent); color: var(--pk-accent-contrast); }
.pk-scale-point:focus-visible { outline: 2px solid var(--pk-accent); outline-offset: 2px; }
.pk-scale-slider { flex-wrap: nowrap; align-items: center; gap: 12px; }
.pk-scale-slider input[type="range"] { flex: 1; min-height: 44px; accent-color: var(--pk-accent); }
.pk-scale-slider input[type="range"][data-unset] { opacity: 0.5; }
.pk-scale-out { min-width: 3ch; text-align: right; font-weight: 600; }
.pk-scale-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--pk-muted); margin-top: 6px; }

/* The preview: the window's whole height. The body scrolls, title and button stay. */
.pk-survey-layer-full { padding: 16px; }
.pk-survey-layer-full .pk-modal {
  box-sizing: border-box;
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  max-height: none;
}
.pk-survey-layer-full .pk-modal-body { flex: 1; min-height: 0; max-height: none; }
@media (max-width: 640px) {
  .pk-survey-layer-full { padding: 0; }
  .pk-survey-layer-full .pk-modal {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }
}

/* The editor. */
.pk-survey-editor .pk-survey-h:first-child { margin-top: 0; }
.pk-survey-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0 12px; }
.pk-survey-pw { display: flex; gap: 8px; }
.pk-survey-pw input { flex: 1; min-width: 0; }
.pk-survey-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 12px; }
.pk-survey-link-url { font-family: monospace; font-size: 13px; overflow-wrap: anywhere; }
.pk-survey-add { margin-top: 12px; }
.pk-sq-edit { border: 1px solid var(--pk-border); border-radius: var(--pk-radius); padding: 12px; margin-bottom: 12px; background: var(--pk-surface); }
.pk-sq-edit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pk-sq-edit-no { font-weight: 600; color: var(--pk-muted); }
.pk-sq-edit-kind { flex: 1; min-width: 0; max-width: 260px; }
.pk-sq-edit-tools { margin-left: auto; display: flex; gap: 2px; }
.pk-sq-options { margin-bottom: 12px; }
.pk-sq-options > label { display: block; margin-bottom: 4px; }
.pk-sq-option { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.pk-sq-option > input { flex: 1 1 12rem; min-width: 0; }
.pk-sq-option-label { flex: 1 1 100%; margin-bottom: 6px; }
.pk-sq-option-label input { width: 100%; }
.pk-survey-opt-text { margin: 4px 0 8px; }
.pk-survey-opt-text input { width: 100%; }
.pk-survey-opt-texts { font-size: 14px; margin: 12px 0 4px; }
.pk-sq-row { display: flex; flex-wrap: wrap; gap: 0 12px; }
.pk-sq-row > .form-group { flex: 1 1 160px; }
.pk-sq-row > .pk-sq-narrow { flex: 0 1 110px; }

/* The results. */
.pk-survey-summary { color: var(--pk-muted); margin: 0 0 8px; }
.pk-survey-result { margin-top: 20px; }
.pk-survey-mean { font-weight: 600; margin: 6px 0; }
.pk-survey-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pk-survey-bar { display: grid; grid-template-columns: minmax(0, 14rem) 1fr auto; gap: 10px; align-items: center; }
.pk-survey-bar-label { overflow-wrap: anywhere; }
.pk-survey-bar-track { height: 12px; border-radius: 6px; background: var(--pk-bg); overflow: hidden; }
.pk-survey-bar-fill { display: block; height: 100%; width: var(--pk-bar, 0%); background: var(--pk-accent); }
.pk-survey-bar-n { font-size: 13px; color: var(--pk-muted); white-space: nowrap; }
.pk-survey-text-cell { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .pk-survey-bar { grid-template-columns: 1fr auto; }
  .pk-survey-bar-label { grid-column: 1 / -1; }
}

/* The QR code: black on white whatever the theme — it is for paper. */
.pk-survey-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.pk-survey-qr-img { width: min(320px, 80vw); background: #fff; padding: 8px; border-radius: var(--pk-radius); }
.pk-survey-qr-img img { display: block; width: 100%; height: auto; }
.pk-survey-qr-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.pk-badge-survey-draft { color: var(--pk-muted); }
.pk-badge-survey-upcoming { color: var(--pk-blue); border-color: var(--pk-blue); }
.pk-badge-survey-open { color: var(--pk-green); border-color: var(--pk-green); }
.pk-badge-survey-closed { color: var(--pk-muted); }
