.bruno-agent {
  width: 100%;
  display: flex;
  justify-content: center;
}

body.bruno-page {
  background-color: #f3f6fb;
  margin: 0;
  padding: 0 24px;
}

body.bruno-page main {
  padding-top: var(--story-nav-offset, 92px);
  min-height: calc(100vh - var(--story-nav-offset, 92px));
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.bruno-agent .bruno-container {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.bruno-agent .chat-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(10, 85, 204, 0.12);
  display: flex;
  flex-direction: column;
  min-height: 70vh;
  width: 100%;
}

body.campaign-page .bruno-agent .bruno-container {
  width: min(1200px, 100%);
}

body.campaign-page main {
  height: 100vh;
  min-height: 100vh;
  box-sizing: border-box;
}

@supports (height: 100dvh) {
  body.campaign-page main {
    height: 100dvh;
    min-height: 100dvh;
  }
}

body.campaign-page .bruno-agent,
body.campaign-page .bruno-agent .bruno-container {
  height: 100%;
  min-height: 0;
}

body.campaign-page .chat-card.campaign-layout {
  min-height: 0;
  height: 100%;
}

.campaign-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem;
  box-sizing: border-box;
  min-height: 0;
}

.campaign-preview {
  background: #f8fbff;
  border: 1px solid #dbe3f2;
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: inset 0 0 0 1px rgba(3, 45, 96, 0.02);
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

.campaign-preview h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #032d60;
}

.campaign-preview p {
  margin: 0.25rem 0 0;
  color: #5f7ea3;
}

.brief-fields {
  margin: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.brief-fields dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5f7ea3;
  margin-bottom: 0.2rem;
}

.brief-fields dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #032d60;
  min-height: 1.4rem;
}

.preview-section__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.preview-section__heading h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #032d60;
}

.preview-blocks {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-empty {
  margin: 0;
  font-size: 0.85rem;
  color: #5f7ea3;
}

.content-block-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.content-block-card {
  background: #fff;
  border: 1px solid #dbe3f2;
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.content-block-card__label {
  font-size: 0.8rem;
  color: #5f7ea3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.content-block-card__copy {
  margin: 0;
  color: #032d60;
  line-height: 1.4;
}

.content-block-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #032d60;
}

.content-block-card__meta strong {
  font-weight: 600;
  color: #5f7ea3;
  margin-right: 0.25rem;
}

.content-block-card__meta a {
  color: #0b5cab;
  text-decoration: none;
}

.content-block-card__meta a:hover {
  text-decoration: underline;
}

.preview-kpis {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kpi-chip {
  border: 1px solid #dbe3f2;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  background: #fff;
  color: #032d60;
}

.preview-json-btn {
  align-self: flex-start;
}

.campaign-chat-panel {
  background: #fff;
  border: 1px solid #dbe3f2;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(3, 45, 96, 0.02);
}

.campaign-chat-panel .chat-log {
  min-height: 0;
}

.campaign-chat-panel .context-panel {
  border-bottom: 1px solid #e6ebf5;
  background: #fdfefe;
}

.context-list--campaign {
  max-height: clamp(160px, 30vh, 260px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.campaign-tips {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #032d60;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.campaign-inline-card {
  background: #f8fbff;
  border: 1px solid #dbe3f2;
  border-radius: 12px;
  padding: 1rem;
}

.grounding-card {
  margin-top: 0.75rem;
}

.grounding-card__title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: #032d60;
}

.grounding-section {
  margin-top: 0.5rem;
}

.grounding-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5f7ea3;
}

.grounding-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.grounding-list li {
  border: 1px solid #dbe3f2;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background: #fff;
}

.grounding-source {
  font-weight: 600;
  color: #032d60;
  display: block;
  margin-bottom: 0.2rem;
}

.suggestion-card {
  display: flex;
  flex-direction: column;
}

.suggestion-card__title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: #032d60;
}

.suggestion-card__group {
  margin-bottom: 0.75rem;
}

.suggestion-card__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #032d60;
  margin: 0 0 0.2rem;
}

.suggestion-card pre {
  margin: 0;
  background: #fff;
  border: 1px solid #dbe3f2;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.8rem;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
}

.suggestion-card__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.image-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.image-picker__image {
  border: 1px solid #dbe3f2;
  border-radius: 10px;
  padding: 0;
  background: #fff;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.image-picker__image img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
}

.image-picker__image:focus-visible {
  outline: 2px solid #0b5cab;
  outline-offset: 2px;
}

.campaign-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.campaign-modal.is-open {
  display: flex;
}

.campaign-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 45, 96, 0.45);
}

.campaign-modal__dialog {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 720px;
  width: min(90vw, 720px);
  max-height: 80vh;
  padding: 1rem;
  box-shadow: 0 20px 60px rgba(3, 45, 96, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1;
}

.campaign-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.campaign-modal__header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #032d60;
}

.campaign-modal__body {
  margin: 0;
  flex: 1;
  overflow: auto;
  background: #f8fbff;
  border: 1px solid #dbe3f2;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.85rem;
}

.bruno-agent .chat-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e6ebf5;
}

.bruno-agent .chat-header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: #032d60;
}

.bruno-agent .chat-header p {
  margin: 0.4rem 0 0;
  color: #5f7ea3;
}

.bruno-agent .chat-log {
  flex: 1;
  padding: 1.25rem 1.25rem 6rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scroll-behavior: smooth;
}

.bruno-agent .chat-bubble {
  max-width: 80%;
  padding: 0.9rem 1.1rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(3, 45, 96, 0.08);
}

.bruno-agent .chat-bubble.user {
  align-self: flex-end;
  background: #0b5cab;
  color: #fff;
}

