/* PXLTAB F6.3 Library UI alignment
   --------------------------------
   Presentation-only adapter from the approved PXLTAB design system to the
   existing Library DOM. It does not own Tag, Recipe, Build, archive, pointer,
   provider, prompt, or persistence behavior. */

.node-system-page #library-view {
  color: var(--pxds-text);
  font-size: var(--pxds-type-min-readable);
}

.node-system-page #library-view *,
.node-system-page #library-view *::before,
.node-system-page #library-view *::after { box-sizing: border-box; }

.node-system-page #library-view :is(button, input, select, textarea, summary) {
  font: inherit;
}

.node-system-page #library-view :is(button, summary, [role="button"]) {
  transition: background-color var(--pxds-motion-fast) ease,
    border-color var(--pxds-motion-fast) ease,
    color var(--pxds-motion-fast) ease,
    box-shadow var(--pxds-motion-fast) ease,
    transform var(--pxds-motion-fast) ease;
}

.node-system-page #library-view :is(button, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--pxds-brand);
  outline-offset: 2px;
}

.node-system-page #library-view :is(p, small, span, em, label, code, pre, dt, dd, li) {
  font-size: max(10px, 1em);
}

.node-system-page #library-view :is(code, pre) {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.node-system-page #library-view .library-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;
}

/* Three visible layer maximum: page -> section -> control/card. */
.node-system-page #library-view :is(
  .library-rule,
  .library-health,
  .library-scope,
  .library-categories-panel,
  .library-workspace
) {
  border: 1px solid var(--pxds-border);
  border-radius: 16px;
  color: var(--pxds-text);
  background: var(--pxds-surface-1);
  box-shadow: var(--pxds-shadow-layer-1);
}

.node-system-page #library-view .library-rule {
  min-height: 58px;
  padding: 14px 16px;
}

.node-system-page #library-view .library-rule small,
.node-system-page #library-view .library-health summary small,
.node-system-page #library-view .library-scope > div > small,
.node-system-page #library-view .library-section-heading small {
  color: var(--pxds-text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.node-system-page #library-view .library-rule strong,
.node-system-page #library-view .library-health summary strong {
  color: var(--pxds-text);
  font-size: 13px;
}

.node-system-page #library-view .library-health > summary {
  min-height: 58px;
  padding: 14px 16px;
  border-radius: inherit;
}

.node-system-page #library-view .library-health > summary:hover,
.node-system-page #library-view .library-health > summary:focus-visible {
  background: var(--pxds-hover-surface);
}

.node-system-page #library-view .library-health > summary em {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--pxds-border);
  border-radius: 999px;
  color: var(--pxds-text-muted);
  background: var(--pxds-surface-2);
  font-size: var(--pxds-type-status);
  font-style: normal;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

.node-system-page #library-view .library-health > summary em.is-healthy {
  border-color: color-mix(in srgb, var(--pxds-brand) 55%, var(--pxds-border));
  color: var(--pxds-brand);
}

.node-system-page #library-view .library-health-content {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--pxds-border);
  color: var(--pxds-text-muted);
  background: transparent;
}

.node-system-page #library-view .library-scope {
  padding: 16px;
}

.node-system-page #library-view .library-scope h2 {
  margin: 5px 0 0;
  color: var(--pxds-text);
  font-size: 18px;
}

.node-system-page #library-view .library-surface-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  width: min(720px, 62%);
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.node-system-page #library-view .library-surface-button {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--pxds-border);
  border-radius: 10px;
  color: var(--pxds-text-muted);
  background: var(--pxds-surface-2);
  font-size: var(--pxds-type-choice);
  font-weight: 750;
  text-align: center;
  cursor: pointer;
}

.node-system-page #library-view .library-surface-button:hover:not(.is-active) {
  border-color: var(--pxds-border-strong);
  color: var(--pxds-text);
  background: var(--pxds-hover-surface);
  transform: translateY(-1px);
}

.node-system-page #library-view .library-surface-button.is-active {
  border-color: color-mix(in srgb, var(--pxds-brand) 64%, var(--pxds-border));
  color: #fff;
  background: var(--pxds-brand-fill);
  box-shadow: var(--pxds-shadow-layer-3);
}

.node-system-page #library-view .library-categories-panel { padding: 16px; }
.node-system-page #library-view .library-section-heading h2 { color: var(--pxds-text); font-size: 16px; }

