/* 线索分发 — 复刻 YCerp pages/clueDistribute */
.view-clue-distribute {
  min-height: 100vh;
  min-height: 100dvh;
  background: #f2f2f7;
}

.cd-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 8px;
  gap: 10px;
  flex-wrap: wrap;
}

.cd-title-main {
  font-size: 18px;
  font-weight: 800;
  color: #1c1c1e;
}

.cd-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cd-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: #007aff;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.cd-form-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 120px;
}

.cd-form-card {
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.cd-section-title {
  font-size: 11px;
  color: #8e8e93;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.cd-section-title.red {
  color: #ff3b30;
}

.cd-form-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  min-height: 54px;
  padding: 0;
  border-bottom: 1px solid #f2f2f7;
  gap: 10px;
}

.cd-form-item:last-child {
  border-bottom: none;
}

.cd-item-label {
  font-size: 14px;
  color: #1c1c1e;
  font-weight: 600;
  white-space: nowrap;
}

.cd-item-label-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cd-form-item > .cd-item-label,
.cd-form-item > .cd-item-label-wrap { align-self: center; }

.cd-dup-tag {
  font-size: 12px;
  color: #ff3b30;
  font-weight: 800;
  background: rgba(255, 59, 48, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.cd-input-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  gap: 8px;
  min-width: 0;
}

.cd-input-ctrl {
  border: none;
  outline: none;
  text-align: right;
  font-size: 14px;
  color: #000;
  flex: 1;
  min-width: 0;
  background: transparent;
  height: 44px;
  line-height: 44px;
}

.cd-input-ctrl.error-text {
  color: #ff3b30;
  font-weight: 700;
}

.cd-date-input {
  border: none;
  outline: none;
  font-size: 14px;
  color: #007aff;
  font-weight: 800;
  background: transparent;
  width: 100%;
  height: 44px;
  line-height: 44px;
  text-align: right;
  box-sizing: border-box;
}

.cd-paste-btn {
  font-size: 11px;
  color: #007aff;
  font-weight: 800;
  background: rgba(0, 122, 255, 0.1);
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.cd-quick-row {
  display: flex;
  gap: 10px;
  margin: 0 6px 8px;
}

.cd-action-btn {
  flex: 1;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  border: 1px solid transparent;
  cursor: pointer;
}

.cd-action-btn.regular {
  background: #ebf5ff;
  color: #007aff;
  border-color: rgba(0, 122, 255, 0.2);
}

.cd-action-btn.group {
  background: #f2f2f7;
  color: #8e8e93;
  border-color: #e5e5ea;
}

.cd-action-btn.group.active {
  background: #e6f9eb;
  color: #34c759;
  border-color: #34c759;
}

.cd-tag-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.cd-tag-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.cd-tag-item {
  padding: 8px 4px;
  background: #f2f2f7;
  border-radius: 8px;
  font-size: 12px;
  color: #8e8e93;
  text-align: center;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
}

.cd-tag-item.active {
  background: #e6f9eb;
  color: #34c759;
  border-color: #34c759;
}

.cd-other-input {
  width: 100%;
  margin-top: 8px;
  font-size: 12px;
  padding: 8px;
  background: #f2f2f7;
  border: none;
  border-radius: 6px;
  box-sizing: border-box;
}

.cd-sales-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cd-auto-rotate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #007aff;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.cd-auto-rotate input {
  width: 16px;
  height: 16px;
  accent-color: #007aff;
  cursor: pointer;
}

.cd-sales-grid.manual-mode .cd-sales-unit {
  cursor: pointer;
}

.cd-sales-grid.auto-mode .cd-sales-unit {
  cursor: default;
}

.cd-sales-grid.auto-mode .cd-sales-unit:not(.on) {
  opacity: 0.88;
}

.cd-sales-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.cd-sales-unit {
  background: #f2f2f7;
  border-radius: 10px;
  padding: 10px 4px 42px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid transparent;
  cursor: pointer;
}

.cd-sales-unit.on {
  background: #ebf5ff;
  border-color: #007aff;
}

.cd-sales-unit.is-off {
  opacity: 0.5;
  filter: grayscale(1);
}

.cd-sales-name {
  font-size: 12px;
  color: #1c1c1e;
  font-weight: 800;
  text-align: center;
}

.cd-check-dot {
  position: absolute;
  top: 2px;
  right: 6px;
  color: #007aff;
  font-size: 11px;
  font-weight: 700;
}

.cd-status-toggle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 11px;
  text-align: center;
  padding: 6px 0;
  color: #fff;
  font-weight: 800;
  border-radius: 0 0 8px 8px;
  border: none;
  cursor: pointer;
}

.cd-status-toggle.on {
  background: #34c759;
}

.cd-status-toggle.off {
  background: #ff3b30;
}

.cd-note-area {
  padding: 6px 0 8px;
}

.cd-note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 6px;
}

.cd-note-input {
  width: 100%;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-sizing: border-box;
  height: 90px;
  font-size: 14px;
  border: none;
  resize: vertical;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.cd-upload-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cd-img-wrap {
  width: 72px;
  height: 72px;
  position: relative;
}

.cd-img-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
}

.cd-del-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  font-size: 14px;
  border: none;
  cursor: pointer;
}

.cd-add-photo {
  width: 72px;
  height: 72px;
  background: #f2f2f7;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #c7c7cc;
  border: none;
  cursor: pointer;
}

.cd-footer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  flex-shrink: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 5;
}

.cd-main-btn {
  width: 100%;
  background: #007aff;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-weight: 800;
  font-size: 16px;
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
}

.cd-main-btn.btn-red {
  background: #ff3b30;
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25);
}

.cd-main-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cd-empty-sales {
  padding: 16px;
  text-align: center;
  color: #8e8e93;
  font-size: 13px;
}

/* 统一字段起始线，并避免横屏工具栏换行错位。 */
.cd-top-bar { flex-wrap: nowrap; }
.cd-top-actions { flex: 1; min-width: 0; flex-wrap: nowrap; }
.cd-top-actions .cd-title-main { margin-right: auto; white-space: nowrap; }
.cd-input-ctrl,
.cd-date-input { text-align: left; }
.cd-date-input { justify-self: stretch; padding: 0; }

@media (max-width: 430px) {
  .cd-top-bar { align-items: flex-start; }
  .cd-top-actions { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
  .cd-top-actions .cd-title-main { grid-column: 1 / -1; }
  .cd-refresh-btn { padding: 6px 9px; }
  .cd-form-item { grid-template-columns: 92px minmax(0, 1fr); }
}
