/* Drop target highlight for project rows. */
.project-row[dragover='true'] {
  outline: 2px dashed color-mix(in srgb, var(--ui-ink) 40%, transparent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--ui-ink) 4%, transparent);
}

/* PR-B: Library panel — files & artifacts list */
.library-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.library-panel.hidden {
  display: none;
}

.library-selection-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 6px;
  gap: 8px;
  flex-shrink: 0;
}
.library-selection-bar.visible {
  display: flex;
}
.library-select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: calc(var(--ui-font-size-caption) * var(--sidebar-font-scale));
  color: var(--ui-text-secondary);
  -webkit-user-select: none;
  user-select: none;
}
.library-select-all span {
  color: var(--ui-text-secondary);
}
.library-checkbox-label {
  display: flex;
  align-items: center;
  padding: 0 0 0 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.library-bulk-delete {
  min-height: 22px;
  padding: 2px 7px;
  border-radius: var(--ui-radius-xs);
  font-size: var(--ui-font-size-caption);
  background: color-mix(in srgb, var(--ui-danger) 12%, transparent);
  color: var(--ui-danger);
}
.library-bulk-delete:disabled {
  opacity: 0.35;
  cursor: default;
}
.library-bulk-delete:not(:disabled):hover {
  background: color-mix(in srgb, var(--ui-danger) 20%, transparent);
}
.library-row-selected {
  background: color-mix(in srgb, var(--ui-bg-control) 72%, transparent);
}
.library-rename-input {
  width: 100%;
  padding: 2px 4px;
  border: 0.5px solid color-mix(in srgb, var(--ui-border-default) 75%, transparent);
  border-radius: var(--ui-radius-xs);
  outline: none;
  background: var(--ui-bg-page);
  color: var(--ui-text-primary);
  font-size: calc(var(--ui-font-size-xxs-raw) * var(--sidebar-font-scale));
  font-family: var(--font-sans);
  font-weight: var(--ui-font-weight-semibold);
}
.library-rename-input:focus {
  border-color: color-mix(in srgb, var(--ui-ink) 65%, transparent);
  box-shadow: var(--ui-focus-shadow);
}

/* Workspace surfaces shared by Library, Projects, Scheduled, and Apps. */
.workspace-loading {
  padding: 28px 12px;
  text-align: center;
  color: var(--ui-text-tertiary);
  font-size: calc(var(--ui-font-size-xxs-raw) * var(--sidebar-font-scale));
}
.workspace-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 30px 16px;
  text-align: center;
  font-size: calc(var(--ui-font-size-xxs-raw) * var(--sidebar-font-scale));
  line-height: 1.5;
}
.workspace-empty strong {
  color: var(--ui-text-secondary);
  font-size: calc(var(--ui-font-size-base-small) * var(--sidebar-font-scale));
  font-weight: var(--ui-font-weight-semibold);
}
.workspace-primary,
.workspace-secondary,
.workspace-danger {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--ui-radius-pill);
  font-size: var(--ui-font-size-xxs);
  font-weight: var(--ui-font-weight-semibold);
  transition:
    background 0.15s,
    color 0.15s;
}
.workspace-primary {
  background: var(--ui-ink);
  color: var(--ui-bg-page);
}
.workspace-primary:hover {
  background: var(--ui-text-primary);
}
.workspace-secondary {
  border: 1px solid var(--ui-border-default);
  background: var(--ui-bg-raised);
  color: var(--ui-text-secondary);
}
.workspace-secondary:hover {
  background: var(--ui-bg-control);
  color: var(--ui-text-primary);
}
.workspace-danger {
  background: transparent;
  color: var(--ui-danger);
}
.workspace-danger:hover {
  background: color-mix(in srgb, var(--ui-danger) 14%, transparent);
}
.workspace-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 7px 10px;
  transition: background 0.14s;
}
.workspace-row:hover {
  background: var(--ui-bg-control);
}
.workspace-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: var(--ui-radius-row);
  background: var(--ui-bg-raised);
  flex: 0 0 auto;
}
.workspace-row-icon svg {
  width: 14px;
  height: 14px;
}
.workspace-row-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}
.workspace-row-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ui-text-primary);
  font-size: var(--ui-text-ui);
  font-weight: var(--ui-font-weight-medium);
}
.workspace-row-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ui-text-tertiary);
  font-size: calc(var(--ui-font-size-label) * var(--sidebar-font-scale));
}
.workspace-row-action {
  padding: 4px 6px;
  border-radius: var(--ui-radius-xs);
  color: var(--ui-text-tertiary);
  font-size: calc(var(--ui-font-size-label) * var(--sidebar-font-scale));
  opacity: 1;
  transition:
    opacity var(--ui-duration-hover),
    background var(--ui-duration-hover),
    color var(--ui-duration-hover);
}
@media (hover: hover) and (pointer: fine) {
  .workspace-row-action {
    opacity: 0;
  }
  :is(.workspace-row, .ui-page-card):hover .workspace-row-action,
  :is(.workspace-row, .ui-page-card):focus-within .workspace-row-action,
  .workspace-row-action:focus-visible {
    opacity: 1;
  }
}
.workspace-row-action:hover {
  background: var(--ui-bg-raised);
  color: var(--ui-text-primary);
}
.project-main,
.task-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  text-align: left;
}
.task-status {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--ui-text-tertiary);
}
.task-status.on {
  background: var(--ui-ink);
}
.task-status.failed {
  background: var(--ui-danger);
}