.node-system-page #library-view .library-category-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.node-system-page #library-view .library-category-button {
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--pxds-border);
  border-radius: 11px;
  color: var(--pxds-text-muted);
  background: var(--pxds-surface-2);
}

.node-system-page #library-view .library-category-button:hover:not(.is-active) {
  border-color: var(--pxds-border-strong);
  background: var(--pxds-hover-surface);
  transform: translateY(-1px);
}

.node-system-page #library-view .library-category-button strong {
  color: var(--pxds-text);
  font-size: 12px;
}

.node-system-page #library-view .library-category-button span {
  color: var(--pxds-text-muted);
  font-size: 10px;
}

.node-system-page #library-view .library-category-button.is-active {
  border-color: transparent;
  color: #ffffff;
  background: var(--pxds-brand-fill);
  box-shadow: var(--pxds-shadow-layer-1);
}

.node-system-page #library-view .library-category-button.is-active :is(strong, span) {
  color: #ffffff;
}

.node-system-page #library-view .library-workspace {
  overflow: visible;
}

.node-system-page #library-view .library-toolbar {
  min-height: 60px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pxds-border);
  background: transparent;
}

.node-system-page #library-view .library-toolbar strong {
  color: var(--pxds-text);
  font-size: 15px;
}

.node-system-page #library-view .library-search-label {
  position: relative;
  display: block;
  width: min(320px, 42vw);
}

.node-system-page #library-view .library-search-label input,
.node-system-page #library-view :is(input[type="search"], input[type="text"], textarea, select) {
  min-height: 38px;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--pxds-border);
  border-radius: 9px;
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
  font-size: 11px;
}

.node-system-page #library-view :is(input, textarea)::placeholder { color: var(--pxds-text-subtle); }

.node-system-page #library-view .library-canvas {
  min-height: 520px;
  overflow: visible;
  border-radius: 0 0 16px 16px;
  background: var(--pxds-surface-1);
}

.node-system-page #library-view .library-node-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.node-system-page #library-view .library-node-list.is-recipe-workspace {
  display: block;
  padding: 18px;
}

.node-system-page #library-view .library-node-list.is-provider-groups {
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.node-system-page #library-view .f2c-provider-model-group {
  min-width: 0;
}

.node-system-page #library-view .f2c-provider-model-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 0 2px 9px;
  border-bottom: 1px solid var(--pxds-border);
}

.node-system-page #library-view .f2c-provider-model-group > header h3 {
  margin: 0;
  color: var(--pxds-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.node-system-page #library-view .f2c-provider-model-group > header span {
  flex: 0 0 auto;
  color: var(--pxds-text-muted);
  font-size: var(--pxds-type-status);
}

.node-system-page #library-view .f2c-provider-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

/* Shared System and provider cards. */
.node-system-page #library-view .f2c-authority-card {
  border: 1px solid var(--pxds-border);
  border-top: 2px solid var(--pxds-brand);
  border-radius: 12px;
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
  box-shadow: var(--pxds-shadow-layer-3);
}

.node-system-page #library-view .f2c-authority-card > header {
  padding: 14px;
  border-color: var(--pxds-border);
}

.node-system-page #library-view .f2c-authority-card h3 {
  color: var(--pxds-text);
  font-size: 15px;
}

.node-system-page #library-view .f2c-authority-card small {
  color: var(--pxds-text-muted);
  font-size: 10px;
}

.node-system-page #library-view .f2c-authority-card > p {
  padding: 14px;
  color: var(--pxds-text-muted);
  font-size: 11px;
}

.node-system-page #library-view :is(.f2c-read-only, .f2c-usage-badge, .f2c-history-count, .f2c-current-version) {
  border-color: var(--pxds-border);
  color: var(--pxds-text-muted);
  background: var(--pxds-surface-3);
  font-size: var(--pxds-type-status);
  text-transform: none;
}

.node-system-page #library-view :is(.f2c-values, .f2c-advanced, .f2c-version-history) {
  border-color: var(--pxds-border);
}

.node-system-page #library-view :is(.f2c-values, .f2c-advanced, .f2c-version-history) > summary {
  color: var(--pxds-text);
  font-size: 11px;
}

.node-system-page #library-view :is(.f2c-values, .f2c-advanced, .f2c-version-history) > summary:hover {
  color: var(--pxds-brand);
}

