:root {
  --crm-bg: #f4f6f9;
  --crm-sider: #111827;
  --crm-sider-soft: #1f2937;
  --crm-text: #172033;
  --crm-muted: #6b7280;
  --crm-line: #e5e7eb;
  --crm-blue: #1677ff;
  --crm-green: #16a34a;
  --crm-amber: #d97706;
  --crm-red: #dc2626;
  --crm-card: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--crm-text);
  background: var(--crm-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.crm-layout {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--crm-bg);
}

.crm-sider {
  height: 100vh;
  background: var(--crm-sider) !important;
}

.sider-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  color: #d1d5db;
  overflow: hidden;
}

.crm-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  margin-bottom: 22px;
  padding: 0 4px 0 6px;
}

.crm-brand.collapsed {
  justify-content: center;
  padding: 0;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #fff;
  border-radius: 8px;
  background: var(--crm-blue);
  font-weight: 800;
  letter-spacing: .2px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-copy strong {
  display: block;
  color: #fff;
  font-size: 15px;
  line-height: 20px;
}

.brand-copy span {
  display: block;
  color: #9ca3af;
  font-size: 12px;
  line-height: 18px;
}

.sider-toggle {
  flex: 0 0 auto;
  color: #cbd5e1 !important;
  background: rgba(255, 255, 255, .06) !important;
}

.sider-toggle:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, .12) !important;
}

.crm-menu {
  flex: 1;
  min-height: 0;
  overflow: hidden auto;
  border-inline-end: 0 !important;
  background: transparent !important;
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}

.crm-menu.ant-menu-dark .ant-menu-item,
.crm-menu.ant-menu-dark .ant-menu-submenu-title {
  height: 38px;
  line-height: 38px;
  margin: 2px 0;
  border-radius: 8px;
}

.crm-menu.ant-menu-dark .ant-menu-sub {
  background: transparent !important;
}

.crm-menu.ant-menu-dark .ant-menu-item-selected {
  background: var(--crm-sider-soft) !important;
}

.crm-menu.ant-menu-inline-collapsed {
  width: 44px;
  margin: 0 auto;
}

.sider-account {
  display: grid;
  grid-template-columns: 34px 1fr 18px;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  margin-top: 12px;
  padding: 9px 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
}

.sider-account.collapsed {
  grid-template-columns: 34px;
  justify-content: center;
  padding: 9px 0;
}

.sider-account img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.sider-account strong,
.sider-account span {
  display: block;
}

.sider-account strong {
  color: #fff;
  font-size: 13px;
  line-height: 18px;
}

.sider-account span {
  color: #9ca3af;
  font-size: 12px;
  line-height: 18px;
}

.sider-account > .anticon {
  color: #9ca3af;
}

.site-layout {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--crm-bg);
}

.topbar {
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  line-height: normal;
  padding: 0 28px;
  background: rgba(244, 246, 249, .92);
  border-bottom: 1px solid rgba(229, 231, 235, .9);
  backdrop-filter: blur(14px);
}

.crm-content {
  min-width: 0;
  overflow: auto;
  background: var(--crm-bg);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title h1 {
  margin: 2px 0 0;
  color: #111827;
  font-size: 19px;
  line-height: 28px;
}

.topbar-title span {
  color: var(--crm-muted);
  font-size: 13px;
}

.page-breadcrumb {
  line-height: 18px;
}

.page-breadcrumb .ant-breadcrumb-link {
  color: #6b7280;
  font-size: 12px;
}

.workbench {
  min-width: 1040px;
  padding: 24px 28px 32px;
}

.launch-card {
  margin-bottom: 16px;
}

.launch-card,
.batch-card,
.data-card {
  border-radius: 8px;
}

.launch-card .ant-card-body {
  padding: 18px 20px;
}

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

.launch-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.launch-head p {
  max-width: 980px;
  margin: 0;
  color: var(--crm-muted);
  line-height: 22px;
}

.launch-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.advanced-condition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding-top: 4px;
}

.condition-field {
  display: grid;
  gap: 6px;
}

.condition-field label {
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.condition-field .ant-select {
  width: 100%;
}

.condition-note {
  margin: 16px 0 0 !important;
  color: var(--crm-muted);
  font-size: 12px;
}

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

.scope-item {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--crm-line);
  border-radius: 8px;
  background: #fafafa;
}