.workspace-dialog {
  position: fixed;
  inset: 0;
  z-index: var(--ui-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ui-space-lg);
  background: var(--ui-backdrop);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.workspace-dialog.hidden {
  display: none;
}
.workspace-dialog-card {
  width: min(480px, 100%);
  max-height: min(720px, calc(100dvh - 32px));
  overflow: auto;
  padding: var(--ui-space-xl);
  animation: workspaceDialogIn var(--ui-duration-overlay) var(--ui-ease-out);
}
@keyframes workspaceDialogIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.workspace-dialog-title {
  display: flex;
  gap: var(--ui-space-md);
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--ui-space-lg);
}
.workspace-dialog-title h2 {
  font-size: var(--ui-text-page);
  line-height: 1.2;
  font-weight: var(--ui-font-weight-semibold);
  letter-spacing: -0.02em;
}
.workspace-dialog-title p {
  margin-top: var(--ui-space-xs);
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-size-sm);
  line-height: 1.5;
}
.workspace-dialog-title > button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--ui-control-sm);
  height: var(--ui-control-sm);
  border-radius: var(--ui-radius-md);
  color: var(--ui-text-secondary);
}
.workspace-dialog-title > button:hover {
  background: var(--ui-bg-control);
  color: var(--ui-text-primary);
}
.workspace-form {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-md);
}
.workspace-field {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-xs);
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-size-sm);
  font-weight: var(--ui-font-weight-medium);
}
.workspace-field em {
  font-style: normal;
  color: var(--ui-text-tertiary);
  font-size: var(--ui-font-size-xs);
  font-weight: var(--ui-font-weight-regular);
}
.workspace-field select {
  width: 100%;
}
.workspace-field textarea {
  resize: vertical;
}
.workspace-field input[type='color'] {
  width: var(--ui-control-touch);
  height: var(--ui-control-desktop);
  padding: 2px;
  border-radius: var(--ui-radius-row);
  cursor: pointer;
}
.workspace-form-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
}
.workspace-dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}
.workspace-note {
  color: var(--ui-text-tertiary);
  font-size: var(--ui-font-size-label);
  line-height: 1.45;
}
.project-workspace-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.marketplace-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.connector-row {
  align-items: center;
  gap: 13px;
  min-height: 66px;
  padding: 10px 12px;
}
.connector-row:hover {
  background: color-mix(in srgb, var(--ui-bg-raised) 72%, transparent);
}
.connector-icon {
  overflow: hidden;
  font-size: var(--ui-font-size-label);
  font-weight: var(--ui-font-weight-bold);
  background: var(--ui-bg-sidebar);
  color: var(--ui-text-primary);
  border: 1px solid color-mix(in srgb, var(--ui-border-default) 38%, transparent);
  box-shadow: 0 1px 2px hsl(var(--always-black) / 0.12);
}
.connector-icon svg {
  width: 18px;
  height: 18px;
}
.connector-zotero {
  background: var(--ui-ink);
  color: var(--ui-on-ink);
  border-color: var(--ui-ink);
}
.connector-arxiv {
  background: hsl(var(--always-white));
  color: hsl(var(--always-black) / 0.93);
  border-color: color-mix(in srgb, var(--ui-border-default) 42%, transparent);
}
.connector-arxiv svg {
  width: 19px;
  height: 19px;
}
.connector-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.zotero-item,
.arxiv-paper {
  padding: 8px 0;
  border-bottom: 0.5px solid color-mix(in srgb, var(--ui-border-default) 20%, transparent);
}
.zotero-item:last-child,
.arxiv-paper:last-child {
  border-bottom: 0;
}
.arxiv-paper {
  align-items: flex-start;
}
.arxiv-paper .connector-actions {
  margin-left: auto;
  padding-top: 2px;
}
.arxiv-summary {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--ui-text-tertiary);
  font-size: var(--ui-font-size-label);
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* PR-C: Spaces panel — projects list */
.spaces-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.spaces-panel.hidden {
  display: none;
}