.node-system-page #library-view :is(.f2c-r1-value, .f2c-profile-contract, .f2c-version-history-row, .f2c-profile-history-list p) {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: transparent;
  font-size: 10px;
}

.node-system-page #library-view .f2c-r1-value span,
.node-system-page #library-view .f2c-profile-history-list p span,
.node-system-page #library-view .f2c-version-history-row p { color: var(--pxds-text-muted); }

/* Recipe selector and complete recipe workspace. */
.node-system-page #library-view .f2c-r1-recipe-picker {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--pxds-border);
  border-radius: 12px;
  background: var(--pxds-surface-2);
  box-shadow: var(--pxds-shadow-layer-2);
}

.node-system-page #library-view .f2c-r1-recipe-picker label {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(240px, 1fr);
  align-items: center;
  min-height: 38px;
  gap: 12px;
  color: var(--pxds-text);
  font-size: 12px;
  font-weight: 750;
}

.node-system-page #library-view .f2c-r1-recipe-picker label > span {
  align-self: center;
  display: flex;
  align-items: center;
  min-height: 38px;
  color: var(--pxds-brand);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  text-transform: none;
}

.node-system-page #library-view .f2c-r1-recipe-workspace {
  display: grid;
  gap: 14px;
  padding-bottom: 14px;
  background: var(--pxds-surface-1);
}

.node-system-page #library-view .f2c-r1-recipe-workspace > header {
  padding: 15px 16px;
  border-color: var(--pxds-border);
}

.node-system-page #library-view .f2c-r1-recipe-workspace > header h3 { font-size: 17px; }

.node-system-page #library-view :is(
  .f2c-r1-workspace-prompt,
  .f2c-r1-tag-prompt,
  .f2c-r1-build-history,
  .f2c-r1-target-tag-library,
  .f2c-r1-all-tags
) {
  margin: 0 14px;
  border: 1px solid var(--pxds-border);
  border-radius: 11px;
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
  box-shadow: var(--pxds-shadow-layer-3);
  overflow: visible;
}

.node-system-page #library-view :is(
  .f2c-r1-workspace-prompt,
  .f2c-r1-tag-prompt,
  .f2c-r1-build-history,
  .f2c-r1-target-tag-library
) > header,
.node-system-page #library-view .f2c-r1-all-tags > summary {
  min-height: 48px;
  padding: 11px 12px;
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: transparent;
}

.node-system-page #library-view :is(
  .f2c-r1-workspace-prompt,
  .f2c-r1-tag-prompt,
  .f2c-r1-build-history,
  .f2c-r1-target-tag-library
) > header small,
.node-system-page #library-view .f2c-r1-all-tags > summary strong {
  color: var(--pxds-text);
  font-size: 11px;
  font-weight: 750;
  text-transform: none;
}

.node-system-page #library-view :is(
  .f2c-r1-workspace-prompt,
  .f2c-r1-tag-prompt,
  .f2c-r1-build-history,
  .f2c-r1-target-tag-library
) > header strong,
.node-system-page #library-view :is(
  .f2c-r1-workspace-prompt,
  .f2c-r1-tag-prompt,
  .f2c-r1-build-history,
  .f2c-r1-target-tag-library
) > header span,
.node-system-page #library-view .f2c-r1-all-tags > summary b {
  color: var(--pxds-text-muted);
  font-size: 10px;
}

.node-system-page #library-view .f2c-r1-workspace-prompt pre {
  max-height: none;
  margin: 0;
  padding: 14px;
  overflow: visible;
  color: var(--pxds-text);
  background: transparent;
  font-size: 11px;
  line-height: 1.65;
}

.node-system-page #library-view .f2c-r1-tag-prompt > div {
  gap: 8px;
  padding: 10px 12px;
}

.node-system-page #library-view .f2c-r1-tag-prompt-row {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: transparent;
}

.node-system-page #library-view .f2c-r1-tag-prompt-row.is-unbuilt {
  border-color: #b96e27;
  background: color-mix(in srgb, #b96e27 9%, var(--pxds-surface-2));
}

.node-system-page #library-view .f2c-r1-compose-heading strong { color: var(--pxds-text); font-size: 11px; }

.node-system-page #library-view .f2c-r1-composer-tag {
  grid-template-columns: 24px minmax(82px, auto) 64px 32px;
  min-height: 42px;
  padding: 4px 6px 4px 4px;
  border-color: var(--pxds-border-strong);
  color: var(--pxds-text);
  background: var(--pxds-surface-3);
}

