/*
  The generic blocks' styles. ⛔ Tokens only (Admin-UX section 7): every colour and size is a custom property the shell's
  token stylesheet defines, so a theme restyles a block without knowing this file.
*/

/* A block that could not be drawn. ⛔ Never an empty space. */
.psx-block-placeholder { padding: var(--space-3) var(--space-4); border: var(--size-border) dashed var(--color-border);
  border-radius: var(--size-radius); background: var(--color-surface); }
.psx-block-placeholder p { margin: var(--space-1) 0 0; color: var(--color-text-muted); }
.psx-block-placeholder-disabled { border-style: solid; background: var(--color-surface-sunk); }

/* Read by a screen reader, not shown — the blocks' own, so a block on a public page needs nothing from the admin's styles. */
.psx-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; }

/* The Data Grid's filter bar and commands (decisions 273, 274). */
.psx-grid-filters { display: grid; gap: var(--space-2); }
.psx-grid-filter-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; font-size: var(--font-size-small); }
.psx-grid-filter { display: inline-flex; gap: var(--space-1); align-items: baseline; padding: 0 var(--space-2); background: var(--color-surface-sunk);
  border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius); }
.psx-grid-filter a { text-decoration: none; }
.psx-grid-filter-add { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; font-size: var(--font-size-small); }
.psx-grid-filter-problem { margin: 0; color: var(--color-bad, var(--color-text)); font-size: var(--font-size-small); }
.psx-grid-commands { white-space: nowrap; }
.psx-grid-command-form { display: inline; }
.psx-grid-command { font: inherit; font-size: var(--font-size-small); margin-right: var(--space-2); color: var(--color-accent); background: none;
  border: none; padding: 0; cursor: pointer; text-decoration: underline; }
.psx-grid-command[aria-disabled="true"] { color: var(--color-text-muted); cursor: not-allowed; text-decoration: none; }
.psx-grid-dialog { width: min(40rem, 95vw); max-height: 90vh; overflow: auto; padding: var(--space-4); border: var(--size-border) solid var(--color-border);
  border-radius: var(--size-radius); background: var(--color-surface); color: var(--color-text); }
.psx-grid-dialog::backdrop { background: rgb(0 0 0 / 0.4); }

/* The Data Grid. */
.psx-grid { display: grid; gap: var(--space-2); }
.psx-grid-toolbar { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); }
.psx-grid-caption { margin: 0 auto 0 0; font-size: var(--font-size-body); font-weight: var(--font-weight-strong); }
.psx-grid-count { color: var(--color-text-muted); font-size: var(--font-size-small); }
.psx-grid-tool { font-size: var(--font-size-small); cursor: pointer; color: var(--color-accent); }
/* The chooser drops down from the toolbar's right edge, so it never leaves a narrow screen. */
.psx-grid-chooser:not([open]) form { display: none; }
.psx-grid-chooser form { position: absolute; right: 0; top: 100%; z-index: 1; display: grid; gap: var(--space-2); width: min(16rem, 100%);
  padding: var(--space-3); background: var(--color-surface); border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius); }
.psx-grid-chooser fieldset { margin: 0; padding: 0; border: none; display: grid; gap: var(--space-1); }
.psx-grid-chooser legend { font-size: var(--font-size-small); color: var(--color-text-muted); margin-bottom: var(--space-1); }

/* ⚠ The table scrolls inside its own box, so the page never scrolls sideways at phone width; the header stays in view. */
.psx-grid-scroll { overflow: auto; max-height: 70vh; background: var(--color-surface); border: var(--size-border) solid var(--color-border);
  border-radius: var(--size-radius); }
.psx-grid-table { width: 100%; border-collapse: collapse; }
.psx-grid-table th, .psx-grid-table td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top;
  border-bottom: var(--size-border) solid var(--color-border); }
.psx-grid-compact .psx-grid-table th, .psx-grid-compact .psx-grid-table td { padding: var(--space-1) var(--space-2); font-size: var(--font-size-small); }
.psx-grid-table th { position: sticky; top: 0; background: var(--color-surface-sunk); font-size: var(--font-size-small);
  color: var(--color-text-muted); font-weight: var(--font-weight-strong); white-space: nowrap; }