/* PR-D: Scheduled panel — scheduled tasks */
.scheduled-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.scheduled-panel.hidden {
  display: none;
}

.scheduled-empty {
  text-align: center;
  color: var(--ui-text-tertiary);
  font-size: calc(var(--ui-font-size-xxs-raw) * var(--sidebar-font-scale));
  padding: 32px 12px;
  line-height: 1.6;
}

/* PR-E: Plugins panel — installed extensions */
.plugins-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.plugins-panel.hidden {
  display: none;
}

/* Main-content pages (Library, Projects, Scheduled, Plugins shown in
   main area instead of sidebar). Overrides sidebar-panel sizing. */
.main-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
.main-page.hidden {
  display: none;
}

/*
 * polish/workspace.css — shared directory page layout and controls.
 * The phone directories keep their geometry in the mobile surface owners.
 *
 * The page column, heading, toolbar, search field, range tabs and empty
 * state are owned by features/page-kit.css. This file keeps only the
 * directory content controls (filter button, table rows) and
 * the creation page shell until that surface moves to the Page Kit.
 */

@media (min-width: 769px) {
  /* The shared landing/chat padding (5vh) must not inset a directory page:
     PageFrame owns the page column and its 42px top rhythm. */
  body.workspace-active .app-shell #mainInner {
    padding: 0;
  }

  body.workspace-active
    .app-shell
    :is(.library-panel, .spaces-panel, .scheduled-panel, .plugins-panel, .creation-panel.main-page),
  body.admin-active .app-shell .admin-panel {
    width: 100%;
    max-width: var(--ui-page-width);
    margin-inline: auto;
    padding: 0;
  }
}

.app-shell .creation-empty[data-slot='empty'] {
  flex: 0 0 auto;
  gap: var(--ui-space-md);
  padding-block: var(--ui-space-xxl);
}

/* Library toolbar controls. The header/search/tabs themselves are Page Kit
   components; these classes only place the filter, divider and view switch
   inside the shared toolbar row. */
.app-shell .library-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.app-shell .library-tool-btn {
  display: grid;
  place-items: center;
  width: var(--ui-control-desktop);
  height: var(--ui-control-desktop);
}

.app-shell .library-file-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--ui-radius-lg);
  background: var(--ui-file-color, var(--ui-bg-control));
  color: hsl(var(--always-white));
  flex: 0 0 44px;
}

.app-shell .library-file-icon svg {
  width: 22px;
  height: 22px;
  /* Official glyphs are filled outlines; do not add an extra stroke. */
}

.app-shell .library-file-icon svg:not([data-icon-source='openai-apps-sdk']) {
  stroke: currentColor;
}

/* ------------------------------------------------------------------ */
/*  Plugin Detail Page                                                */
/* ------------------------------------------------------------------ */

.app-shell .plugin-detail-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0 auto;
}