.node-system-page #library-view .f2c-r1-composer-tag .pxds-select-trigger,
.node-system-page #library-view .f2c-r1-composer-tag .f2c-r1-icon-button {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  min-height: 32px !important;
  padding: 0 !important;
}

.node-system-page #library-view .f2c-r1-composer-tag .pxds-select-trigger {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  padding: 0 7px !important;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.node-system-page #library-view :is(
  .f2c-r1-composer-tag,
  .f2c-r1-target-tag > header > div:last-child
) .pxds-select-value {
  display: block;
  flex: 1 1 auto;
  min-width: 18px;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

/* Compact version menus paint above their Recipe rows. Overflow is relaxed
   only while a menu is open, so the resting card keeps its rounded clipping. */
.node-system-page #library-view .f2c-r1-recipe-workspace:has(.pxds-select.is-open),
.node-system-page #library-view :is(
  .f2c-r1-tag-prompt,
  .f2c-r1-tag-prompt-row,
  .f2c-r1-target-tag,
  .f2c-r1-target-tag-structure,
  .f2c-r1-all-tags-group
):has(.pxds-select.is-open) {
  overflow: visible;
}

.node-system-page #library-view :is(
  .f2c-r1-composer-tag,
  .f2c-r1-target-tag,
  .f2c-r1-tag-prompt-row,
  .f2c-r1-all-tags-group
):has(.pxds-select.is-open) {
  position: relative;
  z-index: 220;
}

.node-system-page #library-view .pxds-select.is-open,
.node-system-page #library-view .pxds-select.is-open .pxds-select-menu {
  z-index: 240;
}

.node-system-page #library-view .f2c-r1-composer-tag .f2c-r1-icon-button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
}

.node-system-page #library-view .f2c-r1-composer-tag > strong { color: var(--pxds-text); font-size: 10px; }

.node-system-page #library-view .f2c-r1-composer-tag :is(select, button) {
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
}

.node-system-page #library-view .f2c-r1-mini-drag:hover:not(:disabled) {
  border-color: var(--pxds-brand);
  background: var(--pxds-hover-surface);
}

.node-system-page #library-view .f2c-r1-build-history > div,
.node-system-page #library-view .f2c-r1-archived-list > div { padding: 9px; }

.node-system-page #library-view .f2c-r1-build-version,
.node-system-page #library-view .f2c-r1-archived-tag {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-1);
}

.node-system-page #library-view .f2c-r1-build-version.is-selected {
  border-color: color-mix(in srgb, var(--color-success) 72%, var(--pxds-border));
  background: color-mix(in srgb, var(--color-success) 8%, var(--pxds-surface-1));
}

.node-system-page #library-view .f2c-r1-build-select small,
.node-system-page #library-view .f2c-r1-archived-tag p { color: var(--pxds-text-muted); }

.node-system-page #library-view .f2c-r1-archived-list {
  border-color: var(--pxds-border);
}

.node-system-page #library-view .f2c-r1-archived-list > summary {
  min-height: 42px;
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: transparent;
  font-size: 11px;
}

.node-system-page #library-view .f2c-r1-archived-list > summary:hover,
.node-system-page #library-view .f2c-r1-all-tags > summary:hover {
  background: var(--pxds-hover-surface);
}

.node-system-page #library-view .f2c-r1-archived-list[open] > summary,
.node-system-page #library-view .f2c-r1-all-tags[open] > summary {
  border-bottom: 1px solid var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-3);
}

.node-system-page #library-view .f2c-r1-target-tag-library > div,
.node-system-page #library-view .f2c-r1-all-tags > div {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
}

.node-system-page #library-view :is(.f2c-r1-target-tag-structure, .f2c-r1-all-tags-group) {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-1);
}

.node-system-page #library-view :is(.f2c-r1-target-tag-structure, .f2c-r1-all-tags-group) > header {
  border-color: var(--pxds-border);
  background: var(--pxds-surface-3);
}

.node-system-page #library-view :is(.f2c-r1-target-tag-structure, .f2c-r1-all-tags-group) > header :is(h3, strong) {
  color: var(--pxds-text);
  font-size: 12px;
}

.node-system-page #library-view .f2c-r1-target-tag-structure.is-unbuilt {
  border-color: #b96e27;
  background: color-mix(in srgb, #b96e27 7%, var(--pxds-surface-1));
}