.scope-item strong,
.scope-item span {
  display: block;
}

.scope-item strong {
  margin-bottom: 4px;
  color: #111827;
  font-size: 14px;
}

.scope-item span {
  color: var(--crm-muted);
  font-size: 12px;
  line-height: 18px;
}

.batch-card .ant-card-body {
  padding: 18px;
}

.batch-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.batch-title h3 {
  margin: 0;
  font-size: 16px;
}

.batch-list {
  display: grid;
  gap: 10px;
}

.batch-item {
  padding: 10px 12px;
  border: 1px solid var(--crm-line);
  border-radius: 8px;
  background: #fff;
}

.batch-item.active {
  border-color: rgba(22, 119, 255, .38);
  background: #f0f6ff;
}

.batch-item strong {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 13px;
}

.batch-item span {
  color: var(--crm-muted);
  font-size: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  border-radius: 8px;
}

.stat-card .ant-statistic-title {
  color: var(--crm-muted);
  font-size: 13px;
}

.stat-card .ant-statistic-content {
  color: #111827;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  margin-bottom: 16px;
}

.candidate-card,
.side-card,
.queue-card {
  border-radius: 8px;
}

.candidate-card .ant-card-body {
  padding: 18px;
}

.candidate-toolbar {
  position: sticky;
  top: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  margin: -18px -18px 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--crm-line);
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.opportunity-cell {
  min-width: 0;
  max-width: 300px;
}

.opportunity-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  min-width: 0;
}

.opportunity-title strong {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opportunity-title .ant-tag {
  flex: 0 0 auto;
}

.opportunity-meta {
  overflow: hidden;
  color: var(--crm-muted);
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 360px;
}

.score-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 2px 8px;
  border: 1px solid rgba(22, 119, 255, .22);
  border-radius: 999px;
  background: #f0f6ff;
}

.score-num {
  color: var(--crm-blue);
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .ant-btn-sm {
  padding-inline: 9px;
}

.status-filter .ant-segmented-item {
  min-width: 72px;
}

.side-card .ant-card-body,
.queue-card .ant-card-body {
  padding: 18px;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.side-title h3 {
  margin: 0;
  font-size: 16px;
}

.queue-list {
  display: grid;
  gap: 8px;
}

.queue-item {
  position: relative;
  padding: 10px 12px;
  padding-left: 40px;
  border: 1px solid var(--crm-line);
  border-radius: 8px;
  background: #fff;
}

.queue-status-icon {
  position: absolute;
  top: 13px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--crm-muted);
}

.queue-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.queue-item-head strong {
  color: #111827;
  font-size: 13px;
}

.queue-item p {
  margin: 0 0 6px;
  color: var(--crm-muted);
  font-size: 12px;
  line-height: 18px;
}

.drawer-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-title strong {
  font-size: 16px;
}

.drawer-title span {
  color: var(--crm-muted);
  font-size: 12px;
}

.score-panel {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: conic-gradient(var(--crm-blue) calc(var(--score) * 1%), #eef2f7 0);
}

.score-ring-inner {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #fff;
}

.score-ring-inner strong {
  display: block;
  color: #111827;
  font-size: 28px;
}

.score-ring-inner span {
  color: var(--crm-muted);
  font-size: 12px;
}

.factor-row {
  display: grid;
  grid-template-columns: 108px 1fr 40px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}

.factor-row span:first-child {
  color: var(--crm-muted);
}

.detail-section {
  margin-top: 18px;
}

.detail-section h4 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 14px;
}

.timeline-note {
  color: var(--crm-muted);
  font-size: 12px;
}

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

.empty-detail {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--crm-muted);
  text-align: center;
}

@media (max-width: 1280px) {
  .ops-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .stat-grid,
  .scope-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    height: auto;
    min-height: 96px;
    padding: 16px;
  }

  .topbar > .ant-space {
    width: 100%;
    flex-wrap: wrap;
  }

  .crm-content {
    overflow: auto;
  }

  .workbench {
    min-width: 860px;
    padding: 16px;
  }

  .stat-grid,
  .scope-grid,
  .ops-grid {
    grid-template-columns: 1fr;
  }
}