.app-shell .plugin-detail-card {
  margin-top: var(--ui-space-sm);
  padding: var(--ui-space-lg) 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.app-shell .plugin-detail-page-header {
  display: flex;
  align-items: center;
  gap: var(--ui-space-md);
  margin: 0;
  padding: 0 0 var(--ui-space-xl);
  border-bottom: 1px solid var(--ui-account-border);
}

.app-shell .plugin-detail-page-header .account-page-title {
  flex: 1 1 180px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-shell .plugin-detail-page-header .account-page-actions {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
}

.app-shell .plugin-detail-back-btn {
  align-self: flex-start;
  flex: 0 0 auto;
  margin-inline-start: calc(-1 * var(--ui-space-sm));
}

.app-shell :is(.plugin-detail-back-btn, .plugin-detail-btn-secondary) {
  color: var(--ui-text-primary);
}

.app-shell .plugin-detail-logo-tile {
  flex: 0 0 64px;
  width: 64px;
  min-width: 64px;
  height: 64px;
  min-height: 64px;
  border-radius: var(--ui-radius-lg);
  display: grid;
  place-items: center;
  background: var(--ui-bg-surface);
  box-shadow: inset 0 0 0 1px var(--ui-border-default);
  overflow: hidden;
  padding: 0;
}

.app-shell .plugin-detail-logo-tile svg {
  width: 100%;
  height: 100%;
  display: block;
}

.app-shell .plugin-detail-logo-tile.connector-github svg > rect {
  fill: hsl(var(--always-white));
}

.app-shell .plugin-detail-logo-tile.connector-github svg path {
  fill: hsl(var(--always-black));
}

.app-shell .plugin-detail-logo-tile img.connector-logo {
  width: 38px;
  height: 38px;
  max-width: 38px;
  max-height: 38px;
  object-fit: contain;
  display: block;
}

.app-shell .plugin-detail-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-sm);
  margin-top: 2px;
  font-size: var(--ui-font-size-sm);
  color: var(--ui-text-secondary);
}

.app-shell .plugin-detail-status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--ui-space-xs);
  font-size: var(--ui-font-size-xxs);
  color: var(--ui-text-secondary);
  background: var(--ui-bg-raised);
  border-radius: var(--ui-radius-pill);
  padding: var(--ui-space-xxs) var(--ui-space-sm);
}

.app-shell .plugin-detail-status-pill.connected {
  color: var(--ui-ink);
  font-weight: var(--ui-font-weight-medium);
}

.app-shell .plugin-detail-status-pill.connected::before {
  content: '';
  inline-size: var(--ui-space-xs);
  aspect-ratio: 1;
  border-radius: var(--ui-radius-pill);
  background: currentColor;
}

.app-shell .plugin-detail-cta-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-sm);
  min-width: 0;
  width: 100%;
}

.app-shell .plugin-detail-body {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-xl);
  padding-top: var(--ui-space-xl);
}

.app-shell .plugin-detail-section {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-sm);
  min-width: 0;
  padding-bottom: var(--ui-space-xl);
  border-bottom: 1px solid var(--ui-account-border);
}

.app-shell .plugin-detail-section:last-child {
  border-bottom: 0;
}

.app-shell .plugin-detail-section-title {
  display: flex;
  align-items: center;
  gap: var(--ui-space-sm);
  font-size: var(--ui-font-size-lg);
  font-weight: var(--ui-font-weight-semibold);
  color: var(--ui-text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.app-shell .plugin-detail-desc {
  overflow-wrap: anywhere;
  font-size: var(--ui-font-size-md);
  line-height: 1.6;
  color: var(--ui-text-primary);
  margin: 0;
}

.app-shell .plugin-detail-scenarios {
  padding: clamp(var(--ui-space-md), 3vw, var(--ui-space-xl));
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--ui-radius-lg);
  background:
    radial-gradient(
      ellipse at top right,
      color-mix(in srgb, var(--ui-accent-action) 8%, transparent),
      transparent 70%
    ),
    var(--ui-bg-panel);
}

.app-shell .plugin-detail-prompts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.app-shell .plugin-detail-prompt-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  min-height: 52px;
  padding: 12px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ui-account-border);
  border-radius: 0;
  color: var(--ui-text-primary);
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
}

