#runtime-integration-panel {
  margin: 0 0 20px;
  border: 1px solid #dfe5ef;
  background: #fff;
  color: #1f2937;
}

.runtime-panel-head,
.runtime-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.runtime-panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid #e7ebf2;
}

.runtime-panel-head h2,
.runtime-section h3 {
  margin: 0;
  letter-spacing: 0;
}

.runtime-panel-head h2 {
  font-size: 18px;
}

.runtime-panel-head p,
.runtime-section-title span {
  margin: 4px 0 0;
  color: #667085;
  font-size: 12px;
}

.runtime-section {
  padding: 18px 20px;
}

.runtime-section + .runtime-section {
  border-top: 1px solid #e7ebf2;
}

.runtime-section h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

.runtime-table-wrap {
  overflow-x: auto;
}

.runtime-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 12px;
}

.runtime-table th,
.runtime-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: top;
}

.runtime-table th {
  background: #f7f9fc;
  color: #475467;
  font-weight: 600;
}

.runtime-table td span {
  color: #667085;
}

.runtime-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 240px;
}

.runtime-actions button,
.runtime-qr-actions button,
.runtime-modal header button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  font-size: 12px;
}

.runtime-actions button:hover,
.runtime-qr-actions button:hover,
.runtime-modal header button:hover {
  border-color: #2f6fed;
  color: #245dcc;
}

#runtime-qr-modal {
  display: none;
}

#runtime-qr-modal.open {
  display: block;
}

.runtime-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 9998;
}

.runtime-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.18);
  z-index: 9999;
  overflow: hidden;
}

.runtime-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e7ebf2;
}

.runtime-modal h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.runtime-qr-body {
  padding: 20px;
}

.runtime-qr-help,
.runtime-qr-countdown,
[data-qr-status] {
  margin: 0 0 12px;
  min-height: 20px;
  color: #667085;
  font-size: 14px;
  line-height: 20px;
}

[data-qr-status] {
  color: #344054;
  font-weight: 600;
}

.runtime-qr-image {
  display: grid;
  place-items: center;
  width: 280px;
  height: 280px;
  margin: 0 auto 14px;
  border: 1px dashed #cfd6e3;
  border-radius: 8px;
  background: #f7f9fc;
  color: #667085;
  overflow: hidden;
}

.runtime-qr-image img {
  width: 240px;
  height: 240px;
  object-fit: contain;
  display: block;
}

.runtime-qr-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.runtime-security-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.runtime-security-box button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
  cursor: pointer;
}

.runtime-security-box span {
  color: #667085;
  font-size: 13px;
}

.runtime-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.runtime-badge.ok {
  color: #067647;
  background: #ecfdf3;
}

.runtime-badge.warn {
  color: #93370d;
  background: #fffaeb;
}

.runtime-badge.bad {
  color: #b42318;
  background: #fef3f2;
}

.runtime-refresh-btn,
.runtime-test-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
  cursor: pointer;
}

.runtime-refresh-btn:hover,
.runtime-test-btn:hover {
  background: #f2f6ff;
}

.runtime-test-btn:disabled {
  border-color: #d0d5dd;
  color: #98a2b3;
  background: #f2f4f7;
  cursor: not-allowed;
}

.runtime-error {
  color: #b42318 !important;
}

.runtime-error-box {
  padding: 16px 20px;
  color: #b42318;
  background: #fef3f2;
}

.runtime-loading,
.runtime-empty {
  padding: 18px 20px;
  color: #667085;
}

body.runtime-chat-active .page > *:not(#runtime-chat-panel),
body.runtime-chat-active main > *:not(#runtime-chat-panel) {
  display: none !important;
}

body.runtime-agent-active .page > *:not(#runtime-agent-panel) {
  display: none !important;
}

body.runtime-store-active .page > *:not(#runtime-store-panel) {
  display: none !important;
}

body.runtime-analysis-active .page > *:not(#runtime-analysis-panel) {
  display: none !important;
}

body.runtime-capability-active .page > *:not(#runtime-capability-panel) {
  display: none !important;
}

#runtime-chat-panel {
  min-height: calc(100vh - 48px);
  background: #f5f7fa;
  color: #172033;
}