.psx-grid-table th a { color: inherit; text-decoration: none; }
.psx-grid-table th a:hover { color: var(--color-accent-strong); }
.psx-grid-table tbody tr:last-child td { border-bottom: none; }
/* ⭐ U5 (Admin-Usability §4): long text wraps at word boundaries — a row grows to as many lines as its longest value needs. */
.psx-grid-table td { overflow-wrap: break-word; }
.psx-grid-density { display: inline-flex; gap: var(--space-2); align-items: baseline; font-size: var(--font-size-small); color: var(--color-text-muted); }
.psx-grid-density a[aria-current="true"] { color: var(--color-text); font-weight: var(--font-weight-strong); text-decoration: none; }
/* ⭐ U5: one line per row — a fixed layout, so a column keeps its width and a long value is cut short (its whole value is in Details). */
.psx-grid-oneline .psx-grid-table { table-layout: fixed; }
.psx-grid-oneline .psx-grid-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psx-grid-oneline .psx-grid-table td.psx-grid-commands { overflow: visible; text-overflow: clip; }
.psx-grid-oneline .psx-grid-table td:first-child .psx-grid-detail { display: inline; margin-left: var(--space-2); }
.psx-grid-oneline .psx-grid-table td:first-child .psx-grid-detail > summary { display: inline; }
/* ⭐ U5: a column's declared minimum (DataGridColumn.MinWidth), in steps — ⛔ a class, never a style attribute (style-src 'self'). */
.psx-grid-min-4 { min-width: 4rem; } .psx-grid-min-6 { min-width: 6rem; } .psx-grid-min-8 { min-width: 8rem; }
.psx-grid-min-10 { min-width: 10rem; } .psx-grid-min-12 { min-width: 12rem; } .psx-grid-min-16 { min-width: 16rem; }
.psx-grid-min-20 { min-width: 20rem; } .psx-grid-min-24 { min-width: 24rem; } .psx-grid-min-32 { min-width: 32rem; }
/* ⭐ U5: drag a header's right edge to size its column (blocks-grid.js adds the handle; ← → by keyboard, double-click to reset). */
.psx-grid-resize { position: absolute; top: 0; right: 0; width: 0.5rem; height: 100%; cursor: col-resize; touch-action: none; }
.psx-grid-resize:hover, .psx-grid-resize:focus-visible { background: var(--color-accent); opacity: 0.5; outline: none; }
.psx-grid-sized .psx-grid-table { table-layout: fixed; }
.psx-grid-sized .psx-grid-table td { overflow: hidden; }
.psx-grid-num { text-align: right; font-variant-numeric: tabular-nums; }
.psx-grid-table code { font-family: var(--font-family-mono); font-size: var(--font-size-small); }
.psx-grid-empty { color: var(--color-text-muted); text-align: center; padding: var(--space-6) var(--space-4); }

.psx-grid-detail summary { font-size: var(--font-size-small); color: var(--color-accent); cursor: pointer; }
/* ⭐ The detail is its own full-width row, shown while its row's Details is open (owner, 2026-11-10: in the first cell it wrapped one character
   per line). Label over value, as many across as fit; long values wrap at words. */
.psx-grid-detail-row { display: none; }
.psx-grid-table tr:has(.psx-grid-detail[open]) + .psx-grid-detail-row { display: table-row; }
.psx-grid-table tr:has(.psx-grid-detail[open]) > td { border-bottom: none; }
.psx-grid-detail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--space-2) var(--space-4);
  margin: 0; padding: var(--space-2) 0; font-size: var(--font-size-small); }
.psx-grid-detail-list dt { color: var(--color-text-muted); }
.psx-grid-detail-list dd { margin: 0; overflow-wrap: break-word; }

.psx-grid-pager { display: flex; gap: var(--space-3); align-items: baseline; font-size: var(--font-size-small); }

