@antPrefix: ant;

.drawer {
  :global {
    .@{antPrefix}-drawer-content {
      height: 100vh;
    }

    .@{antPrefix}-drawer-body {
      padding: 20px 24px 24px;
      overflow: hidden;
      background: #f6f8fb;
    }

    .@{antPrefix}-form-item {
      margin-bottom: 14px;
    }
  }
}

.body {
  display: grid;
  grid-template-columns: 280px minmax(520px, 1fr) 360px;
  gap: 16px;
  height: calc(100vh - 132px);
  min-height: 0;
}

.sourcePanel,
.mainPanel,
.previewPanel,
.collectConditionCard,
.signalConfigCard,
.importConfigCard {
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #fff;
}

.sourcePanel,
.previewPanel {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.mainPanel {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.sectionHeader {
  margin-bottom: 14px;
}

.sectionTitle {
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  color: #14161a;
}

.sectionDesc {
  margin-top: 4px;
  font-size: 12px;
  line-height: 18px;
  color: #707680;
}

.sourceList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sourceCard {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #fff;
  color: #14161a;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sourceCard:hover {
  border-color: var(--source-accent);
}

.selectedSourceCard {
  border-color: var(--source-accent);
  background: #f8fbff;
  box-shadow: 0 8px 18px rgb(20 22 26 / 8%);
}

.sourceIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  margin-right: 10px;
  border-radius: 8px;
  background: #f2f6fa;
  color: var(--source-accent);
  font-size: 18px;
}

.sourceInfo {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.sourceName {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #14161a;
}

.sourceMeta {
  overflow: hidden;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sourceDetailMeta {
  overflow: hidden;
  color: #8c8f99;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selectedIcon {
  margin-left: 8px;
  color: var(--source-accent);
  font-size: 16px;
}

.bridgeAlert {
  margin-top: 14px;
}

.agentSnapshot {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fbfcfe;
}

.agentHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #14161a;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.agentDetails {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.siteSessionList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.configForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.collectConditionCard,
.signalConfigCard,
.importConfigCard {
  padding: 16px;
}

.conditionSummaryGrid,
.collectorStatusGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.conditionSummaryGrid {
  margin-bottom: 14px;
}

.collectorStatusGrid {
  margin-bottom: 14px;
}

.collectModeSelector {
  margin-bottom: 14px;
}

.conditionSummaryItem {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fbfcfe;
}

.conditionSummaryItem span {
  display: block;
  overflow: hidden;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conditionSummaryItem strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: #14161a;
  font-size: 14px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collectorStatusItem {
  min-height: 112px;
  padding: 14px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fbfcfe;
}

.activeCollectorStatus {
  border-color: #91caff;
  background: #f0f7ff;
}

.disabledCollectorStatus {
  color: #8c8f99;
  background: #f7f8fa;
}

.collectorStatusTop {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collectorStatusIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  background: #fff;
  color: #165dff;
  font-size: 15px;
}

.collectorStatusName {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #14161a;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collectorStatusDesc {
  margin-top: 10px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.connectionConfigBlock {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fbfcfe;
}

.connectionHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.connectionTitle {
  color: #14161a;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.connectionDesc {
  margin-top: 4px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

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

.connectionActionBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.connectionActionBar span {
  min-width: 0;
  overflow: hidden;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browserExtensionBlock {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #b5f5ec;
  border-radius: 8px;
  background: linear-gradient(180deg, #f0fffb 0%, #fff 100%);
}

.browserExtensionHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.browserExtensionTitle {
  color: #14161a;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.browserExtensionDesc {
  margin-top: 4px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.browserExtensionAlert {
  margin-bottom: 10px;
}

.browserExtensionProtocol {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  margin-bottom: 10px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.browserExtensionProtocol code {
  min-width: 0;
  overflow: hidden;
  color: #0958d9;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browserExtensionWarning {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff1f0;
  color: #a8071a;
  font-size: 12px;
  line-height: 18px;
}

.browserExtensionActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.previewHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.scheduleConfigGrid {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(0, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.scheduleHint {
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

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

.fullWidth {
  width: 100%;
}

.metricGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.metricItem {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #f8fafc;
}

.metricItem span {
  display: block;
  overflow: hidden;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metricItem strong {
  display: block;
  margin-top: 4px;
  color: #14161a;
  font-size: 20px;
  line-height: 28px;
}

.previewBlock,
.manifestBlock,
.pipelineBlock,
.taskResultBlock,
.taskHistoryBlock,
.signalBlock {
  padding: 12px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fbfcfe;
}

.manifestBlock,
.pipelineBlock,
.taskResultBlock,
.taskHistoryBlock,
.signalBlock {
  margin-top: 12px;
}

.runAlert {
  margin-top: 12px;
}

.taskResultBlock {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resultLine {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.resultLine strong,
.resultLine code {
  min-width: 0;
  overflow: hidden;
  color: #14161a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskHistoryList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.taskHistoryItem {
  padding: 10px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fff;
}

.taskHistoryTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #14161a;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

.taskHistoryTop span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskHistoryMeta {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 8px;
  margin-top: 6px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.taskHistoryMeta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskHistoryActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.pipelineList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipelineStep {
  padding: 10px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fff;
}

.pipelineStepTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #14161a;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

.pipelineMessage {
  margin-top: 4px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.previewTitle {
  display: block;
  margin-bottom: 8px;
  color: #14161a;
  font-size: 13px;
  font-weight: 600;
}

.previewBlock pre {
  overflow: auto;
  max-height: 300px;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #14161a;
  color: #f8fafc;
  font-size: 12px;
  line-height: 20px;
  white-space: pre-wrap;
}

.manifestLine {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.manifestLine span {
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.manifestLine code {
  overflow-wrap: anywhere;
  color: #14161a;
  font-size: 12px;
  line-height: 18px;
}

.artifactList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.artifactItem {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
}

.artifactItem span {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: #14161a;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
}

.artifactItem code {
  overflow: hidden;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signalGroupList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signalGroupTitle {
  margin-bottom: 6px;
  color: #707680;
  font-size: 12px;
  line-height: 18px;
}

.signalTags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emptyHint {
  color: #8c8f99;
  font-size: 12px;
  line-height: 18px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 1180px) {
  .body {
    grid-template-columns: 240px minmax(420px, 1fr);
  }

  .previewPanel {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 820px) {
  .body {
    grid-template-columns: 1fr;
  }

  .formGrid,
  .signalGrid,
  .connectionFormGrid,
  .scheduleConfigGrid,
  .conditionSummaryGrid,
  .collectorStatusGrid,
  .taskHistoryMeta {
    grid-template-columns: 1fr;
  }
}
