/* Prompt detail workspace overrides. Kept index-only so shared admin CSS stays immutable. */
.prompt-card__action-label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--brand-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prompt-detail [data-detail-favorite][aria-pressed="true"] {
  color: var(--brand-text);
}

.prompt-detail[data-detail-mode="read"] .detail-body-grid {
  grid-template-columns: minmax(0, 72ch);
}

.detail-copy-bar {
  position: sticky;
  right: auto;
  bottom: 0;
  left: auto;
  z-index: 100;
  display: block;
}

.detail-copy-bar__inner.preview-actions {
  display: flex;
  width: 100%;
}

.preview-content {
  max-height: none;
  overflow: visible;
}

@media (max-width: 980px) {
  main.detail-view-active {
    padding-bottom: 64px;
  }
}

/* The export trigger lives in the sticky bottom action bar. */
.detail-copy-bar [data-export-menu-panel] {
  top: auto;
  bottom: calc(100% + 6px);
  min-width: 0;
  width: min(320px, calc(100vw - 32px));
  max-width: 100%;
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
}

@media (max-width: 480px) {
  .detail-copy-bar [data-export-menu-panel] {
    max-height: calc(100dvh - 300px);
  }
}

@media (max-width: 700px) {
  /* The read-detail header can contain its own action row in addition to the
     back link. Let the row move below it rather than overflow the viewport. */
  html[data-shell="refined"] body:not(.admin-page) .prompt-detail .detail-header {
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  html[data-shell="refined"] body:not(.admin-page) .prompt-detail .detail-actions {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  html[data-shell="refined"] body:not(.admin-page) .prompt-detail .detail-actions > * {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  html[data-shell="refined"] body:not(.admin-page) .prompt-detail .detail-actions > .icon-button {
    flex-shrink: 0;
  }
}

@media (max-width: 900px) {
  html[data-shell="refined"] body:not(.admin-page) .detail-body-grid { display: flex; flex-direction: column; }
  html[data-shell="refined"] body:not(.admin-page) .detail-body-right { order: -1; }
  html[data-shell="refined"] body:not(.admin-page) .detail-copy-bar { padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); }
  html[data-shell="refined"] body:not(.admin-page) #main-content { scroll-padding-bottom: calc(var(--mobile-detail-footer-height, 160px) + 16px); }
  html[data-shell="refined"] body:not(.admin-page) [data-placeholder-form] :is(input, textarea, select) { scroll-margin-block: 16px calc(var(--mobile-detail-footer-height, 160px) + 16px); font-size: 16px; }
}