/*
  ⭐ U3 (Admin-Usability §5): at a phone's width each row is a CARD — its first column as the title, every other value under its column's
  name (data-label), its commands along the bottom, touch-sized. ⚠ A media query, not a container query: a container query needs the grid
  to be a size container, and one placed in a flex row would then shrink to nothing. The header row stays for screen readers.
*/
@media (max-width: 40rem) {
  .psx-grid-scroll { overflow: visible; max-height: none; background: none; border: none; border-radius: 0; }
  .psx-grid-table, .psx-grid-table tbody { display: block; }
  .psx-grid-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .psx-grid-table tbody tr:not(.psx-grid-detail-row) { display: grid; gap: var(--space-1); margin-bottom: var(--space-2); padding: var(--space-3);
    background: var(--color-surface); border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius); }
  .psx-grid-table tbody td, .psx-grid-compact .psx-grid-table tbody td { display: grid; grid-template-columns: minmax(5rem, 35%) minmax(0, 1fr);
    gap: var(--space-2); padding: 0; border: none; text-align: left; overflow-wrap: anywhere; }
  .psx-grid-table tbody td::before { content: attr(data-label); color: var(--color-text-muted); font-size: var(--font-size-small); }
  .psx-grid-table tbody td:first-child { grid-template-columns: minmax(0, 1fr); font-weight: var(--font-weight-strong); }
  .psx-grid-table tbody td:first-child::before, .psx-grid-table tbody td.psx-grid-commands::before,
    .psx-grid-table tbody td.psx-grid-empty::before { content: none; }
  .psx-grid-table tbody td.psx-grid-empty { display: block; }
  .psx-grid-detail summary { display: inline-block; padding: var(--space-1) 0; font-weight: var(--font-weight-regular); }
  .psx-grid-table tbody td.psx-grid-commands { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); white-space: normal;
    margin-top: var(--space-1); padding-top: var(--space-2); border-top: var(--size-border) solid var(--color-border); }
  .psx-grid-commands .psx-grid-command { display: inline-flex; align-items: center; min-height: var(--size-control); margin-right: 0; }
  .psx-grid-table tr:has(.psx-grid-detail[open]) + .psx-grid-detail-row { display: block; margin: calc(var(--space-2) * -1) 0 var(--space-2);
    padding: 0 var(--space-3) var(--space-2); background: var(--color-surface); border: var(--size-border) solid var(--color-border);
    border-top: none; border-radius: 0 0 var(--size-radius) var(--size-radius); }
  .psx-grid-table tr:has(.psx-grid-detail[open]) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: none; }
  .psx-grid-table tbody .psx-grid-detail-row td { display: block; }
  .psx-grid-pager a { display: inline-flex; align-items: center; min-height: var(--size-control); padding: 0 var(--space-2); }
  /* ⚠ A card has no columns to size, and its values wrap whatever the density says. */
  .psx-grid-oneline .psx-grid-table tbody td, .psx-grid-sized .psx-grid-table tbody td { white-space: normal; overflow: visible; }
  .psx-grid-resize { display: none; }
}

/* A status badge. ⚠ Its word is always written: the tone is never the only signal. */
.psx-badge { display: inline-block; padding: 0 var(--space-2); border-radius: var(--size-radius); font-size: var(--font-size-small);
  font-weight: var(--font-weight-strong); white-space: nowrap; }
.psx-tone-neutral { background: var(--color-tone-neutral-background); color: var(--color-tone-neutral-text); }
.psx-tone-good { background: var(--color-tone-good-background); color: var(--color-tone-good-text); }
.psx-tone-warning { background: var(--color-tone-warning-background); color: var(--color-tone-warning-text); }
.psx-tone-bad { background: var(--color-tone-bad-background); color: var(--color-tone-bad-text); }

/* The user menu. ⚠ A long name is cut off, and on a narrow screen only the initials show: the header's space is the page's. */
.psx-usermenu { position: relative; }
.psx-usermenu > summary { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; list-style: none;
  padding: var(--space-1); border-radius: var(--size-radius); }
.psx-usermenu > summary::-webkit-details-marker { display: none; }
.psx-usermenu > summary:hover { background: var(--color-surface-sunk); }
.psx-usermenu-initials { display: inline-grid; place-items: center; width: var(--size-avatar); height: var(--size-avatar);
  border-radius: 50%; background: var(--color-accent); color: var(--color-accent-text); font-size: var(--font-size-small);
  font-weight: var(--font-weight-strong); }