.app-shell .plugin-detail-prompts-list li:last-child .plugin-detail-prompt-card {
  border-bottom: 0;
}

.app-shell .plugin-detail-prompt-card > svg {
  flex: none;
  color: var(--ui-text-secondary);
}

.app-shell .plugin-detail-prompt-copy {
  display: grid;
  flex: 1;
  gap: var(--ui-space-xxs);
  min-width: 0;
}

.app-shell .plugin-detail-prompt-copy strong {
  font-size: var(--ui-font-size-sm);
  font-weight: var(--ui-font-weight-semibold);
}

.app-shell button.plugin-detail-prompt-card:is(:hover, :focus-visible) {
  background: var(--ui-bg-hover);
}

.app-shell .plugin-detail-prompt-text {
  min-width: 0;
  font-size: var(--ui-font-size-sm);
  line-height: 1.4;
  color: var(--ui-text-secondary);
}

.app-shell .plugin-detail-prompt-arrow {
  margin-inline-start: auto;
  color: var(--ui-text-tertiary);
  font-size: var(--ui-font-size-sm);
  flex-shrink: 0;
}

.app-shell .plugin-detail-features-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-shell .plugin-detail-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-block: var(--ui-space-xs);
  font-size: var(--ui-font-size-sm);
  color: var(--ui-text-secondary);
  line-height: 1.5;
}

.app-shell .plugin-detail-feature-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.app-shell .plugin-detail-security-card {
  margin: 0;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.app-shell .plugin-detail-security-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--ui-space-md);
  min-width: 0;
  padding-block: var(--ui-space-sm);
  border-bottom: 1px solid var(--ui-border-subtle);
  font-size: var(--ui-font-size-sm);
}

.app-shell .plugin-detail-security-field dt {
  color: var(--ui-text-tertiary);
}

.app-shell .plugin-detail-security-field dd {
  margin: 0;
  min-width: 0;
  text-align: end;
  overflow-wrap: anywhere;
  color: var(--ui-text-primary);
  font-weight: var(--ui-font-weight-medium);
}

.app-shell .plugin-detail-privacy-note {
  margin: 6px 0 0;
  font-size: var(--ui-font-size-xs);
  line-height: 1.5;
  color: var(--ui-text-tertiary);
}

/* ------------------------------------------------------------------ */
/* Action details share the same restrained disclosure grammar as tool activity. */
.app-shell .plugin-detail-action-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.app-shell .plugin-detail-action-copy strong {
  color: var(--ui-text-primary);
  font-weight: var(--ui-font-weight-medium);
}
.app-shell .plugin-detail-feature-item > svg {
  flex: none;
  margin-top: 3px;
}
.app-shell .plugin-detail-count {
  margin-inline-start: var(--ui-space-xs);
  color: var(--ui-text-tertiary);
  font-size: var(--ui-font-size-xs);
  font-weight: var(--ui-font-weight-regular);
}
.app-shell .plugin-detail-note {
  margin: 0;
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-size-sm);
  line-height: 1.5;
}
.app-shell .plugin-detail-more-actions summary {
  cursor: pointer;
  color: var(--ui-text-primary);
  font-size: var(--ui-font-size-sm);
  min-height: var(--ui-control-touch);
  align-content: center;
}

.app-shell .plugin-detail-permissions {
  display: flex;
  align-items: center;
  gap: var(--ui-space-sm);
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-size-sm);
}

.app-shell .plugin-detail-permissions svg {
  flex: none;
}

.app-shell .plugin-detail-disclosure > summary {
  display: list-item;
  cursor: pointer;
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-size-sm);
  min-height: var(--ui-control-desktop);
  align-content: center;
}

/* ------------------------------------------------------------------ */
/*  Workspace Loading & Skeletons                                     */
/* ------------------------------------------------------------------ */

.app-shell .workspace-loading-surface {
  display: flex;
  flex-direction: column;
  max-width: var(--ui-page-width);
  width: 100%;
  margin: 0 auto;
}

.app-shell .workspace-skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