.runtime-chat-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid #dde3ec;
  background: #fff;
}

.runtime-chat-page-head h1,
.runtime-chat-detail-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.runtime-chat-page-head h1 {
  font-size: 22px;
}

.runtime-chat-page-head p,
.runtime-chat-detail-head p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 12px;
}

.runtime-chat-toolbar,
.runtime-chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runtime-chat-toolbar input {
  width: 220px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
}

.runtime-chat-toolbar button,
.runtime-chat-actions button,
.runtime-reply-box button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  cursor: pointer;
}

.runtime-chat-actions button.primary {
  border-color: #2f6fed;
  background: #2f6fed;
  color: #fff;
}

.runtime-chat-actions button:disabled,
.runtime-reply-box button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.runtime-chat-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  height: calc(100vh - 138px);
  min-height: 560px;
}

.runtime-chat-filters {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid #dde3ec;
  background: #fff;
}

.runtime-chat-filters select {
  height: 32px;
  min-width: 132px;
  padding: 0 8px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  font-size: 12px;
}

.runtime-chat-list {
  overflow: hidden;
  border-right: 1px solid #dde3ec;
  background: #fff;
}

.runtime-chat-list-head {
  height: 44px;
  padding: 13px 16px;
  border-bottom: 1px solid #e7ebf2;
  color: #475467;
  font-size: 12px;
  font-weight: 600;
}

#runtime-conversation-list {
  height: calc(100% - 44px);
  overflow-y: auto;
}

.runtime-conversation {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.runtime-conversation:hover {
  background: #f8faff;
}

.runtime-conversation.selected {
  border-left-color: #2f6fed;
  background: #eef4ff;
}

.runtime-conversation-top,
.runtime-conversation-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.runtime-conversation-top strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-conversation-top time,
.runtime-conversation-meta,
.runtime-conversation-last {
  color: #667085;
  font-size: 11px;
}

.runtime-conversation-meta,
.runtime-conversation-last {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-conversation-last {
  color: #344054;
  font-size: 12px;
}

.runtime-conversation-foot {
  margin-top: 9px;
}

.runtime-mode {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border-radius: 4px;
  background: #f2f4f7;
  color: #475467;
  font-size: 11px;
}

.runtime-mode.ok {
  background: #ecfdf3;
  color: #067647;
}

.runtime-mode.warn {
  background: #fffaeb;
  color: #93370d;
}

.runtime-unread {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  border-radius: 10px;
  background: #d92d20;
  color: #fff;
  font-size: 10px;
}

.runtime-chat-detail {
  display: grid;
  min-width: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #f8fafc;
}

.runtime-chat-body {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 260px;
}

.runtime-chat-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 20px;
  border-bottom: 1px solid #e1e6ee;
  background: #fff;
}

.runtime-chat-detail-head h2 {
  font-size: 16px;
}

.runtime-agent-strip {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  padding: 9px 20px;
  border-bottom: 1px solid #e1e6ee;
  background: #f9fafb;
  font-size: 11px;
}

.runtime-agent-strip span {
  color: #667085;
}

.runtime-agent-strip strong {
  color: #344054;
}

.runtime-messages {
  overflow-y: auto;
  padding: 22px;
}

.runtime-chat-sidebar {
  overflow-y: auto;
  border-left: 1px solid #dde3ec;
  background: #fff;
}

.runtime-chat-sidebar section {
  padding: 14px 16px;
  border-bottom: 1px solid #edf0f5;
}

.runtime-chat-sidebar h3 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0;
}

.runtime-chat-sidebar section > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
}

.runtime-chat-sidebar section > div span,
.runtime-chat-sidebar label {
  color: #667085;
}

.runtime-chat-sidebar section > div strong {
  max-width: 150px;
  color: #344054;
  text-align: right;
  word-break: break-word;
}

.runtime-chat-sidebar button {
  width: 100%;
  min-height: 32px;
  margin-top: 8px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  cursor: pointer;
}

.runtime-chat-sidebar textarea {
  width: 100%;
  min-height: 72px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  resize: vertical;
}