.psx-usermenu-name { max-width: var(--size-name-max); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--font-size-small); }
.psx-usermenu-panel { position: absolute; right: 0; top: 100%; z-index: 2; width: min(var(--size-menu), calc(100vw - var(--space-8)));
  padding: var(--space-3); display: grid; gap: var(--space-2); background: var(--color-surface);
  border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius);
  /* ⚠ A pop-up, not part of the column it sits in: a Container column set to Right must not right-align its items (owner, 2026-11-16). */
  text-align: start; justify-items: stretch; }
.psx-usermenu:not([open]) .psx-usermenu-panel { display: none; }
.psx-usermenu-who { margin: 0; display: grid; overflow-wrap: anywhere; }
.psx-usermenu-who span { color: var(--color-text-muted); font-size: var(--font-size-small); }
.psx-usermenu-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.psx-usermenu-group { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-small); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.psx-usermenu-panel button { font: inherit; background: none; border: none; padding: 0; color: var(--color-accent); cursor: pointer; text-align: left; }
.psx-usermenu-panel button:hover { color: var(--color-accent-strong); text-decoration: underline; }
.psx-usermenu-footer { margin: 0; padding-top: var(--space-2); border-top: var(--size-border) solid var(--color-border);
  color: var(--color-text-muted); font-size: var(--font-size-small); overflow-wrap: anywhere; }
/* ⭐ Show the name (§9m U1): never — only the initials, on every size. Always — the rule below and the sizes sheet stay out of it. */
.psx-usermenu-name-never { display: none; }
/* ⚠ Only when the placement chose no sizes of its own (§9i): then the site's sizes sheet hides the name, and this rule stays out of it. */
@media (max-width: 48rem) {
  .psx-usermenu-name:not(.psx-usermenu-name-sized):not(.psx-usermenu-name-always) { display: none; }
  /* ⛔ On a narrow screen the open panel spans the SCREEN, not its button. The menu is a block placed anywhere in a header, and right-aligned
     to a button in the middle it ran off the left edge (measured 2026-11-05 at 390px: panel -93..195, button 155..195). Fixed with left and
     right insets it fits whatever the button's place; top: auto keeps it where it would sit anyway — just under the button. */
  .psx-usermenu-panel { position: fixed; top: auto; left: var(--space-4); right: var(--space-4); width: auto; }
}

/*
  The Block Workbench (Block-Workbench 3, 5). Tokens only, like everything else here.
  The three widths sit side by side and the ROW scrolls sideways - never the page, and never a frame squeezed to fit, because a
  frame narrower than it says it is would be the one lie this screen cannot afford.
*/
.psx-workbench-widths { display: flex; gap: var(--space-4); align-items: flex-start; overflow-x: auto; padding-bottom: var(--space-2); }
.psx-workbench-width { margin: 0; display: grid; gap: var(--space-1); flex: 0 0 auto; }
.psx-workbench-width figcaption { font-size: var(--font-size-small); color: var(--color-text-muted); }
.psx-workbench-width iframe { border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius);
  background: var(--color-surface); max-width: none; }

/* Inside a frame: the page's own chrome is gone, so the block needs the padding the shell would have given it.
   The colours come from html in admin.css, which the frame loads too - so a frame that lost this rule is still readable. */
.psx-workbench-frame { padding: var(--space-3); }

/* One row of frames per sample: samples down, widths across. */
.psx-workbench-sample-name { margin: var(--space-6) 0 var(--space-1); }
.psx-workbench-sample-name:first-of-type { margin-top: var(--space-4); }

/*
  Composites (docs/design/Block-Composition.md). ⛔ Every declared value is a CLASS, never a style attribute: this site's
  policy is style-src 'self' with no 'unsafe-inline', and a nonce cannot cover a style attribute - so a gap chosen freely
  could not reach the browser at all. ⭐ Which is the design's own rule from the other side: a closed set of values.
*/
.psx-composite { container-type: inline-size; }
.psx-composite > .psx-composite-children { display: flex; }
.psx-composite-row    > .psx-composite-children { flex-direction: row; }
.psx-composite-stack  > .psx-composite-children { flex-direction: column; }
.psx-composite-row    > .psx-composite-children > * { flex: 1 1 0; min-width: 0; }