.node-system-page #library-view :is(.f2c-r1-target-tag, .f2c-r1-all-tag) {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: transparent;
}

.node-system-page #library-view :is(.f2c-r1-target-tag, .f2c-r1-all-tag) p {
  color: var(--pxds-text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.node-system-page #library-view .f2c-r1-all-tags-search {
  border-color: var(--pxds-border);
}

.node-system-page #library-view .f2c-r1-all-tags-search > span { color: var(--pxds-text); font-size: 10px; }

.node-system-page #library-view .f2c-r1-recipe-actions button,
.node-system-page #library-view .f2c-r1-recipe-workspace button {
  min-height: 34px;
  border-color: var(--pxds-border);
  border-radius: 8px;
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
  font-size: 10px;
}

.node-system-page #library-view .f2c-r1-recipe-workspace button:hover:not(:disabled) {
  border-color: var(--pxds-border-strong);
  background: var(--pxds-hover-surface);
  transform: translateY(-1px);
}

.node-system-page #library-view .f2c-r1-recipe-workspace button.is-primary {
  border-color: var(--pxds-brand);
  color: #fff;
  background: var(--pxds-brand-fill);
}

.node-system-page #library-view .f2c-r1-recipe-workspace button.is-danger,
.node-system-page #library-view .f2c-r1-recipe-workspace button.is-archive {
  border-color: #aa5b67;
  color: #cf485f;
  background: transparent;
}

.node-system-page #library-view .f2c-r1-recipe-workspace button:disabled {
  color: var(--pxds-text-subtle);
  background: var(--pxds-surface-3);
  opacity: .58;
}

.node-system-page #library-view .f2c-advanced code { color: var(--pxds-text-muted); }
.node-system-page #library-view .f2c-empty { border-color: var(--pxds-border); color: var(--pxds-text-muted); }

/* Shared menu component inside Library. */
.node-system-page #library-view .pxds-native-select {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.node-system-page #library-view .pxds-select { width: 100%; }
.node-system-page #library-view .pxds-select-trigger {
  min-height: 38px;
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
  font-size: 11px;
}
.node-system-page #library-view .pxds-select-menu {
  z-index: 60;
  border-color: var(--pxds-border-strong);
  color: var(--pxds-text);
  background: var(--pxds-surface-1);
  box-shadow: var(--pxds-shadow-layer-1);
}
.node-system-page #library-view .pxds-select-option { color: var(--pxds-text); background: transparent; font-size: 11px; }
.node-system-page #library-view .pxds-select-option:hover,
.node-system-page #library-view .pxds-select-option:focus-visible { background: var(--pxds-hover-surface); }

/* Dialogs are appended to body, so their class is the ownership boundary. */
.node-system-page .f2c-r1-dialog {
  border-color: var(--pxds-border-strong);
  color: var(--pxds-text);
  background: var(--pxds-surface-1);
  box-shadow: var(--pxds-shadow-layer-1);
}

.node-system-page .f2c-r1-dialog::backdrop {
  background: rgba(8, 12, 18, .66);
  backdrop-filter: blur(4px);
}

.node-system-page #f2c-r1-dialog-body,
.node-system-page #f2c-r1-notice-body { color: var(--pxds-text); background: var(--pxds-surface-1); }

.node-system-page :is(#f2c-r1-dialog-body, #f2c-r1-notice-body) > header,
.node-system-page :is(#f2c-r1-dialog-body, #f2c-r1-notice-body) footer { border-color: var(--pxds-border); }

.node-system-page :is(#f2c-r1-dialog-body, #f2c-r1-notice-body) :is(input, textarea, select) {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
}

.node-system-page :is(#f2c-r1-dialog-body, #f2c-r1-notice-body) button {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
  font-size: 11px;
}

.node-system-page :is(#f2c-r1-dialog-body, #f2c-r1-notice-body) button:hover:not(:disabled) {
  border-color: var(--pxds-border-strong);
  background: var(--pxds-hover-surface);
}

.node-system-page #f2c-r1-dialog-body button.is-primary {
  border-color: var(--pxds-brand);
  color: #fff;
  background: var(--pxds-brand-fill);
}

.node-system-page .f2c-r1-template-editor,
.node-system-page .f2c-r1-placeholder-menu {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
}

html[data-theme="light"] .node-system-page #library-view :is(
  .library-surface-button,
  .library-category-button,
  .library-search-label input,
  .f2c-authority-card,
  .f2c-r1-recipe-picker,
  .f2c-r1-workspace-prompt,
  .f2c-r1-tag-prompt,
  .f2c-r1-build-history,
  .f2c-r1-target-tag-library,
  .f2c-r1-all-tags,
  .f2c-r1-composer-tag,
  .f2c-r1-target-tag-structure,
  .f2c-r1-all-tags-group,
  .f2c-r1-build-version,
  .f2c-r1-archived-tag
) { background-color: var(--pxds-surface-2); }

