/* Content review uses the existing conversation surface and theme tokens. */
.ai-brain-node-preview label { display: grid; gap: 6px; min-width: 0; }
.ai-brain-node-preview :is(input,textarea,select) { box-sizing: border-box; width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--fk-color-border-control, #cbcfe3); border-radius: 8px; background: var(--fk-color-surface-elevated, #fff); color: var(--fk-color-text-primary, #303653); font: inherit; }
.ai-brain-node-preview textarea { min-height: 140px; resize: vertical; }
.ai-brain-node-preview pre { max-width: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.ai-brain-node-preview [aria-invalid="true"] { border-color: #b93838; }
.ai-brain-node-preview .ai-brain-proposal-actions { flex-wrap: wrap; }
.ai-brain-node-preview :focus-visible { outline: 2px solid var(--fk-color-primary-action, #7565ed); outline-offset: 2px; }

/* Bounded Content handoff; native dialog is above the conversation shell. */
.ai-brain-content-dialog {
  box-sizing: border-box;
  width: min(620px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--fk-color-border-control, #cbcfe3);
  border-radius: 16px;
  background: var(--fk-color-surface-elevated, #fff);
  color: var(--fk-color-text-primary, #303653);
  box-shadow: 0 20px 60px #0004;
  overflow: hidden;
}
.ai-brain-content-dialog::backdrop { background: #10142599; }
.ai-brain-content-dialog > :is(.ai-brain-node-preview,.ai-brain-proposal-status) {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  max-height: calc(100dvh - 26px);
  margin: 0;
  padding: 0;
  border: 0;
  gap: 0;
  background: inherit;
}
.ai-brain-content-dialog h3 { margin: 0; padding: 16px 20px; font-size: 1.1rem; }
.ai-brain-content-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  padding: 0 20px 16px;
  scrollbar-gutter: stable;
}
.ai-brain-content-dialog .ai-brain-proposal-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  margin: 0;
  gap: 8px;
  border-top: 1px solid var(--fk-color-border-control, #cbcfe3);
  background: inherit;
}
.ai-brain-content-dialog .ai-brain-proposal-actions button { min-height: 44px; white-space: normal; }
.ai-brain-content-assets { display: grid; gap: 8px; min-width: 0; margin: 12px 0; padding: 0; border: 0; }
.ai-brain-content-assets legend { margin-bottom: 8px; }
.ai-brain-node-preview .ai-brain-content-card {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 4px 10px;
  padding: 12px;
  border: 1px solid var(--fk-color-border-control, #cbcfe3);
  border-radius: 10px;
  cursor: pointer;
}
.ai-brain-content-card:has(:checked) { border-color: var(--fk-color-primary-action, #7565ed); box-shadow: inset 0 0 0 1px var(--fk-color-primary-action, #7565ed); }
.ai-brain-node-preview .ai-brain-content-card input { width: 18px; height: 18px; margin: 2px 0; accent-color: var(--fk-color-primary-action, #7565ed); }
.ai-brain-content-card span { grid-column: 2; font-size: .9em; }
.ai-brain-content-dialog details { padding: 10px 0; }
.ai-brain-content-dialog summary { cursor: pointer; }
.ai-brain-content-dialog pre { margin-top: 8px; }
.ai-brain-content-dialog textarea { max-height: 35dvh; }
@media (max-width: 375px) {
  .ai-brain-content-dialog h3 { padding: 12px; }
  .ai-brain-content-scroll { padding: 0 12px 12px; }
  .ai-brain-content-dialog .ai-brain-proposal-actions { padding: 10px 12px; }
}
/* On short mobile screens reserve a separate row for Jump so it cannot cover
   the entry action before the modal opens. Keep the existing shell otherwise. */
@media (max-width: 800px) and (max-height: 740px) {
  #ai-brain-view .ai-brain-conversation:has([data-ai-brain-prepare]) { grid-template-rows: auto auto minmax(112px, 1fr) auto; }
  .ai-brain-thread:has([data-ai-brain-prepare]) { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
  .ai-brain-thread:has([data-ai-brain-prepare]) .ai-brain-jump-latest { position: static; transform: none; justify-self: center; margin-top: 4px; }
}
.ai-brain-content-scroll > p { margin-block: 8px; }
.ai-brain-content-card span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; line-height: 1.45; }