/* The space scale, one class per step the tokens define. */
.psx-composite-gap-1 > .psx-composite-children { gap: var(--space-1); }
.psx-composite-gap-2 > .psx-composite-children { gap: var(--space-2); }
.psx-composite-gap-3 > .psx-composite-children { gap: var(--space-3); }
.psx-composite-gap-4 > .psx-composite-children { gap: var(--space-4); }
.psx-composite-gap-6 > .psx-composite-children { gap: var(--space-6); }
.psx-composite-gap-8 > .psx-composite-children { gap: var(--space-8); }

/* Alignment. ⚠ baseline lines up the LABELS and stops being right when one wraps; rows lines up label with label AND
   control with control. Measured, not assumed - docs/design/proofs/composite-alignment.html. */
.psx-composite-align-start   > .psx-composite-children { align-items: flex-start; }
.psx-composite-align-center  > .psx-composite-children { align-items: center; }
.psx-composite-align-end     > .psx-composite-children { align-items: flex-end; }
.psx-composite-align-stretch > .psx-composite-children { align-items: stretch; }
.psx-composite-align-baseline > .psx-composite-children { align-items: baseline; }

/* rows: a shared grid, so a wrapped label pushes every control down together rather than only its own. */
.psx-composite-align-rows.psx-composite-row > .psx-composite-children {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  grid-template-rows: [label] auto [control] auto [help] auto; align-items: start; }
.psx-composite-align-rows.psx-composite-row > .psx-composite-children > * {
  display: grid; grid-row: label / help-end; grid-template-rows: subgrid; }

/* The vertical half: a stack shares a LABEL COLUMN instead of rows - the same declaration on the other axis. */
.psx-composite-align-rows.psx-composite-stack > .psx-composite-children {
  display: grid; grid-template-columns: [label] max-content [control] minmax(0, 1fr); }
.psx-composite-align-rows.psx-composite-stack > .psx-composite-children > * {
  display: grid; grid-column: label / control-end; grid-template-columns: subgrid; }

/* ⛔ A container query, never the screen: the same block stacks in a narrow sidebar and does not in the main column. */
@container (max-width: 20rem) { .psx-composite-stack-narrow > .psx-composite-children { flex-direction: column; } }
@container (max-width: 28rem) { .psx-composite-stack-medium > .psx-composite-children { flex-direction: column; } }
@container (max-width: 48rem) { .psx-composite-stack-wide   > .psx-composite-children { flex-direction: column; } }

/* ⚠ A stacked row abandons the shared grid: rows across a column would line up nothing. */
@container (max-width: 20rem) { .psx-composite-stack-narrow.psx-composite-align-rows > .psx-composite-children { display: flex; } }
@container (max-width: 28rem) { .psx-composite-stack-medium.psx-composite-align-rows > .psx-composite-children { display: flex; } }
@container (max-width: 48rem) { .psx-composite-stack-wide.psx-composite-align-rows   > .psx-composite-children { display: flex; } }

/* ⛔ A placeable block owns its insides and nothing outside them: the composite owns the space between children. */
.psx-composite-children > * { margin: 0; }

/* The record card (decision 280, D2): one record's values, label beside value, and its commands. Below 32rem of space the label sits above. */
.psx-record { display: grid; gap: var(--space-2); container-type: inline-size; }
.psx-record-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); }
.psx-record-caption { margin: 0 auto 0 0; font-size: var(--font-size-body); font-weight: var(--font-weight-strong); }
.psx-record-values { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin: 0; }
.psx-record-values dt { color: var(--color-text-muted); }
.psx-record-values dd { margin: 0; overflow-wrap: anywhere; }
.psx-record-values dd.psx-record-num { font-variant-numeric: tabular-nums; }
.psx-record-missing { margin: 0; color: var(--color-text-muted); }
@container (max-width: 32rem) {
  .psx-record-values { grid-template-columns: minmax(0, 1fr); }
  .psx-record-values dd { margin-bottom: var(--space-2); }
}