html[data-theme="light"] .node-system-page #library-view .f2c-r1-recipe-workspace,
html[data-theme="light"] .node-system-page .f2c-r1-dialog,
html[data-theme="light"] .node-system-page :is(#f2c-r1-dialog-body, #f2c-r1-notice-body) {
  background: var(--pxds-surface-1);
}

/* F6.3 Library interaction consistency. */
.node-system-page #library-view .f2c-r1-expanded-prompt,
.node-system-page #library-view [data-f2c-expanded-prompt] {
  max-height: none;
  overflow: visible;
}

.node-system-page #library-view .f2c-r1-target-tag > header > div:last-child {
  display: grid;
  grid-template-columns: 64px 34px;
  align-items: center;
  gap: 6px;
  padding-right: 5px;
}

.node-system-page #library-view .f2c-r1-target-tag > header > div:last-child .pxds-select-trigger {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  min-height: 34px;
  height: 34px;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.node-system-page #library-view .f2c-r1-target-tag > header > div:last-child > button {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
}

.node-system-page #library-view .f2c-r1-build-version button.is-current,
.node-system-page #library-view .f2c-r1-build-version button.is-current:disabled,
.node-system-page #library-view .f2c-r1-pointer-versions span.is-current {
  border-color: color-mix(in srgb, var(--color-success) 48%, var(--pxds-border));
  color: var(--color-success);
  background: var(--color-success-surface);
  font-weight: 700;
  line-height: 1.2;
  opacity: 1;
}

.node-system-page #library-view .f2c-r1-build-version.is-selected .f2c-r1-build-select {
  border-color: color-mix(in srgb, var(--color-success) 52%, var(--pxds-border));
  color: var(--color-success);
  background: var(--color-success-surface);
}

.node-system-page #library-view .pxds-select-option.is-selected {
  border-color: color-mix(in srgb, var(--color-success) 56%, var(--pxds-border));
  color: var(--color-success);
  background: var(--color-success-surface);
}

.node-system-page #library-view .pxds-select-option.is-selected .pxds-select-check {
  color: var(--color-success);
}

.node-system-page #library-view .f2c-r1-recipe-workspace button[data-f2c-add-library-tag]:disabled {
  border-color: color-mix(in srgb, var(--color-success) 52%, var(--pxds-border));
  color: var(--color-success);
  background: var(--color-success-surface);
  opacity: 1;
}

/* Library dropdown triggers do not use hover decoration; focus and open states remain visible. */
.node-system-page #library-view .pxds-select-trigger:hover:not(:disabled),
html[data-theme="light"] .node-system-page #library-view .pxds-select-trigger:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.node-system-page #library-view .pxds-select-trigger:not(.has-value):hover:not(:disabled),
html[data-theme="light"] .node-system-page #library-view .pxds-select-trigger:not(.has-value):hover:not(:disabled) {
  border-color: var(--pxds-border);
  color: var(--pxds-text);
  background: var(--pxds-surface-2);
}

.node-system-page #library-view .pxds-select-trigger.has-value:hover:not(:disabled) {
  border-color: transparent;
  color: #fff;
  background: var(--pxds-brand-fill);
}

.node-system-page #library-view :is(
  .library-health,
  .f2c-values,
  .f2c-advanced,
  .f2c-version-history,
  .f2c-r1-all-tags,
  .f2c-r1-archived-list
) > summary {
  position: relative;
  padding-left: 32px !important;
  border-radius: 9px;
  overflow: hidden;
  list-style: none;
}

.node-system-page #library-view :is(
  .library-health,
  .f2c-values,
  .f2c-advanced,
  .f2c-version-history,
  .f2c-r1-all-tags,
  .f2c-r1-archived-list
) > summary::-webkit-details-marker {
  display: none;
}