/* All visible placeholder blocks share the one sweep defined in
   foundations/base.css (`.skeleton-shimmer`, which the shadcn Skeleton already
   applies). This rule only pins the workspace's own fill and highlight, so the
   directory skeletons read the same as every other skeleton instead of running
   a second gradient. Shape rules set only background-color to preserve it. */
.app-shell .workspace-skeleton-shimmer {
  background-color: var(--ui-bg-raised);
  --skeleton-shimmer-highlight: color-mix(in srgb, var(--ui-text-primary) 11%, transparent);
  animation-timing-function: linear;
}

/* Keep placeholders static and legible when reduced motion is requested. */
@media (prefers-reduced-motion: reduce) {
  .app-shell .workspace-skeleton-shimmer {
    animation: none;
    background-image: none;
  }
}

.app-shell .workspace-skeleton-tabs {
  display: flex;
  gap: 8px;
}

.app-shell .workspace-skeleton-pill {
  border-radius: var(--ui-radius-pill);
  background-color: var(--ui-bg-raised);
}

.app-shell .workspace-skeleton-pill-tab {
  width: 68px;
  height: 32px;
}

.app-shell .workspace-skeleton-pill-tab.active {
  background-color: var(--ui-bg-control);
}

.app-shell .workspace-skeleton-pill-chip {
  width: 56px;
  height: 28px;
}

.app-shell .workspace-skeleton-pill-md {
  width: 100px;
  height: 32px;
}

.app-shell .workspace-skeleton-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.app-shell .workspace-skeleton-search {
  /* Fills whatever the toolbar leaves after its fixed-size neighbour, so the
     row still fits a phone instead of overflowing at 220px + 100px. */
  flex: 1 1 0;
  min-width: 0;
  height: 36px;
  border-radius: var(--ui-radius-pill);
  background-color: var(--ui-bg-raised);
}

.app-shell .workspace-skeleton-chips {
  display: flex;
  gap: 8px;
  overflow: hidden;
}

.app-shell .workspace-skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-shell .workspace-skeleton-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}

.app-shell .workspace-skeleton-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Take the row's leftover so the 100% line placeholders resolve against a
     definite width instead of their own content. */
  flex: 1 1 0;
  min-width: 0;
}

.app-shell .workspace-skeleton-line {
  border-radius: var(--ui-radius-sm);
  background-color: var(--ui-bg-raised);
}

.app-shell .workspace-skeleton-line-title {
  /* Every line placeholder spans the copy column; a fixed 140px read as a
     settled short line and let the real row reflow on arrival. */
  width: 100%;
  height: 16px;
}

.app-shell .workspace-skeleton-line-desc {
  width: 100%;
  max-width: none;
  height: 12px;
}

.app-shell .workspace-skeleton-line-sub {
  width: 100%;
  height: 12px;
}

.app-shell .workspace-skeleton-line-date {
  /* Trailing metadata keeps its own measure; the copy column takes the rest. */
  flex: none;
  width: 80px;
  height: 12px;
}

.app-shell .workspace-skeleton-line-size {
  flex: none;
  width: 60px;
  height: 12px;
}

.app-shell .workspace-skeleton-action {
  width: 72px;
  height: 32px;
  border-radius: var(--ui-radius-pill);
  background-color: var(--ui-bg-raised);
  flex-shrink: 0;
}

.app-shell .workspace-skeleton-icon-circle {
  width: 32px;
  height: 32px;
  /* --ui-radius-full never existed as a token, so this resolved to an
     invalid value and the skeleton circle drew as a hard square. */
  border-radius: var(--ui-radius-pill);
  background-color: var(--ui-bg-raised);
  flex-shrink: 0;
}

.app-shell .workspace-skeleton-dot-action {
  width: 24px;
  height: 24px;
  border-radius: var(--ui-radius-pill);
  background-color: var(--ui-bg-raised);
  flex-shrink: 0;
}

.app-shell .workspace-skeleton-check {
  width: 18px;
  height: 18px;
  border-radius: var(--ui-radius-sm);
  background-color: var(--ui-bg-raised);
  flex-shrink: 0;
}

.app-shell .workspace-skeleton-file-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--ui-radius-sm);
  background-color: var(--ui-bg-raised);
  flex-shrink: 0;
}