/* ⭐ The one builder's look for the screen designer (decision 280, D5b) — the CMS builder's rules, under the psx-b prefix psx-builder.js is told. */
.psx-designer { display: grid; grid-template-columns: minmax(10rem, 14rem) 1fr; gap: var(--space-4); align-items: start; }
.psx-b-palette { position: sticky; top: var(--space-4); padding: var(--space-3); background: var(--color-surface);
    border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius); }
.psx-b-palette h2 { margin: 0 0 var(--space-2); font-size: var(--font-size-body); }
.psx-b-palette ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.psx-b-new { display: block; padding: var(--space-1) var(--space-2); border: var(--size-border) dashed var(--color-border);
    border-radius: var(--size-radius); text-decoration: none; touch-action: none; cursor: grab; user-select: none; }
.psx-b-new:hover, .psx-b-new:focus-visible { border-color: var(--color-accent); }

.psx-b-canvas { display: grid; gap: var(--space-4); min-width: 0; }
.psx-b-zone > h2 { margin: 0 0 var(--space-2); font-size: var(--font-size-small); color: var(--color-text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; }

.psx-b-list { list-style: none; margin: 0; padding: var(--space-2); display: grid; gap: var(--space-2); min-height: 3rem;
    border: var(--size-border) dashed var(--color-border); border-radius: var(--size-radius); background: var(--color-surface-sunk); }
.psx-b-list.psx-b-over { border-color: var(--color-accent); }
.psx-b-inside { margin: var(--space-2); background: var(--color-surface); }
/* C2f: a Container's columns side by side in the builder, each its own drop list. */
.psx-b-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--space-2); }
.psx-b-column { min-width: 0; }
.psx-b-column-name { margin: var(--space-2) var(--space-2) 0; font-size: var(--font-size-small); font-weight: var(--font-weight-strong); }
.psx-b-empty { padding: var(--space-2); color: var(--color-text-muted); font-size: var(--font-size-small); text-align: center; }
.psx-b-active .psx-b-empty { display: none; }

.psx-b-item { background: var(--color-surface); border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius);
    overflow: hidden; }
.psx-b-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2);
    background: var(--color-surface-sunk); border-bottom: var(--size-border) solid var(--color-border); font-size: var(--font-size-small); }
.psx-b-bar .admin-inline { margin: 0; }
.psx-b-name { font-weight: var(--font-weight-strong); margin-right: auto; }
.psx-b-handle { cursor: grab; touch-action: none; font: inherit; line-height: 1; padding: var(--space-1) var(--space-2); }
.psx-b-preview { padding: var(--space-3); font-family: var(--font-family-body); color: var(--color-text); }
.psx-b-problem { margin: 0; padding: var(--space-2) var(--space-3); color: var(--color-danger); }
/* WYSIWYG: an item's audience folds away under its bar, so the drawn block is what the eye lands on. */
.psx-b-audience { padding: 0 var(--space-2); font-size: var(--font-size-small); border-bottom: var(--size-border) solid var(--color-border); }
.psx-b-audience > summary { cursor: pointer; padding: var(--space-1) 0; color: var(--color-text-muted); }
.psx-b-audience .admin-inline { margin: 0 0 var(--space-2); }
.psx-b-record { margin-bottom: var(--space-3); }

/* WYSIWYG form designer: the form drawn, each box a list of what it holds, a row laid out across. */
.psx-f-list[data-axis="x"] { grid-auto-flow: column; grid-auto-columns: minmax(10rem, 1fr); overflow-x: auto; }
.psx-f-box > .psx-f-list { margin: var(--space-2); background: var(--color-surface-sunk); }
.psx-f-tabs > .psx-f-list { grid-auto-flow: column; grid-auto-columns: minmax(12rem, 1fr); }
.psx-f-hidden > .psx-b-preview { opacity: 0.5; }
.psx-f-rename, .psx-f-more { padding: 0 var(--space-2); font-size: var(--font-size-small); }
.psx-f-rename > summary, .psx-f-more > summary { cursor: pointer; padding: var(--space-1) 0; }
.psx-f-rename > summary { font-weight: var(--font-weight-strong); }
.psx-f-more > summary { color: var(--color-text-muted); }
.psx-f-rename .admin-inline, .psx-f-more .admin-inline { margin: 0 0 var(--space-2); }