.runtime-message {
  display: flex;
  max-width: 72%;
  margin-bottom: 16px;
  flex-direction: column;
}

.runtime-message.customer {
  align-items: flex-start;
}

.runtime-message.assistant {
  align-items: flex-end;
  margin-left: auto;
}

.runtime-message-label,
.runtime-message-status {
  margin: 0 2px 5px;
  color: #667085;
  font-size: 10px;
}

.runtime-message-status {
  margin-top: 5px;
}

.runtime-bubble {
  padding: 10px 13px;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.runtime-message.assistant .runtime-bubble {
  border-color: #bcd0f8;
  background: #eaf2ff;
}

.runtime-reply-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 13px 16px;
  border-top: 1px solid #dde3ec;
  background: #fff;
}

.runtime-reply-box textarea {
  min-height: 56px;
  resize: none;
  padding: 10px;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  background: #f2f4f7;
  color: #667085;
}

.runtime-reply-status {
  grid-column: 1 / -1;
  min-height: 16px;
  color: #667085;
  font-size: 11px;
}

.runtime-chat-empty {
  display: grid;
  min-height: 180px;
  padding: 24px;
  place-items: center;
  color: #667085;
  font-size: 13px;
}

#runtime-agent-panel {
  min-height: calc(100vh - 120px);
  background: #f5f7fa;
  color: #172033;
}

#runtime-store-panel {
  min-height: calc(100vh - 120px);
  background: #f5f7fa;
  color: #172033;
}

.runtime-store-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #dde3ec;
  background: #fff;
}

.runtime-store-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.runtime-store-head p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 12px;
}

.runtime-store-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runtime-store-actions button,
.runtime-store-form-actions button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
  cursor: pointer;
}

.runtime-store-actions button:hover,
.runtime-store-form-actions button:hover {
  background: #f2f6ff;
}

.runtime-store-table {
  min-width: 900px;
}

.runtime-store-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runtime-store-select-row select {
  flex: 1;
  min-width: 0;
}

.runtime-store-select-row button,
.runtime-inline-link {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.runtime-store-select-row button:hover,
.runtime-inline-link:hover {
  border-color: #2f6fed;
  background: #f2f6ff;
}

#runtime-store-modal {
  display: none;
}

#runtime-store-modal.open {
  display: block;
}

.runtime-store-modal {
  max-width: 720px;
}

.runtime-store-modal form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.runtime-store-modal label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-size: 12px;
}

.runtime-store-modal label.wide,
.runtime-store-form-actions {
  grid-column: 1 / -1;
}

.runtime-store-modal input,
.runtime-store-modal textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #172033;
  font: inherit;
}

.runtime-store-modal textarea {
  resize: vertical;
}

.runtime-store-modal .runtime-check {
  display: flex;
  align-items: center;
  grid-column: 1 / -1;
}

.runtime-store-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.runtime-store-form-actions span {
  color: #667085;
  font-size: 12px;
}

.runtime-agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #dde3ec;
  background: #fff;
}

.runtime-agent-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.runtime-agent-head p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 12px;
}

.runtime-agent-head button,
.runtime-agent-form-actions button,
.runtime-agent-test button,
.runtime-channel-bindings button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
  cursor: pointer;
}

.runtime-agent-shell {
  display: grid;
  min-height: calc(100vh - 130px);
  grid-template-columns: 260px minmax(0, 1fr);
}

.runtime-agent-shell > aside {
  border-right: 1px solid #dde3ec;
  background: #fff;
}

.runtime-agent-shell > aside > button {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.runtime-agent-shell > aside > button.selected {
  border-left-color: #2f6fed;
  background: #eef4ff;
}

.runtime-agent-shell > aside strong,
.runtime-agent-shell > aside span {
  display: block;
}

.runtime-agent-shell > aside strong {
  font-size: 13px;
}

.runtime-agent-shell > aside span {
  margin-top: 5px;
  color: #667085;
  font-size: 11px;
}

.runtime-agent-shell > main {
  display: flex;
  min-height: 0;
  min-width: 0;
  max-height: calc(100vh - 130px);
  flex-direction: column;
  background: #fff;
}

.runtime-agent-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid #dde3ec;
}