/* Scheduled tasks keep the same card/list hierarchy as the settled page. */
.app-shell .workspace-skeleton-create {
  width: 76px;
  height: var(--ui-control-desktop);
  transition: opacity var(--ui-duration-normal) ease-in-out var(--ui-loading-feedback-delay);
}

@starting-style {
  .app-shell .workspace-skeleton-create {
    opacity: 0;
  }
}

.app-shell .workspace-skeleton-scheduled-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.app-shell .workspace-skeleton-scheduled-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 72px;
  padding: 16px;
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--ui-radius-xl);
  background: var(--ui-bg-raised);
}

.app-shell .workspace-skeleton-scheduled-card .workspace-skeleton-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--ui-radius-lg);
}

.app-shell .workspace-skeleton-scheduled-card .workspace-skeleton-line-desc {
  width: 100%;
  max-width: none;
}

.app-shell .workspace-scheduled-task-list {
  gap: 10px;
}

.app-shell .scheduled-skeleton-row {
  min-height: 70px;
  padding: 16px;
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--ui-radius-xl);
  background: var(--ui-bg-raised);
}

.app-shell .workspace-skeleton-task-action {
  width: 96px;
}

/* The lazy page chunk has a shorter gap than a data request, but it should
   still announce the same visual language before React takes ownership. */
.app-shell .workspace-chunk-loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 180px;
  padding: 48px 20px;
}

.app-shell .workspace-chunk-loading-label {
  font-size: var(--ui-font-size-sm);
}

.app-shell .workspace-chunk-retry {
  align-self: flex-start;
}

.app-shell .workspace-chunk-loading-line {
  /* The lazy chunk resolves into a full-width page, so its placeholder lines
     span the same measure instead of sitting as a narrow centred block. */
  width: 100%;
  height: 12px;
  border-radius: var(--ui-radius-pill);
}

.app-shell .workspace-chunk-loading-line-short {
  width: 62%;
}

@media (max-width: 768px) {
  /* Touch has no hover, so the desktop hover-reveal contract cannot gate the
     only row-selection affordance. Keep the row checkbox visible on phones —
     hiding it made the selection bar (and bulk delete) unreachable.
     e2e: library-directory.spec.mjs (phone selection). */

  /* Plugins page refinements on mobile */

  .app-shell .plugin-detail-view {
    max-width: none;
  }

  .app-shell .plugin-detail-page-header {
    flex-wrap: wrap;
    align-items: center;
  }

  .app-shell .plugin-detail-page-header .account-page-title {
    flex: 1 1 0;
    min-width: 0;
  }

  .app-shell .plugin-detail-page-header .account-page-actions:has(.plugin-detail-cta-group) {
    flex: 1 0 100%;
    min-width: 0;
    max-width: none;
    margin-inline-start: 0;
  }

  .app-shell .plugin-detail-cta-group {
    width: 100%;
  }

  .app-shell .plugin-detail-logo-tile {
    flex: 0 0 56px;
    width: 56px;
    min-width: 56px;
    height: 56px;
    min-height: 56px;
  }

  @media (max-width: 360px) {
    .app-shell .plugin-detail-cta-group {
      flex-direction: column;
      align-items: stretch;
    }
    .app-shell .plugin-detail-cta-group > button {
      width: 100%;
    }
  }

  .app-shell .workspace-skeleton-scheduled-cards {
    grid-template-columns: 1fr;
  }

  .app-shell .scheduled-skeleton-row {
    padding: 14px;
  }
}

/* The plugin directory fills the phone column; Library lives with its other
   phone rules in polish/mobile-directories.css. */
@media (max-width: 768px) {
  body.workspace-active .app-shell .plugins-panel.main-page {
    width: 100%;
    margin: 0;
    padding: 0;
  }
}

/* Editors replace the page list and share its scroll surface. */
.creation-editor-page {
  width: 100%;
}
.creation-editor {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-lg);
  width: 100%;
  max-width: var(--ui-content-chat);
  margin-inline: auto;
  padding: var(--ui-space-lg) 0;
  color: var(--ui-text-primary);
  background: transparent;
  border: 0;
}
.detail-body > .creation-preview-frame {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  background: var(--ui-bg-page);
}