.psx-b-dragging { opacity: 0.4; }
.psx-b-placeholder { min-height: 2.5rem; border: var(--size-focus) dashed var(--color-accent); border-radius: var(--size-radius); }
.psx-b-ghost { position: fixed; top: 0; left: 0; z-index: 1000; pointer-events: none; padding: var(--space-1) var(--space-3);
    background: var(--color-accent); color: var(--color-accent-text); border-radius: var(--size-radius); font-size: var(--font-size-small); }
.psx-b-active, .psx-b-active * { cursor: grabbing; user-select: none; }
.psx-b-saving { opacity: 0.6; pointer-events: none; }

/* ⭐ The designer kit (decision 286): the same tabs, bar and Properties panel on every surface's designer page. */
.psx-designer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3);
    padding: var(--space-2) var(--space-3); background: var(--color-surface); border: var(--size-border) solid var(--color-border);
    border-radius: var(--size-radius); }
.psx-designer-bar .admin-inline { margin: 0; }
.psx-designer-state { margin: 0 auto 0 0; font-weight: var(--font-weight-strong); }
.psx-designer-tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0 0 var(--space-4);
    border-bottom: var(--size-border) solid var(--color-border); }
.psx-designer-tabs a { padding: var(--space-2) var(--space-4); border: var(--size-border) solid transparent; border-bottom: 0;
    border-radius: var(--size-radius) var(--size-radius) 0 0; color: var(--color-text-muted); text-decoration: none;
    margin-bottom: calc(var(--size-border) * -1); }
.psx-designer-tabs a:hover { color: var(--color-text); }
.psx-designer-tabs a[aria-current="page"] { color: var(--color-accent-strong); font-weight: var(--font-weight-strong);
    background: var(--color-surface); border-color: var(--color-border); border-bottom-color: var(--color-surface); }
.psx-designer-tabs a:focus-visible { outline: var(--size-focus) solid var(--color-focus); outline-offset: 2px; }
.psx-designer-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: var(--space-4); align-items: start; }
/* ⭐ Nothing chosen: the canvas takes the whole width and the panel waits below it — a narrow canvas stacks a Container's columns. */
.psx-designer-work-idle { grid-template-columns: minmax(0, 1fr); }
.psx-designer-work-idle > .psx-designer-props { position: static; }
.psx-designer-props { position: sticky; top: var(--space-4); padding: var(--space-3); background: var(--color-surface);
    border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius); min-width: 0; }
.psx-designer-props > h2 { margin: 0 0 var(--space-2); font-size: var(--font-size-body); }
.psx-designer-width { margin: 0; display: grid; gap: var(--space-1); overflow-x: auto; }
.psx-designer-width figcaption { font-size: var(--font-size-small); color: var(--color-text-muted); }
.psx-designer-width iframe { border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius);
    background: var(--color-background); max-width: none; }
/* A form at a width: a box, because psx-forms.css answers to its container. ⚠ The Workbench's widths (DesignerViews.WidthOf) — a class
   per width, since the site's CSP allows no inline style. */
.psx-designer-box { container-type: inline-size; box-sizing: border-box; padding: var(--space-3); background: var(--color-surface);
    border: var(--size-border) solid var(--color-border); border-radius: var(--size-radius); }
.psx-designer-box-phone { width: 390px; }
.psx-designer-box-tablet { width: 820px; }
.psx-designer-box-desktop { width: 1280px; }

@media (max-width: 48rem) {
    .psx-designer { grid-template-columns: 1fr; }
    .psx-b-palette { position: static; }
    .psx-designer-work { grid-template-columns: 1fr; }
    .psx-designer-props { position: static; }
}

/* Decision 318: a screen's panels, each with its own Refresh (blocks-panels.js; without it, Refresh reloads the page at the panel). */
.psx-panel { margin-block: var(--space-4); }
.psx-panel-bar { display: flex; justify-content: flex-end; gap: var(--space-3); align-items: baseline; font-size: var(--font-size-small); }
.psx-panel-drawn { margin: 0; }
.psx-panel[aria-busy="true"] > :not(.psx-panel-bar) { opacity: 0.6; }
