/* ==========================================================================
   详情抽屉 / 查重弹窗 / 生态页/ 池子切换
   ========================================================================== */

/* ==========================================================================
   1. 详情抽屉（宽 640，右侧滑出）
   ========================================================================== */

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.32);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 40;
}

/* JS 统一使用 .on 作为「显示态」类名；.is-open 保留兼容旧写法 */
.drawer-backdrop.on,
.drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--w-drawer);
  height: 100%;
  background: var(--bg-surface);
  box-shadow: var(--sh-float);
  border-radius: var(--r-modal) 0 0 var(--r-modal);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  z-index: 50;
  overflow: hidden;
}

/* JS 统一使用 .on 作为「显示态」类名；.is-open 保留兼容旧写法 */
.drawer.on,
.drawer.is-open {
  transform: translateX(0);
}

.drawer__header {
  padding: var(--s-10);
  display: flex;
  flex-direction: column;
  gap: var(--s-7);
  flex: none;
}

.drawer__badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.drawer__badges {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.drawer__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 0.12s ease;
}

.drawer__close:hover {
  background: var(--bg-muted);
}

.drawer__title {
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  color: var(--text-1);
  margin: 0;
}

.drawer__contact {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.drawer__contact-name {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}

.drawer__contact-loc {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-4);
}

.drawer__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--stroke-focus);
  flex: none;
}

.drawer__actionbar {
  padding: 0 var(--s-10) var(--s-8);
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex: none;
}

.drawer__divider {
  height: 1px;
  background: var(--stroke-subtle);
  flex: none;
}

.drawer__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s-10);
  display: flex;
  flex-direction: column;
  gap: var(--s-9);
}

.drawer__body::-webkit-scrollbar {
  width: 8px;
}

.drawer__body::-webkit-scrollbar-thumb {
  background: #D8D9DE;
  border-radius: 4px;
}

.drawer__body::-webkit-scrollbar-track {
  background: transparent;
}

.section-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
  color: var(--text-1);
  margin: 0 0 var(--s-5);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.section-head .section-title {
  margin: 0;
}

/* 字段网格 */
.field-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-5);
}

.field {
  width: 286px;
  padding: var(--s-6);
  border-radius: var(--r-btn);
  background: #FAFAFC;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.field__label {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-4);
}

.field__value {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field__value--cn {
  font-family: var(--font-cn);
}

/* 关键-值行 */
.info-list {
  display: flex;
  flex-direction: column;
}

.info-row {
  display: flex;
  gap: var(--s-6);
  padding-bottom: var(--s-5);
}

.info-row--last {
  padding-bottom: 0;
}

.info-row__key {
  width: 88px;
  flex: none;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-3);
}

.info-row__value {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-1);
}

.info-row__value--ok {
  color: var(--success-deep);
  font-weight: 500;
}

/* 上下游关联 */
.related-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.related-row {
  display: flex;
  background: #FAFAFC;
  border-radius: var(--r-btn);
  overflow: hidden;
}

.related-row__bar {
  width: 3px;
  flex: none;
  background: var(--primary);
}

.related-row__bar--up {
  background: var(--warning);
}

.related-row__body {
  flex: 1;
  min-width: 0;
  padding: var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.related-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.related-row__name {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-1);
}

.related-row__meta {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-3);
}

.related-row__acts {
  display: flex;
  gap: var(--s-6);
}

.link-btn {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--font-cn);
}

.link-btn:hover {
  text-decoration: underline;
}

/* 时间线 */
.timeline {
  display: flex;
  flex-direction: column;
}

.tl-item {
  display: flex;
  gap: var(--s-6);
}

.tl-rail {
  width: 12px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex: none;
}

.tl-dot--past {
  background: var(--stroke-focus);
}

.tl-line {
  width: 1px;
  flex: 1;
  min-height: 36px;
  background: var(--stroke-subtle);
  margin: 3px 0;
}

.tl-body {
  flex: 1;
  min-width: 0;
  padding-bottom: var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.tl-body--last {
  padding-bottom: 0;
}

.tl-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

.tl-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-1);
}

.tl-time {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-4);
  flex: none;
}

.tl-note {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-3);
}

/* 快速录入 */
.composer {
  padding: var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  flex: none;
  background: var(--bg-surface);
}

.composer__input {
  border: 1px solid var(--stroke-subtle);
  border-radius: var(--r-btn);
  background: #FAFAFC;
  padding: var(--s-5) var(--s-6);
  display: flex;
  align-items: center;
}

.composer__input input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-cn);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-1);
}

.composer__input input::placeholder {
  color: var(--text-4);
}

.composer__input:focus-within {
  border-color: var(--primary);
}

.composer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.composer__hint {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 28px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  border: 1px solid var(--stroke-subtle);
  background: var(--bg-surface);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
  cursor: pointer;
}

.composer__hint:hover {
  border-color: var(--stroke-strong);
}

/* ==========================================================================
   2. 查重拦截弹窗
   ========================================================================== */

.modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: none;
}

/* JS 统一使用 .on 作为「显示态」类名；.is-open 保留兼容旧写法 */
.modal.on,
.modal.is-open {
  display: flex;
}

.modal__backdrop {
  width: 420px;
  flex: none;
  background: #E8EAEE;
  border-radius: var(--r-modal) 0 0 var(--r-modal);
}

.modal__panel {
  flex: 1;
  min-width: 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal__header {
  padding: var(--s-10);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  flex: none;
}

.modal__headtop {
  display: flex;
  align-items: flex-start;
  gap: var(--s-6);
}

.modal__icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: var(--bg-amber-weak);
  display: grid;
  place-items: center;
}

.modal__title {
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  color: var(--text-1);
  margin: 0 0 var(--s-6);
}

