/* Phase 1 — map / editor split and editor pane chrome */

[data-widget-id="mainContent"].fw-split-pane {
    flex: 1;
    min-height: 0;
    min-width: 0;
}

[data-widget-id="mainContent"] > .fw-split-child[data-pane-id="mapPane"] {
    flex: 0 0 40%;
    max-width: 55%;
    min-width: 220px;
}

[data-widget-id="mainContent"] > .fw-split-child[data-pane-id="editorPane"] {
    flex: 1 1 60%;
    min-width: 280px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 4px 2px 8px 12px;
}

[data-widget-id="mapPane"] {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

[data-widget-id="mapPane"] [data-widget-id="siteMapGraph"] {
    flex: 1 1 auto;
    min-height: 0;
}

[data-widget-id="editorColumn"] {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    gap: 10px;
}

.psp-service-breadcrumb {
    flex: 0 0 auto;
}

.psp-service-breadcrumb__nav {
    display: block;
}

.psp-service-breadcrumb__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.psp-service-breadcrumb__item {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.psp-service-breadcrumb__item::after {
    content: '›';
    margin: 0 6px;
    color: var(--muted, #888);
    font-size: 12px;
}

.psp-service-breadcrumb__item:last-child::after {
    content: none;
}

.psp-service-breadcrumb__btn {
    border: none;
    background: transparent;
    color: var(--accent, #4a8fe8);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
}

.psp-service-breadcrumb__btn:hover {
    background: rgba(74, 143, 232, 0.12);
}

.psp-service-breadcrumb__item--active .psp-service-breadcrumb__btn {
    color: var(--text, #e8e8e8);
    font-weight: 600;
    cursor: default;
}

.psp-service-breadcrumb__item--active .psp-service-breadcrumb__btn:hover {
    background: transparent;
}

.psp-service-breadcrumb__section-badge {
    font-size: 12px;
    color: var(--muted, #888);
    padding: 2px 8px;
    border: 1px solid var(--border, #333);
    border-radius: 999px;
}

.psp-section-banner {
    font-size: 12px;
    color: var(--muted, #888);
    flex: 0 0 auto;
}

.psp-virtual-group-panel {
    flex: 0 0 auto;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border, #333);
    border-radius: 8px;
    background: rgba(155, 89, 182, 0.06);
}

.psp-virtual-group-panel__col {
    flex: 1 1 0;
    min-width: 0;
    gap: 6px;
}

.psp-virtual-group-panel__heading {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted, #888);
    flex: 0 0 auto;
}

[data-widget-id="vgLabelForm"],
[data-widget-id="vgRemoveForm"],
[data-widget-id="vgAddForm"] {
    flex: 0 0 auto;
}

[data-widget-id="vgLabelForm"] .fw-form-sections,
[data-widget-id="vgRemoveForm"] .fw-form-sections,
[data-widget-id="vgAddForm"] .fw-form-sections {
    margin: 0;
}

[data-widget-id="serviceList"] {
    flex: 0 0 auto;
}

.psp-service-tab-bar {
    flex: 0 0 auto;
    border: 1px solid var(--border, #333);
    border-radius: 8px;
    background: var(--bg2, #1a1a22);
    padding: 4px 6px 6px;
}

.psp-service-tab-bar__strip {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
}

.psp-service-tab-bar__empty {
    font-size: 12px;
    color: var(--muted, #888);
    padding: 6px 8px;
}

.psp-service-tab-bar .fw-tab-strip__list {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
}

.psp-service-tab-bar .fw-tab-btn,
.psp-service-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    background: var(--bg3, #1e1e24);
    color: var(--fg-dim, #aaa);
    padding: 5px 10px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.25;
    margin: 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.psp-service-tab-bar .fw-tab-btn:hover,
.psp-service-tab:hover {
    color: var(--text, #e8e8e8);
    border-color: var(--accent, #4a8fe8);
}

.psp-service-tab-bar .fw-tab-btn--active,
.psp-service-tab--active {
    color: var(--text, #e8e8e8);
    border-color: var(--accent, #4a8fe8);
    background: rgba(74, 143, 232, 0.12);
    font-weight: 600;
}

.psp-service-tab__label {
    white-space: nowrap;
}

.psp-class-map-entry-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border, #d8dee4);
    border-radius: 6px;
    background: var(--surface-muted, #f6f8fa);
}

.psp-class-map-entry-bar__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted, #57606a);
}

.psp-class-map-entry-bar__select {
    min-width: 12rem;
    max-width: 100%;
    flex: 1;
    background-color: var(--bg2, #1a1d25);
    border: 1px solid var(--border, #2e3240);
    border-radius: var(--radius, 6px);
    color: var(--text, #cdd6e8);
    font: inherit;
    font-size: 13px;
    padding: 4px 28px 4px 8px;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a84a0'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    transition: border-color 0.12s;
}

.psp-class-map-entry-bar__select:focus {
    border-color: var(--accent, #4a8fe8);
}

.psp-class-map-entry-bar__select option {
    background: var(--bg2, #1a1d25);
    color: var(--text, #cdd6e8);
}

.psp-sync-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.psp-sync-rules__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psp-sync-rules__empty {
    margin: 0;
    font-size: 12px;
    color: var(--muted, #888);
}

.psp-sync-rules__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    background: var(--bg3, #1e1e24);
}

.psp-sync-rules__row--invalid {
    border-color: #c0392b;
}

.psp-sync-rules__field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 0 0 auto;
}

.psp-sync-rules__field--path {
    flex: 2 1 16rem;
    min-width: 14rem;
    max-width: 100%;
}

.psp-sync-rules__field--state {
    flex: 0 0 6.5rem;
    width: 6.5rem;
}

.psp-sync-rules__field-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted, #888);
    line-height: 1.2;
}

.psp-sync-rules__path.fw-text-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    box-sizing: border-box;
    line-height: 1.35;
}

.psp-sync-rules__state.fw-select-input {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
}

.psp-sync-rules__requires {
    font-size: 12px;
    color: var(--muted, #888);
    padding: 0 2px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.psp-sync-rules__del {
    margin-left: auto;
    align-self: center;
}

.psp-sync-rules__warn {
    flex: 1 1 100%;
    font-size: 11px;
    color: #e74c3c;
}

.psp-sync-rules__add {
    align-self: flex-start;
}

[data-widget-id="serviceEditorSlot"] {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Plugin editors mount inside the slot; keep the form scrollable within the pane */
[data-widget-id="serviceEditorSlot"] > .fw-form,
[data-widget-id="serviceEditorSlot"] .fw-form {
    min-height: min-content;
}

[data-widget-id="baseConfigForm"],
[data-widget-id="overrideConfigForm"] {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Embedded in uiFramework editor — Models → registry Config tab */
.fw-registry-config-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fw-registry-embedded-shell {
    flex: 1 1 auto;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.fw-registry-embedded-shell [data-widget-id="mainContent"] {
    flex: 1 1 auto;
    min-height: 220px;
}

.fw-embedded-panel-fragment {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Class-map side panel editor (Roles / Sizes) ─────────────────── */

.psp-classmap-editor {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    width: 100%;
    min-height: 0;
}

.psp-classmap-editor__sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 0;
    max-height: min(72vh, calc(100vh - 220px));
}

.psp-classmap-editor__new-btn {
    flex: 0 0 auto;
    width: 100%;
    justify-content: center;
}

.psp-classmap-editor__new-btn--active {
    border-color: var(--accent, #4a8fe8);
    color: var(--accent, #4a8fe8);
}

.psp-classmap-editor__search {
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border, #2e3240);
    border-radius: 6px;
    background: var(--bg, #12151c);
    color: var(--text, #cdd6e8);
    font: inherit;
    font-size: 13px;
}

.psp-classmap-editor__search::placeholder {
    color: var(--text-dim, #7a84a0);
}

.psp-classmap-editor__search:focus {
    outline: none;
    border-color: var(--accent, #4a8fe8);
}

.psp-classmap-editor__list {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    border: 1px solid var(--border, #2e3240);
    border-radius: 8px;
    background: var(--bg2, #1a1d25);
}

.psp-classmap-editor__list::-webkit-scrollbar {
    width: 8px;
}

.psp-classmap-editor__list::-webkit-scrollbar-thumb {
    background: var(--border, #2e3240);
    border-radius: 4px;
}

.psp-classmap-editor__list::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim, #7a84a0);
}

.psp-classmap-editor__list-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--border, #2e3240);
    background: transparent;
    color: var(--text, #cdd6e8);
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.psp-classmap-editor__list-item:last-child {
    border-bottom: none;
}

.psp-classmap-editor__list-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.psp-classmap-editor__list-item--active {
    background: rgba(74, 143, 232, 0.14);
    box-shadow: inset 3px 0 0 var(--accent, #4a8fe8);
}

.psp-classmap-editor__list-empty {
    margin: 0;
    padding: 14px 12px;
    font-size: 13px;
    color: var(--text-dim, #7a84a0);
    text-align: center;
}

.psp-classmap-editor__list-id {
    font-size: 13px;
    font-weight: 600;
    word-break: break-word;
}

.psp-classmap-editor__move-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.psp-classmap-editor__move-label {
  font-size: 13px;
  color: var(--text-dim, #666);
}

.psp-classmap-editor__move-select {
  min-width: 140px;
  flex: 1 1 120px;
}

.fw-btn--danger,
.psp-classmap-editor .fw-btn--danger {
  background: #c0392b;
  color: #fff;
  border: 1px solid #a93226;
  margin-left: 8px;
}

.fw-btn--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.psp-classmap-editor__detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.psp-classmap-editor__preview-wrap {
    padding: 12px 14px;
    border: 1px solid var(--border, #2e3240);
    border-radius: 8px;
    background: var(--bg2, #1a1d25);
}

.psp-classmap-editor__preview-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim, #7a84a0);
    margin-bottom: 8px;
}

.psp-classmap-editor__preview {
    min-height: 24px;
}

.psp-classmap-editor__form-host .fw-form {
    margin: 0;
}

.psp-classmap-editor__usage-wrap {
    padding: 12px 14px;
    border: 1px solid var(--border, #2e3240);
    border-radius: 8px;
    background: var(--bg2, #1a1d25);
}

.psp-classmap-editor__usage-title {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim, #7a84a0);
}

.psp-classmap-editor__usage-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.psp-classmap-editor__usage-item {
    font-size: 13px;
    color: var(--text, #cdd6e8);
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

.psp-classmap-editor__usage-empty,
.psp-classmap-editor__usage-error {
    margin: 0;
    font-size: 13px;
    color: var(--text-dim, #7a84a0);
}

.psp-classmap-editor__usage-error {
    color: var(--danger, #e85555);
}

.psp-size-preview__row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.psp-size-preview__visual {
    flex: 0 0 auto;
}

.psp-size-preview__size-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 120px;
    min-width: 0;
}

.psp-size-preview__size-list-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    line-height: 1.35;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background 0.12s ease;
}

.psp-size-preview__size-list-id {
    font-weight: 600;
    color: var(--text, #cdd6e8);
    word-break: break-word;
}

.psp-size-preview__size-dimensions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
}

.psp-size-preview__size-dimension {
    color: var(--text-dim, #7a84a0);
    word-break: break-word;
    border-radius: 3px;
    padding: 0 2px;
    margin: 0 -2px;
    transition: background 0.12s ease, color 0.12s ease;
}

.psp-size-preview__size-dimension[data-has-preview="1"] {
    cursor: pointer;
}

.psp-size-preview__size-dimension[data-has-preview="1"]:hover,
.psp-size-preview__size-dimension--active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.psp-size-preview__canvas {
    position: relative;
    display: inline-block;
}

.psp-size-preview__canvas--compact {
    transform-origin: top left;
}

.psp-size-preview__rect {
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    background: transparent;
    border-radius: 2px;
    pointer-events: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.psp-size-preview__rect--highlight {
    border-color: #fff !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 10px rgba(255, 255, 255, 0.25) !important;
    opacity: 1 !important;
    z-index: 1;
}

.psp-size-preview__rect--dimmed {
    opacity: 0.25;
}

.psp-size-preview__keywords,
.psp-size-preview__empty {
    font-size: 12px;
    color: var(--text-dim, #7a84a0);
}

.psp-size-preview__keywords {
    display: block;
    margin-top: 6px;
}

/* ── The test page: a scenario, and the configuration run on it ──────────────── */
/*
 * Same rules as the waterfall editor beside it: the surface's variables for colour, the
 * framework's controls for anything you type into, and nothing restyled here that
 * `fw-field-row`, `fw-text-input`, `fw-select-input`, `fw-toggle` or `fw-btn` already say.
 */

.psp-scenario {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    color: var(--text, #e7ecf3);
}

.psp-scenario__cols {
    display: grid;
    grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.psp-scenario__side,
.psp-scenario__stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.psp-scenario .fw-form-section-body {
    padding: 8px 0;
}

.psp-scenario__note {
    margin: 0 14px 8px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-dim, #8b9bb4);
}

.psp-scenario__note code {
    font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
    color: var(--accent, #3d9cf0);
}

.psp-scenario__cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.psp-scenario__cell > .fw-text-input {
    flex: 1;
    min-width: 0;
}

.psp-scenario__roleName {
    font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
    color: var(--text-dim, #8b9bb4);
}

/* A path the configuration reads and nothing answers. */
.psp-scenario__row--wanted .fw-field-label-text {
    color: var(--danger, #f87171);
}

.psp-scenario__addRow {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 6px 14px 0;
}

.psp-scenario__addRow .fw-text-input {
    flex: 1;
    min-width: 0;
}

.psp-scenario__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border, #2d3a4f);
    border-radius: var(--radius, 6px);
    background: var(--panel, #1a2332);
}

.psp-scenario__checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    flex: 1 1 100%;
}

.psp-scenario__check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.psp-scenario__checkLabel {
    font-size: 11.5px;
    color: var(--text-dim, #8b9bb4);
}

.psp-scenario__status {
    font-size: 11.5px;
    color: var(--text-dim, #8b9bb4);
}

.psp-scenario__frameBody {
    padding: 14px !important;
}

.psp-scenario__frame {
    display: block;
    width: 100%;
    height: 520px;
    border: 1px solid var(--border, #2d3a4f);
    border-radius: var(--radius, 6px);
    background: var(--bg, #0f1419);
}

/*
 * A run of an ad template is a page, and a page is wider than this frame.
 *
 * Twice the size and drawn at half, which renders in exactly the space the frame had: the
 * same scale the ad template canvas uses, so the two show the same arrangement. The
 * element is scaled and the document inside it is not -- inside, the runtime lays out and
 * measures a full-width page the way it would on the site, which is the whole point of
 * running it here. A transform within the page would reach every rect googletag reads.
 *
 * The negative margin is because a scaled element still reserves the space it claimed.
 */
.psp-scenario__frame--half {
    width: 200%;
    height: 1040px;
    transform: scale(0.5);
    transform-origin: top left;
    margin-bottom: -520px;
}

.psp-scenario__states {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 14px;
    font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
    font-size: 11.5px;
    max-height: 260px;
    overflow: auto;
}

.psp-scenario__states--bad,
.psp-scenario__state--bad {
    color: var(--danger, #f87171);
    white-space: pre;
}

.psp-scenario__log {
    height: 260px;
    overflow: auto;
    margin: 0 14px;
    border: 1px solid var(--border, #2d3a4f);
    border-radius: var(--radius, 6px);
    background: var(--bg, #0f1419);
    padding: 8px 10px;
    font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
    font-size: 11px;
    line-height: 1.45;
}

.psp-scenario__line {
    white-space: pre-wrap;
    word-break: break-word;
}

.psp-scenario__line--warn  { color: var(--warn, #fbbf24); }
.psp-scenario__line--error { color: var(--danger, #f87171); }
.psp-scenario__line--debug { color: var(--text-dim, #8b9bb4); opacity: .7; }

.psp-scenario__htmlPreview {
    font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
    font-size: 11px;
    color: var(--text-dim, #8b9bb4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.psp-scenario__htmlArea {
    display: block;
    width: 100%;
    min-height: 220px;
    box-sizing: border-box;
}

.psp-scenario__wfBar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    padding: 0 14px 8px;
}

.psp-scenario__wfBar .fw-select-input {
    min-width: 160px;
}

.psp-scenario__wfLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 11px;
    color: var(--text-dim, #8b9bb4);
}

.psp-scenario__wfLegendItem {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.psp-scenario__wfSwatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid;
    border-radius: 2px;
    box-sizing: border-box;
}

.psp-scenario__wf {
    overflow: auto;
    max-height: 420px;
    margin: 0 14px 8px;
    border: 1px solid var(--border, #2d3a4f);
    border-radius: var(--radius, 6px);
    background: var(--bg, #0f1419);
    user-select: none;
}

.psp-scenario__wf svg {
    display: block;
}

/* ── The waterfall editor ────────────────────────────────────────────────────── */
/*
 * Everything here reads the surface's own variables (`pspui-adtech-surface` declares
 * --bg, --panel, --border, --text-dim, --accent …), so this page is the colour the page
 * around it is. The controls are the framework's -- fw-text-input, fw-select-input,
 * fw-toggle, fw-btn, fw-field-row -- and none of them is styled again here.
 */

.psp-wf {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    color: var(--text, #e7ecf3);
}

.psp-wf__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--border, #2d3a4f);
    border-radius: var(--radius, 6px);
    background: var(--panel, #1a2332);
}

.psp-wf__barLabel {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-dim, #8b9bb4);
}

.psp-wf__pick {
    display: inline-flex;
    min-width: 210px;
}

.psp-wf__pick .fw-select-input {
    width: 100%;
}

.psp-wf__spacer {
    flex: 1;
}

.psp-wf__status {
    font-size: 11.5px;
    color: var(--text-dim, #8b9bb4);
}

.psp-wf__cols {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.psp-wf__side,
.psp-wf__stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* The section title carries a button on the right in one of these. */
.psp-wf .fw-form-section-title,
.psp-scenario .fw-form-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.psp-wf .fw-form-section-body {
    padding: 8px 0;
}

.psp-wf__note {
    margin: 0 14px 8px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-dim, #8b9bb4);
}

.psp-wf__note code {
    font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
    color: var(--accent, #3d9cf0);
}

.psp-wf__cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.psp-wf__cell > .fw-text-input,
.psp-wf__cell > .fw-select-input {
    flex: 1;
    min-width: 0;
}

/* More than one control to the right of a field: they stay on the row, the field shrinks. */
.psp-wf__beside {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

/* The two controls beside a waterfall variable: whether it is reported on the telemetry
   row, and which History facet keeps it between page loads. */
.psp-wf__persist {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--muted, #8b94a3);
    cursor: pointer;
    white-space: nowrap;
}

/* The facet picker is one of three controls on that line, so it takes the room it needs
   and no more. */
.psp-wf__persist .fw-select-input {
    font-size: 10px;
    padding: 1px 4px;
    max-width: 92px;
}

.psp-wf__addRow {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 6px 14px 0;
}

.psp-wf__addRow .fw-text-input {
    flex: 1;
    min-width: 0;
}

/*
 * The palette is a sibling of the scrolling box, not a child of it.
 *
 * A child would scroll away with the drawing the moment the graph got wider than the
 * pane, which is exactly when somebody is reaching for another node.
 */
.psp-wf__palette {
    flex: 0 0 77px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-self: stretch;
    max-height: 560px;
    overflow-y: auto;
    padding-right: 10px;
    border-right: 1px solid var(--border, #2d3a4f);
}

.psp-wf__paletteGroup {
    margin-top: 8px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-dim, #8b9bb4);
    opacity: .7;
}

.psp-wf__paletteGroup:first-child {
    margin-top: 0;
}

/* One width for all of them, so the column reads as a column. */
.psp-wf__node-add {
    display: block;
    width: 100%;
    justify-content: flex-start;
    font-size: 10.5px;
    padding: 2px 6px;
    text-align: left;
}

/*
 * The canvas is dark because a graph reads better on dark, and it sits in a frame with
 * padding because a drawing flush against its own border looks like a mistake.
 */
.psp-wf__canvasFrame {
    display: flex;
    gap: 12px;
    align-items: stretch;
    border: 1px solid var(--border, #2d3a4f);
    border-radius: var(--radius, 6px);
    background: var(--bg, #0f1419);
    padding: 14px;
}

.psp-wf__canvas {
    flex: 1;
    min-width: 0;
    overflow: auto;
    max-height: 560px;
    user-select: none;
}

.psp-wf__canvas svg {
    display: block;
}

.psp-wf__faults {
    font-size: 11.5px;
    line-height: 1.5;
    padding: 0 2px;
}

.psp-wf__faults--ok  { color: var(--ok, #4ade80); }
.psp-wf__faults--bad { color: var(--danger, #f87171); }

.psp-wf__text {
    min-height: 260px;
    margin: 0 14px;
    width: calc(100% - 28px);
}

/*
 * The drawing itself.
 *
 * SVG text takes no colour from the page, so each of these needs a `fill` of its own --
 * without one it is black, which on a dark canvas is invisible. The `pspui-g*` names are
 * what `nodeGraphView.js` emits, so this is the whole list it writes.
 */
.pspui-gnode {
    cursor: grab;
}

/* The ad template canvas: blocks on a surface, scrolled rather than squeezed. */
.psp-slots-canvas {
    overflow: auto;
    max-height: 60vh;
    border: 1px solid var(--line, #39414f);
    border-radius: 4px;
    background: var(--canvas, #0f1217);
}

/* Removing a position is a question about the document, so it is a button, not a
   gesture on a block. */
.psp-slots-deletes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

/* Running the template is a different kind of act from editing it, so it sits on its
   own line under the positions rather than among them. */
.psp-slots-run {
    margin-top: 10px;
}

/* The GAM key-values a run carries. They belong to the scenario, not to the ad template,
   so they read as a strip under the positions rather than as part of the document. */
.psp-slots-kv {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--muted, #8b94a3);
}

.psp-slots-kv__title {
    flex: 0 0 100%;
}

.psp-slots-kv__pair {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 4px;
    border: 1px solid var(--line, #39414f);
    border-radius: 3px;
    color: var(--fg, #d7dce4);
}

.psp-slots-kv__add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.psp-slots-kv__add .fw-text-input {
    width: 96px;
    font-size: 11px;
    padding: 1px 4px;
}

/* A position whose place on the page is not the operator's to choose: an out-of-page
   role has no size and no position, so the pointer does not offer to move it. */
.pspui-gnode[data-out-of-page] {
    cursor: default;
}

.pspui-gnode:active {
    cursor: grabbing;
}

.pspui-gnode--static,
.pspui-gnode--static:active {
    cursor: default;
}

.pspui-gnode:hover rect {
    filter: brightness(1.35);
}

.pspui-gtitle {
    fill: var(--text, #e7ecf3);
    font: 600 11px var(--mono, ui-monospace, Menlo, Consolas, monospace);
}

.pspui-gsub {
    fill: var(--text-dim, #8b9bb4);
    font: 9.5px var(--mono, ui-monospace, Menlo, Consolas, monospace);
    opacity: .75;
}

.pspui-gport {
    fill: var(--text-dim, #8b9bb4);
    font: 9.5px var(--mono, ui-monospace, Menlo, Consolas, monospace);
}

.pspui-gparam {
    fill: var(--text-dim, #8b9bb4);
    font: 9.5px var(--mono, ui-monospace, Menlo, Consolas, monospace);
    opacity: .8;
}

/* Its `fill` is the wire's own colour, set on the element, so only the font is here. */
.pspui-gwirelabel {
    font: 9px var(--mono, ui-monospace, Menlo, Consolas, monospace);
    opacity: .85;
}

.pspui-gwire {
    transition: opacity .08s, stroke-width .08s;
}

/* What a wire carried, written above the socket name it lands on. */
.pspui-gwirevalue {
    font: 600 9px var(--mono, ui-monospace, Menlo, Consolas, monospace);
}

/* A boolean is the one a person can disagree with, so it is a button. */
.pspui-gwirevalue--togglable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.pspui-gwirevalue--togglable:hover {
    fill: var(--accent, #3d9cf0) !important;
}

/* Blockly needs room; the default modal is too small to wire anything in. */
.psp-wf__exprModal {
    width: min(1100px, 94vw);
    max-width: none;
}

.psp-wf__exprModal .fw-expr-panel-host {
    min-height: 460px;
}

/* A socket is small, so say when the pointer is on one. */
.pspui-gsocket {
    cursor: crosshair;
}

.pspui-gsocket:hover {
    stroke: var(--text, #e7ecf3);
    stroke-width: 2;
}

.pspui-gwire-hit {
    cursor: pointer;
}