.runtime-agent-tabs button {
  min-width: 92px;
  min-height: 44px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: #fff;
  color: #475467;
  cursor: pointer;
}

.runtime-agent-tabs button.selected {
  border-bottom-color: #2f6fed;
  color: #245dcc;
  font-weight: 600;
}

#runtime-agent-form {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.runtime-agent-form-body {
  min-height: 0;
  padding: 22px 22px 96px;
  overflow-y: auto;
}

.runtime-agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.runtime-agent-grid label,
.runtime-json-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #475467;
  font-size: 12px;
}

.runtime-agent-grid label.wide,
.runtime-agent-grid .wide {
  grid-column: 1 / -1;
}

.runtime-agent-grid input,
.runtime-agent-grid select,
.runtime-agent-grid textarea,
.runtime-json-field textarea,
.runtime-agent-test input {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #172033;
}

.runtime-agent-grid textarea {
  min-height: 92px;
  resize: vertical;
}

.runtime-agent-grid label.runtime-check {
  flex-direction: row;
  align-items: center;
}

.runtime-agent-grid label.runtime-check input {
  min-height: auto;
}

.runtime-agent-test {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.runtime-agent-test pre {
  grid-column: 1 / -1;
  min-height: 70px;
  margin: 0;
  padding: 12px;
  border: 1px solid #e1e6ee;
  background: #f8fafc;
  color: #475467;
  white-space: pre-wrap;
}

.runtime-agent-form-actions {
  position: sticky;
  z-index: 4;
  bottom: 0;
  display: flex;
  align-items: center;
  min-height: 66px;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #edf0f5;
  box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
  background: #fff;
}

.runtime-agent-form-actions button:first-child {
  background: #2f6fed;
  color: #fff;
}

.runtime-agent-form-actions button:disabled {
  border-color: #d0d5dd;
  background: #f2f4f7;
  color: #98a2b3;
  cursor: not-allowed;
}

.runtime-agent-form-actions span {
  color: #667085;
  font-size: 12px;
}

.runtime-capability-list > div,
.runtime-channel-bindings > div {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) auto;
  gap: 14px;
  padding: 12px;
  border-bottom: 1px solid #edf0f5;
}

.runtime-capability-list span,
.runtime-channel-bindings span {
  color: #667085;
  font-size: 12px;
}

.runtime-capability-list button:disabled {
  min-height: 30px;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  background: #f2f4f7;
  color: #98a2b3;
}

.runtime-skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.runtime-skill-grid label {
  padding: 12px;
  border: 1px solid #e1e6ee;
  border-radius: 4px;
}

.runtime-json-field span,
.runtime-info-box {
  padding: 10px;
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
}

#runtime-analysis-panel {
  min-height: 520px;
  background: #fff;
  color: #172033;
}

#runtime-capability-panel {
  min-height: 520px;
  background: #fff;
  color: #172033;
}

.runtime-capability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 24px;
}

.runtime-capability-grid article {
  padding: 16px;
  border: 1px solid #e1e6ee;
  border-radius: 6px;
  background: #fff;
}

.runtime-capability-grid h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.runtime-capability-grid p {
  margin: 9px 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
}

.runtime-capability-grid button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
}

.runtime-capability-grid button:disabled {
  border-color: #d0d5dd;
  background: #f2f4f7;
  color: #98a2b3;
}

.runtime-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #dde3ec;
}

.runtime-analysis-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.runtime-analysis-head p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 12px;
}

.runtime-analysis-head button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
}

.runtime-analysis-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid #edf0f5;
}

.runtime-analysis-metrics > div {
  padding: 22px;
  border-right: 1px solid #edf0f5;
}

.runtime-analysis-metrics span,
.runtime-analysis-metrics strong {
  display: block;
}

.runtime-analysis-metrics span {
  color: #667085;
  font-size: 12px;
}

.runtime-analysis-metrics strong {
  margin-top: 8px;
  font-size: 26px;
}

#runtime-analysis-panel > .runtime-info-box {
  margin: 20px 24px;
}