.modal__desc {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-3);
  margin: 0;
}

.modal__statbar {
  display: flex;
  gap: var(--s-8);
  padding: var(--s-6);
  border-radius: var(--r-btn);
  background: #FAFAFC;
}

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

.modal__stat-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-4);
}

.modal__stat-value {
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-1);
}

.modal__stat-value.is-danger {
  color: var(--danger-deep);
}

.modal__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--s-10) var(--s-9);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.dup-card {
  padding: var(--s-8);
  border-radius: var(--r-card);
  border: 1.5px solid;
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.dup-card--locked {
  background: var(--bg-danger-bg-2);
  border-color: #F3B8B4;
}

.dup-card--private {
  background: var(--bg-surface);
  border-color: #F5D08A;
}

.dup-card--pool {
  background: var(--bg-surface);
  border-color: #C7C6F5;
}

.dup-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.dup-card__badges {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.dup-card__rate {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}

.dup-card__rate--high { color: var(--danger-deep); }
.dup-card__rate--mid  { color: var(--warning-deep); }
.dup-card__rate--low  { color: var(--primary-ink); }

.dup-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.dup-card__name {
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  color: var(--text-1);
}

.dup-card__reason {
  padding: var(--s-5);
  border-radius: 6px;
  font-size: 12px;
  line-height: 16px;
}

.dup-card--locked .dup-card__reason {
  background: var(--bg-red-weak);
  color: var(--danger-deep);
}

.dup-card--private .dup-card__reason {
  background: var(--bg-amber-weak);
  color: var(--warning-deep);
}

.dup-card--pool .dup-card__reason {
  background: var(--bg-violet-weak);
  color: var(--primary-ink);
}

.dup-card__actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.btn--danger-ghost {
  background: var(--bg-red-weak);
  border-color: var(--danger-deep);
  color: var(--danger-deep);
  font-weight: 500;
}

.btn--danger-ghost:hover {
  background: #F8DADA;
}

.modal__footer {
  padding: var(--s-9);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  flex: none;
  border-top: 1px solid var(--stroke-subtle);
}

.modal__confirm {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  cursor: pointer;
}

.checkbox {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: var(--r-chip);
  background: var(--primary);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.checkbox.is-unchecked {
  background: var(--bg-surface);
  border: 1.5px solid var(--stroke-focus);
}

.checkbox.is-unchecked:hover {
  border-color: var(--primary);
}

.modal__confirm-text {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-2);
}

.modal__btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-4);
}

/* ==========================================================================
   3. 池子切换 Tab（客户资源库）
   ========================================================================== */

.pool-bar {
  display: flex;
  gap: var(--s-2);
  padding: 6px;
  border-radius: var(--r-card);
  background: #E8EBF2;
  flex: none;
}

.pool-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-5);
  border-radius: var(--r-btn);
  font-size: 13px;
  line-height: 18px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  border: 0;
  background: transparent;
  font-family: var(--font-cn);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.pool-tab:hover {
  background: rgba(255, 255, 255, 0.6);
}

.pool-tab.is-active {
  background: var(--bg-surface);
  box-shadow: var(--sh-card);
  color: var(--text-1);
  font-weight: 500;
}

.pool-tab__count {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.pool-tab.is-active .pool-tab__count {
  color: var(--primary);
}

.pool-tab__count.is-locked {
  color: var(--danger-deep);
}

/* 归属徽标 */
.lock-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-chip);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}

.lock-badge--mine    { background: var(--bg-teal-weak); color: var(--success-deep); }
.lock-badge--pool    { background: var(--bg-violet-weak); color: var(--primary-ink); }
.lock-badge--pending { background: var(--bg-amber-weak); color: var(--warning-deep); }
.lock-badge--locked  { background: var(--bg-red-weak); color: var(--danger-deep); }

.td--lock { width: 142px; flex: none; }
.td--check { width: 130px; flex: none; }
.td--country-sm { width: 80px; flex: none; }
.td--dim { width: 26px; flex: none; }

/* 钻取来源条 */
.context-bar {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-6);
  border-radius: var(--r-card);
  background: var(--bg-violet-weak);
  flex: none;
}

.context-bar__icon {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 6px;
  background: var(--primary);
  display: grid;
  place-items: center;
}

.context-bar__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.context-bar__title {
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--primary-ink);
}

.context-bar__sub {
  font-size: 12px;
  line-height: 16px;
  color: #6B63C9;
}

.context-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex: none;
}

/* ==========================================================================
   4. 生态页三列
   ========================================================================== */

.eco-row {
  display: flex;
  gap: var(--s-8);
  flex: 1;
  min-height: 0;
}

.eco-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  overflow: hidden;
}

.eco-col__header {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-8);
  flex: none;
}

.eco-col__icon {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 6px;
}

.eco-col__icon--comp { background: var(--bg-amber-weak); }
.eco-col__icon--up   { background: var(--bg-teal-weak); }
.eco-col__icon--down { background: var(--bg-violet-weak); }

.eco-col__title {
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  color: var(--text-1);
  margin: 0;
}

.eco-col__count {
  margin-left: auto;
  padding: var(--s-3) var(--s-5);
  border-radius: 10px;
  background: var(--bg-muted);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.eco-col__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entity {
  padding: var(--s-6);
  border-radius: var(--r-btn);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  transition: background 0.12s ease;
  cursor: pointer;
}

.entity:hover {
  background: var(--bg-sunken);
}

.entity.is-hit {
  background: var(--bg-violet-weak);
  box-shadow: inset 0 0 0 1.5px var(--primary);
}

.entity.is-dim {
  background: #F5F5F7;
}

.entity.is-dim .entity__name {
  color: var(--text-3);
}

.entity__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.entity__name {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity__meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}