/* Workspace pages own the full main column; the shell's page padding would
   double the page frame's own gutter. Migrated from restore/chatgpt-parity.css. */
body.workspace-active .app-shell .main-page:not(.creation-panel) {
  padding: 0;
  background: var(--ui-bg-page);
}

/* The plugin directory is a fixed-chrome page: keep the main scroll host from
   clipping it while the panel owns its own scroll surface. Migrated from
   restore/ref-baseline.css. */
@media (min-width: 769px) {
  :root[data-plugins-panel-open] body.workspace-active .app-shell #mainContent {
    position: relative;
    z-index: var(--ui-z-panel);
    overflow: visible;
  }
}

/* Project run history and reviewable execution details. */
.project-run-history {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 0.5px solid var(--ui-border-subtle);
}
.project-runtime-heading {
  margin-bottom: 7px;
  color: var(--ui-text-primary);
  font-size: var(--ui-font-size-xs);
  font-weight: var(--ui-font-weight-semibold);
}
.project-run-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--ui-border-subtle);
}
.project-run-row:last-child {
  border-bottom: 0;
}
.project-run-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}
.project-run-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ui-text-primary);
  font-size: var(--ui-font-size-xs);
  font-weight: var(--ui-font-weight-semibold);
}
.project-run-copy span {
  color: var(--ui-text-tertiary);
  font-size: var(--ui-font-size-xxs);
}
.project-run-open {
  opacity: 1;
  flex: 0 0 auto;
}
.agent-run-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-run-details-summary {
  margin: 0;
  color: var(--ui-text-primary);
  font-size: var(--ui-font-size-xs);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.agent-run-details-status {
  color: var(--ui-text-tertiary);
  font-size: var(--ui-font-size-xxs);
}
.agent-run-details-section-title {
  margin-top: 4px;
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-size-xxs);
}
.agent-run-artifacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--ui-text-primary);
  font: var(--ui-font-size-xxs) var(--font-mono);
}
.agent-run-details-activity {
  margin-top: 3px;
  border-top: 0.5px solid var(--ui-border-subtle);
  padding-top: 8px;
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-size-xxs);
}
.agent-run-details-activity summary {
  cursor: pointer;
  color: var(--ui-text-secondary);
  font-weight: var(--ui-font-weight-semibold);
}
.agent-run-details-activity ol {
  display: flex;
  max-height: 220px;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
  margin: 8px 0 0;
  padding-left: 18px;
  font-family: var(--font-mono);
  font-size: var(--ui-font-size-xxs);
  line-height: 1.45;
}
@media (max-width: 480px) {
  .project-run-row {
    align-items: flex-start;
  }
  .project-run-open {
    padding-inline: 4px;
  }
  .agent-run-details-activity ol {
    max-height: 180px;
  }
}

/* Connector marks remain owned by the plugin surface; branded SVG ink is inherited. */
.connector-row .connector-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--ui-radius-md);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border-subtle);
  box-shadow: none;
  color: var(--ui-text-secondary);
  overflow: hidden;
}
.connector-row .connector-icon svg {
  width: 18px;
  height: 18px;
  color: inherit;
}
.connector-row .connector-icon span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: var(--ui-font-size-xxs);
  font-weight: var(--ui-font-weight-semibold);
  color: inherit;
}
.connector-row .connector-icon .connector-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}
.connector-row .connector-icon .connector-logo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: var(--ui-font-size-xxs);
  font-weight: var(--ui-font-weight-semibold);
  color: inherit;
}
.connector-row .workspace-row-copy {
  gap: 4px;
}
.connector-row .workspace-row-copy strong {
  font-size: var(--ui-font-size-sm);
  font-weight: var(--ui-font-weight-semibold);
  color: var(--ui-text-primary);
}
.connector-row .workspace-row-copy > span {
  font-size: var(--ui-font-size-xs);
  font-weight: var(--ui-font-weight-regular);
  color: var(--ui-text-secondary);
}
.connector-row .workspace-note {
  display: none;
}