.bruno-agent .chat-bubble.bruno {
  align-self: flex-start;
  background: #f4f7ff;
  color: #032d60;
  border: 1px solid #d5def4;
  border-left: 4px solid #0b5cab;
}

.bruno-agent .chat-meta {
  font-size: 0.75rem;
  color: #5f7ea3;
  margin-top: 0.35rem;
}

.bruno-agent .chat-form {
  border-top: 1px solid #e6ebf5;
  padding: 1.25rem;
  background: #fafcff;
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.bruno-agent .chat-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 80px;
  font-size: 0.95rem;
  border-radius: 8px;
}

.bruno-agent .chat-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.bruno-agent .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #e1f6fe;
  color: #0176d3;
  font-size: 0.75rem;
}

.bruno-agent .context-panel {
  padding: 1.25rem 1.5rem;
  background: #f8fbff;
  border-bottom: 1px solid #e6ebf5;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bruno-agent .context-panel h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #032d60;
}

.bruno-agent .context-panel p {
  margin: 0.25rem 0 0;
  color: #5f7ea3;
  font-size: 0.85rem;
}

.bruno-agent .context-upload {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.bruno-agent .context-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bruno-agent .context-card {
  background: #ffffff;
  border: 1px solid #dbe3f2;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  box-shadow: inset 0 0 0 1px rgba(3, 45, 96, 0.04);
}

.bruno-agent .context-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  color: #032d60;
}

.bruno-agent .context-card__meta {
  font-size: 0.75rem;
  color: #5f7ea3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.context-card__header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.context-card__title {
  font-weight: 600;
  color: #032d60;
}

.context-divider {
  border-top: 1px solid #e6ebf5;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
}

.bruno-agent .context-card__summary {
  font-size: 0.85rem;
  color: #032d60;
  margin: 0.2rem 0 0.8rem;
  white-space: pre-wrap;
  max-height: 6.5rem;
  overflow-y: auto;
}

.bruno-agent .context-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bruno-agent .context-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #e6f7e0;
  color: #10793f;
  font-size: 0.7rem;
}

.bruno-agent .context-empty {
  font-size: 0.85rem;
  color: #5f7ea3;
  border: 1px dashed #cbd5f1;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.bruno-agent .chat-bubble.bruno .response-paragraph {
  margin: 0.35rem 0;
  color: #032d60;
}

.bruno-agent .chat-bubble.bruno .response-paragraph--lede {
  font-size: 1.02rem;
  font-weight: 600;
  color: #03234d;
}

.bruno-agent .chat-bubble.bruno .response-heading {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #032d60;
  letter-spacing: 0.01em;
}

.bruno-agent .chat-bubble.bruno .response-section {
  margin-top: 0.9rem;
  padding-top: 0.55rem;
  border-top: 1px solid #dbe3f2;
}

.bruno-agent .chat-bubble.bruno .section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5f7ea3;
  margin-bottom: 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.bruno-agent .chat-bubble.bruno .section-title svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.bruno-agent .chat-bubble.bruno .section-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bruno-agent .chat-bubble.bruno .section-list li {
  background: #fff;
  border: 1px solid #dbe3f2;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  box-shadow: inset 0 0 0 1px rgba(3, 45, 96, 0.03);
}

.bruno-agent .chat-bubble.bruno .section-list li .agent-name,
.bruno-agent .chat-bubble.bruno .section-list li .agent-link {
  font-weight: 600;
  color: #032d60;
  display: block;
}

.bruno-agent .chat-bubble.bruno .section-list li .agent-link {
  color: #0b5cab;
  text-decoration: none;
}

.bruno-agent .chat-bubble.bruno .section-list li .agent-link:hover {
  text-decoration: underline;
}

.bruno-agent .chat-bubble.bruno .section-list li .agent-detail {
  display: block;
  margin-top: 0.25rem;
}

.bruno-agent .chat-bubble.bruno .response-list {
  margin: 0.35rem 0;
  padding-left: 1.1rem;
  color: #032d60;
}

.bruno-agent .chat-bubble.bruno .response-list li {
  margin: 0.25rem 0;
}

@media (max-width: 960px) {
  .campaign-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 0.9fr) minmax(0, 1.1fr);
    padding: 1.25rem;
  }

  .kpi-chip {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .campaign-preview {
    padding: 1rem;
  }

  .content-block-card {
    padding: 0.75rem;
  }
}

@media (max-width: 1280px) {
  .bruno-agent .chat-card {
    max-width: 760px;
  }
}

@media (max-width: 1024px) {
  .bruno-agent .chat-card {
    max-width: 95vw;
  }
}

@media (max-width: 768px) {
  .bruno-agent .chat-bubble {
    max-width: 100%;
  }
}

html.bruno-embedded body.bruno-page {
  background: transparent;
  padding: 0;
}

html.bruno-embedded .slds-builder-header_container {
  display: none;
}

html.bruno-embedded body.bruno-page main {
  padding: 0;
  min-height: 100vh;
  display: block;
}

html.bruno-embedded .bruno-agent .bruno-container {
  width: 100%;
  max-width: none;
  gap: 0.75rem;
  padding: 12px;
  box-sizing: border-box;
  min-height: 100vh;
  display: flex;
  position: relative;
}

html.bruno-embedded .bruno-agent .chat-card {
  max-width: 880px;
  margin: 0 auto;
  min-height: calc(100vh - 32px);
}

@media (max-width: 1280px) {
  html.bruno-embedded .bruno-agent .chat-card {
    max-width: 760px;
  }
}

@media (max-width: 1024px) {
  html.bruno-embedded .bruno-agent .chat-card {
    max-width: 95vw;
  }
}