.node-system-page #library-view :is(
  .library-health,
  .f2c-values,
  .f2c-advanced,
  .f2c-version-history,
  .f2c-r1-all-tags,
  .f2c-r1-archived-list
) > summary::before {
  content: "›";
  position: absolute;
  left: 12px;
  top: 50%;
  color: currentColor;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  transform: translateY(-50%);
  transform-origin: center;
  transition: transform var(--pxds-motion-fast) ease;
}

.node-system-page #library-view :is(
  .library-health,
  .f2c-values,
  .f2c-advanced,
  .f2c-version-history,
  .f2c-r1-all-tags,
  .f2c-r1-archived-list
)[open] > summary {
  border-radius: 9px 9px 0 0;
}

.node-system-page #library-view :is(
  .library-health,
  .f2c-values,
  .f2c-advanced,
  .f2c-version-history,
  .f2c-r1-all-tags,
  .f2c-r1-archived-list
)[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}

.node-system-page #library-view .f2c-r1-target-tag-library > .f2c-r1-all-tags,
.node-system-page #library-view .f2c-r1-target-tag-library > .f2c-r1-archived-tags {
  position: relative;
  display: block;
  width: auto;
  clear: both;
  margin: 10px;
}

.node-system-page #library-view .f2c-r1-target-tag-library > .f2c-r1-all-tags + .f2c-r1-archived-tags {
  margin-top: 10px;
}

.node-system-page #library-view [data-f2c-tag-link] {
  cursor: pointer;
  transition:
    outline-color var(--pxds-motion-fast) ease,
    background-color var(--pxds-motion-fast) ease,
    box-shadow var(--pxds-motion-fast) ease;
}

.node-system-page #library-view [data-f2c-tag-link].is-linked-highlight {
  outline: 2px solid var(--tag-color, var(--color-focus));
  outline-offset: 2px;
  color: var(--pxds-text);
  background: color-mix(in srgb, var(--tag-color, var(--color-focus)) 8%, var(--pxds-surface-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag-color, var(--color-focus)) 10%, transparent);
}

html[data-theme="light"] .node-system-page #library-view [data-f2c-tag-link].is-linked-highlight {
  background: color-mix(in srgb, var(--tag-color, var(--color-focus)) 18%, var(--pxds-surface-1));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag-color, var(--color-focus)) 16%, transparent);
}

/* All Tags entries do not carry a per-Recipe color class. Give that linked
   occurrence the same clear selected state with the system focus color. */
.f2c-r1-all-tag.is-linked-highlight {
  background: #17223f;
}

html[data-theme="light"] .f2c-r1-all-tag.is-linked-highlight {
  background: #e6eaf8;
}

html[data-theme="light"] .node-system-page #library-view .f2c-r1-prompt-rule {
  color: var(--pxds-text);
  background: color-mix(in srgb, var(--tag-color, var(--pxds-brand)) 7%, var(--pxds-surface-1));
}

@media (max-width: 1120px) {
  .node-system-page #library-view .library-node-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .node-system-page #library-view .library-node-list.is-provider-groups { grid-template-columns: minmax(0, 1fr); }
  .node-system-page #library-view .f2c-provider-model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .node-system-page #library-view .f2c-r1-target-tag-library > div,
  .node-system-page #library-view .f2c-r1-all-tags > div { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .node-system-page #library-view .library-scope { align-items: stretch; flex-direction: column; }
  .node-system-page #library-view .library-surface-buttons { width: 100%; grid-template-columns: 1fr; }
  .node-system-page #library-view .library-category-buttons,
  .node-system-page #library-view .library-node-list { grid-template-columns: 1fr; }
  .node-system-page #library-view .f2c-provider-model-grid { grid-template-columns: 1fr; }
  .node-system-page #library-view .library-toolbar { align-items: stretch; flex-direction: column; }
  .node-system-page #library-view .library-search-label { width: 100%; }
  .node-system-page #library-view .library-node-list,
  .node-system-page #library-view .library-node-list.is-recipe-workspace { padding: 12px; }
  .node-system-page #library-view .f2c-r1-recipe-picker label { grid-template-columns: 1fr; }
  .node-system-page #library-view .f2c-r1-tag-prompt-row { grid-template-columns: 1fr; }
  .node-system-page #library-view .f2c-r1-build-version,
  .node-system-page #library-view .f2c-r1-archived-tag { grid-template-columns: 1fr; }
  .node-system-page #library-view .f2c-r1-build-version > div { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .node-system-page #library-view :is(button, summary, [role="button"]) { transition: none; }
}