@media (max-width: 720px) {
  body.runtime-chat-active .sidebar {
    display: none !important;
  }

  body.runtime-agent-active .sidebar {
    display: none !important;
  }

  body.runtime-store-active .sidebar {
    display: none !important;
  }

  body.runtime-analysis-active .sidebar {
    display: none !important;
  }

  body.runtime-capability-active .sidebar {
    display: none !important;
  }

  body.runtime-capability-active .main-area,
  body.runtime-capability-active .content-area,
  body.runtime-capability-active .page {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.runtime-analysis-active .main-area,
  body.runtime-analysis-active .content-area,
  body.runtime-analysis-active .page {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.runtime-agent-active .main-area,
  body.runtime-agent-active .content-area,
  body.runtime-agent-active .page {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.runtime-store-active .main-area,
  body.runtime-store-active .content-area,
  body.runtime-store-active .page {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.runtime-chat-active .main-area,
  body.runtime-chat-active .content-area,
  body.runtime-chat-active .page {
    width: 100% !important;
    min-width: 0 !important;
  }

  .runtime-panel-head,
  .runtime-section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .runtime-section {
    padding: 14px;
  }

  .runtime-chat-page-head,
  .runtime-chat-detail-head,
  .runtime-agent-strip,
  .runtime-chat-filters {
    align-items: flex-start;
    flex-direction: column;
  }

  .runtime-chat-toolbar {
    width: 100%;
  }

  .runtime-chat-toolbar input {
    width: 100%;
  }

  .runtime-chat-shell {
    display: block;
    height: auto;
    min-height: 0;
  }

  .runtime-chat-list {
    max-height: 300px;
    border-right: 0;
    border-bottom: 1px solid #dde3ec;
  }

  #runtime-conversation-list {
    max-height: 256px;
  }

  .runtime-chat-detail {
    min-height: 620px;
  }

  .runtime-chat-filters select {
    width: 100%;
  }

  .runtime-chat-body {
    display: block;
  }

  .runtime-chat-sidebar {
    border-top: 1px solid #dde3ec;
    border-left: 0;
  }

  .runtime-message {
    max-width: 88%;
  }

  .runtime-agent-shell {
    display: block;
    max-height: none;
  }

  .runtime-store-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .runtime-store-select-row {
    align-items: stretch;
    flex-direction: column;
  }

  .runtime-store-modal form {
    grid-template-columns: 1fr;
  }

  .runtime-store-modal label.wide,
  .runtime-store-form-actions {
    grid-column: auto;
  }

  .runtime-agent-shell > aside {
    max-height: 220px;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid #dde3ec;
  }

  .runtime-agent-shell > main {
    max-height: none;
  }

  #runtime-agent-form {
    min-height: 520px;
  }

  .runtime-agent-form-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .runtime-agent-grid,
  .runtime-skill-grid {
    grid-template-columns: 1fr;
  }

  .runtime-agent-grid label.wide,
  .runtime-agent-grid .wide {
    grid-column: auto;
  }

  .runtime-capability-list > div,
  .runtime-channel-bindings > div {
    grid-template-columns: 1fr;
  }

  .runtime-analysis-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .runtime-capability-grid {
    grid-template-columns: 1fr;
  }
}


/* Chat workbench must replace the current page content instead of being appended below it. */
body.runtime-chat-active {
  overflow: hidden !important;
}

body.runtime-chat-active .page,
body.runtime-chat-active main {
  min-height: 0 !important;
  overflow: hidden !important;
}

body.runtime-chat-active .page {
  display: flex !important;
  flex-direction: column !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

body.runtime-chat-active #runtime-chat-panel {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

#runtime-chat-panel[hidden] {
  display: none !important;
}

body.runtime-chat-active .runtime-chat-shell {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
}

body.runtime-chat-active .runtime-chat-list,
body.runtime-chat-active .runtime-messages,
body.runtime-chat-active .runtime-chat-sidebar {
  min-height: 0 !important;
  overflow-y: auto !important;
}


/* Runtime chat mounts inside the app main area so the global sidebar stays visible. */
body.runtime-chat-active #root {
  min-height: 100vh !important;
}

body.runtime-chat-active .main-area,
body.runtime-chat-active .content-area {
  min-height: 0 !important;
  height: 100vh !important;
  overflow: hidden !important;
}

body.runtime-chat-active .main-area > *:not(#runtime-chat-panel),
body.runtime-chat-active .content-area > *:not(#runtime-chat-panel) {
  display: none !important;
}

body.runtime-chat-active .main-area > #runtime-chat-panel,
body.runtime-chat-active .content-area > #runtime-chat-panel {
  height: 100% !important;
}


/* When real aggregate chat is active, old chat shell siblings are detached from DOM by JS. */
body.runtime-chat-active .main-area > #runtime-chat-panel + *,
body.runtime-chat-active .content-area > #runtime-chat-panel + * {
  display: none !important;
}


/* Final aggregate conversation workbench layout: one viewport, internal scrolling only. */
body.runtime-chat-active #runtime-chat-panel {
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

body.runtime-chat-active .runtime-chat-page-head,
body.runtime-chat-active .runtime-chat-filters {
  flex: 0 0 auto !important;
}

body.runtime-chat-active .runtime-chat-shell {
  display: grid !important;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr) !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.runtime-chat-active .runtime-chat-list {
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  border-right: 1px solid #dde3ec !important;
  border-bottom: 0 !important;
}

body.runtime-chat-active #runtime-conversation-list {
  height: calc(100% - 44px) !important;
  max-height: none !important;
  overflow-y: auto !important;
}

body.runtime-chat-active .runtime-chat-detail {
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) auto !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

body.runtime-chat-active .runtime-chat-body {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 260px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.runtime-chat-active .runtime-messages {
  min-height: 0 !important;
  overflow-y: auto !important;
}

body.runtime-chat-active .runtime-chat-sidebar {
  min-height: 0 !important;
  min-width: 0 !important;
  overflow-y: auto !important;
  border-left: 1px solid #dde3ec !important;
  border-top: 0 !important;
}

body.runtime-chat-active .runtime-reply-box {
  flex: 0 0 auto !important;
}

@media (max-width: 900px) {
  body.runtime-chat-active .runtime-chat-shell {
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) !important;
  }
  body.runtime-chat-active .runtime-chat-body {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.runtime-chat-active .runtime-chat-sidebar {
    display: none !important;
  }
}


/* Channel route replaces the current page body; home cards must not remain visible below it. */
body.runtime-channel-active .page > *:not(#runtime-integration-panel) {
  display: none !important;
}

body.runtime-channel-active .page > #runtime-integration-panel {
  display: block !important;
}

.runtime-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.runtime-link-btn {
  min-height: 30px;
  margin: 0 0 8px;
  padding: 0 10px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  font-size: 12px;
}

.runtime-channel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.runtime-channel-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dfe5ef;
  border-radius: 6px;
  background: #fff;
}

.runtime-channel-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font-weight: 700;
}

.runtime-channel-main h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.runtime-channel-main p {
  margin: 0 0 8px;
  color: #667085;
  font-size: 12px;
}

.runtime-channel-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.runtime-channel-stats span {
  padding: 3px 8px;
  border: 1px solid #e7ebf2;
  border-radius: 999px;
  background: #f7f9fc;
  color: #475467;
  font-size: 12px;
}

.runtime-account-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
}

.runtime-account-toolbar input,
.runtime-account-toolbar select,
.runtime-add-steps input,
.runtime-add-steps select {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #cfd6e3;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  font-size: 12px;
}

#runtime-add-douyin-modal {
  display: none;
}

#runtime-add-douyin-modal.open {
  display: block;
}

.runtime-add-modal {
  max-width: 720px;
}

.runtime-add-steps {
  display: grid;
  gap: 14px;
}

.runtime-add-steps section {
  padding: 12px;
  border: 1px solid #e7ebf2;
  border-radius: 6px;
  background: #fff;
}

.runtime-add-steps h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.runtime-add-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.runtime-add-methods button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #245dcc;
  cursor: pointer;
}

.runtime-add-methods button:disabled {
  border-color: #d0d5dd;
  color: #98a2b3;
  background: #f2f4f7;
  cursor: not-allowed;
}
