:root {
  --sales: var(--blue, #2f66e8);
  --sales-dark: var(--blue-dark, #275bd5);
  --sales-soft: var(--blue-soft, #eef4ff);
  --sales-border: color-mix(in srgb, var(--sales, #2f66e8) 28%, var(--surface-raised, #fff));
}

body[data-layout-page^="sales-"] [hidden] {
  display: none !important;
}

.sales-app,
.sales-page {
  min-height: calc(100vh - var(--app-chrome-height, 131px));
  background: var(--page-bg, #f8fbff);
}

.sales-page {
  padding: 20px 20px 76px;
}

.sales-shell {
  color: var(--text, #0f172a);
}

.sales-heading,
.sales-context,
.sales-card-head,
.sales-toolbar,
.sales-table-footer,
.sales-page-size,
.sales-view-tabs,
.sales-row-actions,
.sales-mini-row,
.sales-score,
.sales-pool-pill,
.sales-rule-row,
.sales-modal-lead,
.sales-chip-row {
  display: flex;
  align-items: center;
}

.sales-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.sales-heading h1 {
  margin: 0;
  color: var(--text-strong, #0f172a);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 950;
  letter-spacing: 0;
}

.sales-heading p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted, #64748b);
  line-height: 1.5;
  font-weight: 750;
}

body[data-layout-page="sales-dashboard"] .sales-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(348px, 392px);
  align-items: start;
  gap: 18px 24px;
}

body[data-layout-page="sales-dashboard"] .sales-heading p {
  max-width: 660px;
}

.sales-context {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

body[data-layout-page="sales-dashboard"] .sales-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  justify-content: stretch;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 88%, var(--surface-soft, #f7faff));
}

.sales-context label,
.sales-filter-field {
  display: grid;
  gap: 7px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 900;
}

.sales-context select,
.sales-filter-field input,
.sales-filter-field select,
.sales-modal-form input,
.sales-modal-form select,
.sales-modal-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border, #d8e1ef);
  border-radius: 8px;
  background: var(--input-bg, #fff);
  color: var(--text, #0f172a);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0;
}

.sales-context select {
  width: 168px;
  height: 40px;
  padding: 0 12px;
}

body[data-layout-page="sales-dashboard"] .sales-context select {
  width: 100%;
}

/* 自适应列数：客户池 5 个 KPI 也不会掉行留空 */
.sales-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

body[data-layout-page="sales-dashboard"] .sales-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.sales-kpi-card,
.sales-card,
.sales-filter-panel,
.sales-table-card {
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-kpi-card {
  position: relative;
  min-width: 0;
  min-height: 116px;
  overflow: hidden;
  padding: 17px 17px 16px;
}

.sales-kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--kpi-accent, var(--sales));
}

.sales-kpi-card.public {
  --kpi-accent: var(--blue, #2f66e8);
}

.sales-kpi-card.private {
  --kpi-accent: var(--success, #059669);
}

.sales-kpi-card.task {
  --kpi-accent: var(--warning, #c2410c);
}

.sales-kpi-card.money {
  --kpi-accent: var(--purple, #7c3aed);
}

.sales-kpi-card span,
.sales-card-kicker,
.sales-mini-row small,
.sales-table small,
.sales-rule-row span,
.sales-modal-lead span {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-kpi-card strong {
  display: block;
  margin-top: 11px;
  color: var(--text-strong, #0f172a);
  font-size: 26px;
  line-height: 1.05;
  font-weight: 950;
}

.sales-kpi-card em {
  display: inline-flex;
  margin-top: 10px;
  color: var(--sales);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.sales-action-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.sales-action-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-action-card header,
.sales-action-item,
.sales-snapshot-head,
.sales-drawer footer {
  display: flex;
  align-items: center;
}

.sales-action-card header {
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
}

.sales-action-card header > div {
  min-width: 0;
}

.sales-action-card h2 {
  margin: 4px 0 0;
  color: var(--text-strong, #0f172a);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 950;
  letter-spacing: 0;
}

.sales-action-card header > strong {
  flex: 0 0 38px;
  min-width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--sales-soft);
  color: var(--sales);
  font-size: 18px;
  font-weight: 950;
}

.sales-action-card.amber header > strong {
  background: var(--warning-soft, #fff7ed);
  color: var(--warning, #c2410c);
}

.sales-action-card.red header > strong {
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

.sales-action-card.green header > strong {
  background: var(--success-soft, #ecfdf5);
  color: var(--success, #059669);
}

.sales-action-list {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.sales-action-item {
  min-width: 0;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
  color: inherit;
  text-decoration: none;
}

.sales-action-item:hover {
  border-color: var(--sales-border, #c7d8ff);
  background: color-mix(in srgb, var(--sales-soft) 54%, var(--surface-raised, #fff));
}

.sales-action-main {
  flex: 1 1 auto;
  min-width: 0;
}

.sales-action-main strong,
.sales-action-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-action-main strong {
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 920;
}

.sales-action-main small {
  margin-top: 4px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.sales-action-link {
  align-self: end;
  justify-self: start;
  min-height: 32px;
}

.sales-card {
  min-width: 0;
  padding: 20px;
}

body[data-layout-page="sales-dashboard"] .sales-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

body[data-layout-page="sales-dashboard"] .sales-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.95fr);
  gap: 16px;
  align-items: stretch;
}

body[data-layout-page="sales-dashboard"] .sales-dashboard-tasks {
  grid-column: 1 / 2;
}

body[data-layout-page="sales-dashboard"] .sales-dashboard-rules {
  grid-column: 2 / 3;
}

body[data-layout-page="sales-dashboard"] .sales-dashboard-funnel {
  grid-column: 1 / 2;
}

body[data-layout-page="sales-dashboard"] .sales-dashboard-recommend {
  grid-column: 2 / 3;
}

body[data-layout-page="sales-dashboard"] .sales-dashboard-escalation {
  grid-column: 1 / -1;
}

.sales-settings-grid,
.sales-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.sales-wide-card {
  grid-column: 1 / -1;
}

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

.sales-config-form label,
.sales-check-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.sales-config-form label span,
.sales-check-field span {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-config-form input,
.sales-config-form select,
.sales-config-table input,
.sales-config-table select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-light, #dbe5f2);
  border-radius: 8px;
  background: var(--surface-raised, #fff);
  color: var(--text-strong, #0f172a);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  padding: 10px 11px;
}

.sales-check-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-self: end;
  border: 1px solid var(--border-light, #dbe5f2);
  border-radius: 8px;
  padding: 10px 11px;
}

.sales-check-field input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.sales-config-table {
  overflow-x: auto;
  margin-bottom: 16px;
}

.sales-config-table .sales-table {
  min-width: 620px;
}

.sales-lead-preview {
  margin: 2px 0 16px;
}

.sales-preview-grid {
  display: grid;
  gap: 10px;
}

.sales-alert-row {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--border-light, #dbe5f2);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
  padding: 12px;
}

.sales-alert-row strong {
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 920;
}

.sales-alert-row span {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 760;
}

.sales-alert-row.success {
  border-color: rgba(5, 150, 105, 0.28);
  background: rgba(5, 150, 105, 0.08);
}

.sales-alert-row.danger {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.08);
}

.sales-table-wrap.compact {
  max-height: 420px;
}

.sales-card-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

body[data-layout-page="sales-dashboard"] .sales-card-head {
  align-items: flex-start;
  margin-bottom: 16px;
}

.sales-card-head h2 {
  margin: 0;
  color: var(--text-strong, #0f172a);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 950;
  letter-spacing: 0;
}

.sales-link-action,
.sales-text-button {
  border: 0;
  background: transparent;
  color: var(--sales);
  font-weight: 900;
}

.sales-link-action {
  white-space: nowrap;
}

.sales-task-list,
.sales-recommend-list,
.sales-rule-list,
.sales-funnel-list {
  display: grid;
  gap: 10px;
}

body[data-layout-page="sales-dashboard"] :is(.sales-task-list, .sales-recommend-list, .sales-rule-list, .sales-funnel-list) {
  flex: 1;
  align-content: start;
}

body[data-layout-page="sales-dashboard"] .sales-rule-list {
  align-content: start;
  gap: 0;
  padding: 2px 0;
}

body[data-layout-page="sales-dashboard"] .sales-funnel-list {
  gap: 13px;
}

.sales-mini-row {
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
}

body[data-layout-page="sales-dashboard"] .sales-mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 64px;
  padding: 12px 14px;
}

.sales-mini-main {
  min-width: 0;
}

.sales-mini-main strong,
.sales-table strong,
.sales-modal-lead strong {
  display: block;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-mini-main small,
.sales-table small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-row-actions {
  flex: 0 0 auto;
  gap: 8px;
  justify-content: flex-end;
}

.sales-action,
.sales-secondary,
.sales-danger,
.sales-icon-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: 7px;
  font-weight: 900;
  white-space: nowrap;
}

.sales-action {
  border: 0;
  background: var(--sales);
  color: #fff;
  box-shadow: 0 8px 18px rgba(var(--blue-rgb), 0.18);
}

.sales-action:hover {
  background: var(--sales-dark);
}

.sales-secondary,
.sales-icon-action {
  border: 1px solid var(--border, #d8e1ef);
  background: var(--surface-raised, #fff);
  color: var(--text, #0f172a);
}

.sales-secondary:hover,
.sales-icon-action:hover {
  border-color: var(--sales-border, #c7d8ff);
  background: var(--sales-soft);
  color: var(--sales);
}

.sales-danger {
  border: 1px solid var(--danger-soft, #fff1f2);
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

.sales-action:disabled,
.sales-secondary:disabled,
.sales-danger:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.sales-rule-row {
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

.sales-rule-row:last-child {
  border-bottom: 0;
}

.sales-rule-row strong {
  color: var(--text-strong, #0f172a);
  font-size: 18px;
  font-weight: 950;
  white-space: nowrap;
}

.sales-funnel-row {
  display: grid;
  grid-template-columns: minmax(96px, 132px) minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
}

.sales-funnel-row span {
  color: var(--text, #0f172a);
  font-size: 13px;
  font-weight: 850;
}

.sales-funnel-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted, #f3f6fb);
}

.sales-funnel-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--sales);
}

.sales-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 22px;
  border: 1px dashed var(--border, #d8e1ef);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
  color: var(--muted, #64748b);
  text-align: center;
  font-weight: 850;
}

.sales-empty.compact {
  min-height: 56px;
  padding: 12px;
}

.sales-filter-panel {
  margin: 0 0 16px;
  padding: 16px;
}

.sales-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 12px;
  align-items: end;
}

.sales-filter-field { min-width: 0; }
.sales-filter-field :is(input, select) { width: 100%; min-width: 0; }
.sales-form-hint.full { grid-column: 1 / -1; }
.sales-form-hint, .sales-data-note {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 12px;
  line-height: 1.7;
}
.sales-data-note {
  margin: 12px 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-muted, #f3f6fb);
}
.sales-detail-contact, .sales-detail-buttons { display: grid; gap: 10px; margin-top: 16px; }
.sales-detail-contact span { color: var(--muted, #64748b); font-size: 12px; }
.sales-detail-contact strong { overflow-wrap: anywhere; font-size: 13px; }
.sales-detail-buttons :is(a, button) { justify-content: center; text-align: center; }
.sales-detail-panel h2 { margin: 6px 0; font-size: 15px; }
.sales-record { padding: 14px 0; border-bottom: 1px solid var(--border-light, #e8edf5); }
.sales-record header { display: grid; gap: 6px; }
.sales-record small { color: var(--muted, #64748b); }
.sales-record p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.7; }
.sales-detail-stat strong { white-space: normal; overflow-wrap: anywhere; }

.sales-filter-field input,
.sales-filter-field select {
  height: 42px;
  padding: 0 12px;
}

.sales-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sales-view-tabs {
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  margin: 0 0 16px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-muted, #f3f6fb);
}

.sales-view-tabs button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #64748b);
  font-weight: 900;
  white-space: nowrap;
}

.sales-view-tabs button.active {
  background: var(--surface-raised, #fff);
  color: var(--sales);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-table-card {
  overflow: hidden;
}

.sales-toolbar {
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

.sales-toolbar strong {
  color: var(--text-strong, #0f172a);
  font-weight: 950;
}

.sales-toolbar span {
  display: block;
  margin-top: 3px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

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

.sales-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
}

.sales-table th,
.sales-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light, #e8edf5);
  text-align: left;
  vertical-align: middle;
}

.sales-table th {
  color: var(--muted, #64748b);
  background: var(--surface-soft, #f7faff);
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.sales-table td {
  color: var(--text, #0f172a);
  font-weight: 780;
}

.sales-table tr:hover td {
  background: color-mix(in srgb, var(--sales-soft) 42%, transparent);
}

.sales-table tr.is-focused td {
  background: color-mix(in srgb, var(--sales-soft) 72%, var(--surface-raised, #fff));
}

.sales-table .actions-cell {
  position: sticky;
  right: 0;
  z-index: 1;
  width: 1%;
  background: var(--surface-raised, #fff);
  box-shadow: -12px 0 18px rgba(15, 23, 42, 0.04);
}

.sales-tag-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.sales-mini-chip {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  max-width: 132px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 999px;
  background: var(--surface-muted, #f3f6fb);
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-pool-pill,
.sales-status-pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.sales-pool-pill.public {
  background: var(--sales-soft);
  color: var(--sales);
}

.sales-pool-pill.private {
  background: var(--success-soft, #ecfdf5);
  color: var(--success, #059669);
}

.sales-status-pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.sales-status-pill.green {
  background: var(--success-soft, #ecfdf5);
  color: var(--success, #059669);
}

.sales-status-pill.amber {
  background: var(--warning-soft, #fff7ed);
  color: var(--warning, #c2410c);
}

.sales-status-pill.red {
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

.sales-status-pill.purple {
  background: var(--purple-soft, #f3e8ff);
  color: var(--purple, #7c3aed);
}

.sales-status-pill.slate {
  background: var(--surface-muted, #f3f6fb);
  color: var(--muted, #64748b);
}

.sales-score {
  gap: 8px;
}

.sales-score-bar {
  width: 54px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted, #f3f6fb);
}

.sales-score-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--sales);
}

.sales-score strong {
  color: var(--text-strong, #0f172a);
  font-size: 12px;
}

.sales-table-footer {
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-page-size {
  gap: 8px;
}

.sales-page-size select {
  height: 32px;
  border: 1px solid var(--border, #d8e1ef);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: var(--text, #0f172a);
  font: inherit;
}

.sales-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sales-pager button {
  min-width: 31px;
  height: 31px;
  border: 1px solid var(--border, #d8e1ef);
  border-radius: 6px;
  background: var(--surface-raised, #fff);
  color: var(--text, #0f172a);
  font-weight: 900;
}

.sales-pager button.active {
  border-color: var(--sales);
  background: var(--sales);
  color: #fff;
}

.sales-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--overlay, rgba(15, 23, 42, 0.42));
}

.sales-modal {
  position: relative;
  width: min(100%, 640px);
  max-height: min(720px, calc(100vh - 40px));
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-raised, #fff);
  color: var(--text, #0f172a);
  box-shadow: var(--shadow-floating, 0 24px 70px rgba(15, 23, 42, 0.22));
}

.sales-modal header,
.sales-modal footer {
  padding: 16px 18px;
}

.sales-modal header {
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

.sales-modal h2 {
  margin: 0;
  color: var(--text-strong, #0f172a);
  font-size: 18px;
  font-weight: 950;
}

.sales-modal p {
  margin: 6px 0 0;
  color: var(--muted, #64748b);
  font-weight: 780;
}

.sales-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: var(--surface-muted, #f3f6fb);
  color: var(--muted, #64748b);
  font-size: 20px;
}

.sales-modal-body {
  overflow: auto;
  padding: 18px;
}

.sales-modal-form {
  display: grid;
  gap: 14px;
}

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

.sales-modal-form label {
  display: grid;
  gap: 7px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 900;
}

.sales-modal-form label.full {
  grid-column: 1 / -1;
}

.sales-modal-form input,
.sales-modal-form select {
  height: 42px;
  padding: 0 12px;
}

.sales-modal-form textarea {
  min-height: 104px;
  resize: vertical;
  padding: 11px 12px;
}

.sales-modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-light, #e8edf5);
}

.sales-modal-lead {
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
}

.sales-drawer-backdrop {
  place-items: stretch end;
  padding: 0;
  background: color-mix(in srgb, var(--overlay, rgba(15, 23, 42, 0.42)) 92%, transparent);
}

.sales-drawer {
  position: relative;
  width: min(100%, 520px);
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-raised, #fff);
  color: var(--text, #0f172a);
  box-shadow: var(--shadow-floating, -20px 0 70px rgba(15, 23, 42, 0.22));
}

.sales-drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

.sales-drawer-head h2 {
  margin: 4px 0 0;
  color: var(--text-strong, #0f172a);
  font-size: 19px;
  font-weight: 950;
}

.sales-drawer-body {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding: 18px 20px;
  background: var(--page-bg, #f8fbff);
}

.sales-drawer footer {
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-raised, #fff);
}

.sales-snapshot-head,
.sales-insight-card,
.sales-snapshot-grid,
.sales-snapshot-section {
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-raised, #fff);
}

.sales-snapshot-head {
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.sales-snapshot-identity {
  min-width: 0;
}

.sales-snapshot-identity > strong {
  display: block;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 18px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-snapshot-identity > span {
  display: block;
  margin: 6px 0 10px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 820;
}

.sales-insight-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-color: var(--sales-border, #c7d8ff);
  background: color-mix(in srgb, var(--sales-soft) 56%, var(--surface-raised, #fff));
}

.sales-insight-card.amber {
  border-color: rgba(194, 65, 12, 0.24);
  background: color-mix(in srgb, var(--warning-soft, #fff7ed) 62%, var(--surface-raised, #fff));
}

.sales-insight-card.red {
  border-color: rgba(220, 38, 38, 0.24);
  background: color-mix(in srgb, var(--danger-soft, #fff1f2) 62%, var(--surface-raised, #fff));
}

.sales-insight-card.purple {
  border-color: rgba(124, 58, 237, 0.24);
  background: color-mix(in srgb, var(--purple-soft, #f3e8ff) 62%, var(--surface-raised, #fff));
}

.sales-insight-card.green {
  border-color: rgba(5, 150, 105, 0.24);
  background: color-mix(in srgb, var(--success-soft, #ecfdf5) 62%, var(--surface-raised, #fff));
}

.sales-insight-card span,
.sales-snapshot-item span,
.sales-snapshot-section header span,
.sales-timeline-row small {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-insight-card strong {
  color: var(--text-strong, #0f172a);
  font-size: 15px;
  font-weight: 950;
}

.sales-insight-card p {
  margin: 0;
  color: var(--text, #0f172a);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 780;
}

.sales-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.sales-snapshot-item {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 13px;
  border-right: 1px solid var(--border-light, #e8edf5);
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

.sales-snapshot-item:nth-child(2n) {
  border-right: 0;
}

.sales-snapshot-item:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.sales-snapshot-item strong {
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-snapshot-section {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.sales-snapshot-section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sales-snapshot-section header strong {
  color: var(--text-strong, #0f172a);
  font-size: 14px;
  font-weight: 950;
}

.sales-timeline {
  display: grid;
  gap: 12px;
}

.sales-timeline-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
}

.sales-timeline-row > span {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--sales);
  box-shadow: 0 0 0 4px var(--sales-soft);
}

.sales-timeline-row strong {
  display: block;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-timeline-row p {
  margin: 5px 0 0;
  color: var(--text, #0f172a);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 760;
}

.sales-chip-row {
  flex-wrap: wrap;
  gap: 6px;
}

.sales-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--text-strong, #0f172a);
  color: var(--surface-raised, #fff);
  font-weight: 900;
  box-shadow: var(--shadow-floating, 0 24px 70px rgba(15, 23, 42, 0.22));
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.sales-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .sales-action-board,
  .sales-filter-grid,
  .sales-settings-grid,
  .sales-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-kpi-grid,
  body[data-layout-page="sales-dashboard"] .sales-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  }

  .sales-filter-actions {
    grid-column: 1 / -1;
  }

  body[data-layout-page="sales-dashboard"] .sales-heading,
  body[data-layout-page="sales-dashboard"] .sales-dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-layout-page="sales-dashboard"] :is(.sales-dashboard-tasks, .sales-dashboard-rules, .sales-dashboard-escalation, .sales-dashboard-funnel, .sales-dashboard-recommend) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .sales-page {
    padding: 16px 12px 68px;
  }

  .sales-heading,
  .sales-context,
  .sales-toolbar,
  .sales-table-footer,
  .sales-mini-row,
  .sales-modal-lead {
    align-items: stretch;
    flex-direction: column;
  }

  .sales-context,
  .sales-context label,
  .sales-context select,
  .sales-filter-actions,
  .sales-filter-actions button {
    width: 100%;
  }

  body[data-layout-page="sales-dashboard"] .sales-context {
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
    border: 0;
    background: transparent;
  }

  .sales-kpi-grid,
  body[data-layout-page="sales-dashboard"] .sales-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: 10px;
  }

  .sales-action-board {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-layout-page="sales-dashboard"] .sales-card {
    padding: 16px;
  }

  body[data-layout-page="sales-dashboard"] .sales-mini-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-filter-grid,
  .sales-config-form,
  .sales-settings-grid,
  .sales-report-grid,
  .sales-modal-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .sales-drawer {
    width: 100%;
  }

  .sales-snapshot-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-snapshot-item,
  .sales-snapshot-item:nth-child(2n),
  .sales-snapshot-item:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--border-light, #e8edf5);
  }

  .sales-snapshot-item:last-child {
    border-bottom: 0;
  }
}

:root[data-theme="dark"] {
  --sales-soft: var(--blue-soft, rgba(96, 165, 250, 0.16));
  --sales-border: rgba(96, 165, 250, 0.32);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-action,
:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-pager button.active {
  border-color: var(--sales, #6ea8ff);
  background: var(--sales, #6ea8ff);
  color: var(--neutral-ink, #07111f);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-action:hover {
  background: var(--sales-dark, #8ab6ff);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-view-tabs button.active {
  background: var(--sales-soft, rgba(96, 165, 250, 0.16));
  color: var(--sales, #6ea8ff);
}

/* ===== 销售台 v2：台别 / 信号 / 外呼 / 交易面 / 动作库 / 日历 / 漏斗 ===== */

/* 统一色调令牌：新组件一律通过 --tone / --tone-soft 着色，
   两个变量本身都指向主题变量，因此深色模式自动跟随 theme.css 的换值。 */
.sales-tone-blue,
.sales-signal-card,
.sales-substatus-pill,
.sales-margin-bar,
.sales-calendar-event,
.sales-funnel-step,
.sales-chart-bars,
.sales-chart-line,
.sales-timeline-dot,
.sales-risk-pill,
.sales-team-avatar,
.sales-armory-card,
.sales-confirm-icon {
  --tone: var(--sales, #2f66e8);
  --tone-soft: var(--sales-soft, #eef4ff);
}

.sales-tone-blue,
.sales-signal-card.medium,
.sales-substatus-pill.blue,
.sales-calendar-event.blue,
.sales-funnel-step.blue,
.sales-chart-bars.blue,
.sales-chart-line.blue,
.sales-timeline-dot.blue,
.sales-risk-pill.blue,
.sales-team-avatar.blue,
.sales-margin-bar.blue {
  --tone: var(--blue, #2f66e8);
  --tone-soft: var(--blue-soft, #eef4ff);
}

.sales-tone-green,
.sales-substatus-pill.green,
.sales-calendar-event.green,
.sales-funnel-step.green,
.sales-chart-bars.green,
.sales-chart-line.green,
.sales-timeline-dot.green,
.sales-risk-pill.green,
.sales-team-avatar.green,
.sales-margin-bar.green {
  --tone: var(--success, #059669);
  --tone-soft: var(--success-soft, #ecfdf5);
}

.sales-tone-amber,
.sales-signal-card.high,
.sales-substatus-pill.amber,
.sales-calendar-event.amber,
.sales-funnel-step.amber,
.sales-chart-bars.amber,
.sales-chart-line.amber,
.sales-timeline-dot.amber,
.sales-risk-pill.amber,
.sales-team-avatar.amber,
.sales-margin-bar.amber,
.sales-confirm-icon.warning {
  --tone: var(--warning, #c2410c);
  --tone-soft: var(--warning-soft, #fff7ed);
}

.sales-tone-red,
.sales-signal-card.critical,
.sales-substatus-pill.red,
.sales-calendar-event.red,
.sales-funnel-step.red,
.sales-chart-bars.red,
.sales-chart-line.red,
.sales-timeline-dot.red,
.sales-risk-pill.red,
.sales-team-avatar.red,
.sales-margin-bar.red,
.sales-confirm-icon.danger {
  --tone: var(--danger, #dc2626);
  --tone-soft: var(--danger-soft, #fff1f2);
}

.sales-tone-purple,
.sales-substatus-pill.purple,
.sales-calendar-event.purple,
.sales-funnel-step.purple,
.sales-chart-bars.purple,
.sales-chart-line.purple,
.sales-timeline-dot.purple,
.sales-risk-pill.purple,
.sales-team-avatar.purple,
.sales-margin-bar.purple {
  --tone: var(--purple, #7c3aed);
  --tone-soft: var(--purple-soft, #f3e8ff);
}

.sales-tone-slate,
.sales-signal-card.low,
.sales-substatus-pill.slate,
.sales-calendar-event.slate,
.sales-funnel-step.slate,
.sales-chart-bars.slate,
.sales-chart-line.slate,
.sales-timeline-dot.slate,
.sales-risk-pill.slate,
.sales-team-avatar.slate {
  --tone: var(--muted, #64748b);
  --tone-soft: var(--surface-muted, #f3f6fb);
}

.sales-num,
.sales-dialer-number,
.sales-dialer-timer,
.sales-dialer-key,
.sales-pnl,
.sales-signal-time,
.sales-timeline-time,
.sales-calendar-daynum,
.sales-detail-stat strong,
.sales-trading-metric strong {
  font-variant-numeric: tabular-nums;
}

/* ---- 1. 台别切换器 ---- */

.sales-desk-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  padding: 5px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 10px;
  background: var(--surface-muted, #f3f6fb);
}

.sales-desk-option {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #64748b);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.sales-desk-option:hover {
  background: color-mix(in srgb, var(--surface-raised, #fff) 72%, transparent);
  color: var(--text, #0f172a);
}

.sales-desk-name {
  display: block;
  color: inherit;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 950;
  white-space: nowrap;
}

.sales-desk-goal {
  display: block;
  color: var(--muted, #64748b);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 820;
}

.sales-desk-option.is-active {
  border-color: color-mix(in srgb, var(--tone, var(--sales)) 34%, transparent);
  background: var(--surface-raised, #fff);
  color: var(--tone, var(--sales));
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-desk-option.is-active .sales-desk-goal {
  color: color-mix(in srgb, var(--tone, var(--sales)) 62%, var(--muted, #64748b));
}

.sales-desk-option[data-desk="conversion"].is-active {
  --tone: var(--blue, #2f66e8);
  --tone-soft: var(--blue-soft, #eef4ff);
}

.sales-desk-option[data-desk="retention"].is-active {
  --tone: var(--purple, #7c3aed);
  --tone-soft: var(--purple-soft, #f3e8ff);
}

/* ---- 2. 触发信号卡 ---- */

.sales-signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 268px), 1fr));
  gap: 12px;
}

.sales-signal-card {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 11px;
  padding: 15px 15px 15px 18px;
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

/* 左侧色条 */
.sales-signal-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone, var(--sales));
}

/* 右上角标（严重度晕染） */
.sales-signal-card::after {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 76px;
  height: 76px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--sales)) 16%, transparent);
  pointer-events: none;
}

.sales-signal-head {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sales-signal-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--tone-soft, var(--sales-soft));
  color: var(--tone, var(--sales));
  font-size: 17px;
  font-weight: 950;
}

.sales-signal-count {
  display: block;
  color: var(--text-strong, #0f172a);
  font-size: 22px;
  line-height: 1.05;
  font-weight: 950;
}

.sales-signal-label {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-signal-playbook {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed color-mix(in srgb, var(--tone, var(--sales)) 30%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--tone-soft, var(--sales-soft)) 58%, var(--surface-soft, #f7faff));
  color: var(--text, #0f172a);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 800;
}

.sales-signal-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sales-signal-item {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 7px;
  background: var(--surface-soft, #f7faff);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.sales-signal-item:hover {
  border-color: color-mix(in srgb, var(--tone, var(--sales)) 36%, transparent);
  background: color-mix(in srgb, var(--tone-soft, var(--sales-soft)) 48%, var(--surface-raised, #fff));
}

.sales-signal-headline {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-signal-time {
  flex: 0 0 auto;
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

/* ---- 3. 外呼面板 ---- */

.sales-dialer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: min(324px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 48px));
  display: grid;
  align-content: start;
  gap: 13px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 14px;
  background: var(--surface-raised, #fff);
  color: var(--text, #0f172a);
  box-shadow: var(--shadow-floating, 0 24px 70px rgba(15, 23, 42, 0.22));
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.sales-dialer.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.sales-dialer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.sales-dialer-client {
  min-width: 0;
}

.sales-dialer-client strong {
  display: block;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 14px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-dialer-client span {
  display: block;
  margin-top: 3px;
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 850;
}

.sales-dialer-number {
  color: var(--text-strong, #0f172a);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 25px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-align: center;
  word-break: break-all;
}

.sales-dialer-timer {
  color: var(--success, #059669);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.sales-dialer-status {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  justify-self: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-muted, #f3f6fb);
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 900;
}

.sales-dialer-status.ringing {
  background: var(--warning-soft, #fff7ed);
  color: var(--warning, #c2410c);
}

.sales-dialer-status.live {
  background: var(--success-soft, #ecfdf5);
  color: var(--success, #059669);
}

.sales-dialer-status.ended {
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

.sales-dialer-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sales-dialer-key {
  min-height: 44px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
  color: var(--text-strong, #0f172a);
  font: inherit;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.sales-dialer-key:hover {
  border-color: var(--sales-border, #c7d8ff);
  background: var(--sales-soft);
  color: var(--sales);
}

.sales-dialer-key:active {
  transform: scale(0.96);
}

.sales-dialer-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.sales-dialer-call,
.sales-dialer-hangup {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.sales-dialer-call {
  background: var(--success, #059669);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--success, #059669) 34%, transparent);
}

.sales-dialer-hangup {
  background: var(--danger, #dc2626);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--danger, #dc2626) 34%, transparent);
}

.sales-dialer-call:hover,
.sales-dialer-hangup:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.sales-dialer-call:disabled,
.sales-dialer-hangup:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
  transform: none;
}

.sales-dialer-outcome-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 216px;
  overflow: auto;
  padding-right: 2px;
}

.sales-dialer-outcome {
  min-width: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 7px;
  background: var(--surface-soft, #f7faff);
  color: var(--text, #0f172a);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.sales-dialer-outcome:hover {
  border-color: var(--sales-border, #c7d8ff);
  background: var(--sales-soft);
  color: var(--sales);
}

.sales-dialer-outcome.is-active {
  border-color: var(--sales);
  background: var(--sales);
  color: #fff;
}

.sales-dialer-mini {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 89;
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--sales);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--sales) 38%, transparent);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.sales-dialer-mini:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.sales-dialer-mini.is-active {
  background: var(--success, #059669);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--success, #059669) 38%, transparent);
  animation: sales-dialer-pulse 1.8s ease-out infinite;
}

.sales-dialer-mini em {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger, #dc2626);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
}

@keyframes sales-dialer-pulse {
  0% {
    box-shadow: 0 14px 30px color-mix(in srgb, var(--success, #059669) 38%, transparent), 0 0 0 0 color-mix(in srgb, var(--success, #059669) 46%, transparent);
  }
  100% {
    box-shadow: 0 14px 30px color-mix(in srgb, var(--success, #059669) 38%, transparent), 0 0 0 16px transparent;
  }
}

/* ---- 4. Sub-status 药丸（比 status-pill 更轻） ---- */

.sales-substatus-pill {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 0 7px;
  overflow: hidden;
  border: 1px dashed color-mix(in srgb, var(--tone, var(--muted, #64748b)) 40%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--muted, #64748b)) 9%, transparent);
  color: var(--tone, var(--muted, #64748b));
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-substatus-pill.solid {
  border-style: solid;
}

.sales-substatus-pill::before {
  content: "";
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
}

/* ---- 5. 交易面板 ---- */

.sales-trading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 156px), 1fr));
  gap: 12px;
}

.sales-trading-metric {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
}

.sales-trading-metric span {
  overflow: hidden;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-trading-metric strong {
  color: var(--text-strong, #0f172a);
  font-size: 21px;
  line-height: 1.1;
  font-weight: 950;
}

.sales-trading-metric em {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.sales-trading-metric.up em {
  color: var(--success, #059669);
}

.sales-trading-metric.down em {
  color: var(--danger, #dc2626);
}

.sales-account-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-account-card > header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sales-account-card > header strong {
  color: var(--text-strong, #0f172a);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.sales-account-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.sales-account-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--border-light, #e8edf5);
}

.sales-account-figures > div {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 11px;
  background: var(--surface-soft, #f7faff);
}

.sales-account-figures span {
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 850;
}

.sales-account-figures strong {
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 15px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-margin-bar {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted, #f3f6fb);
}

.sales-margin-bar > i {
  display: block;
  width: var(--pct, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--tone, var(--success, #059669));
  transition: width 0.3s ease, background 0.2s ease;
}

/* 预警 / 强平两道阈值刻度 */
.sales-margin-bar::before,
.sales-margin-bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: color-mix(in srgb, var(--text-strong, #0f172a) 26%, transparent);
}

.sales-margin-bar::before {
  left: var(--warn-at, 50%);
}

.sales-margin-bar::after {
  left: var(--stop-at, 80%);
}

.sales-margin-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.sales-position-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(52px, auto) minmax(78px, auto);
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
}

/* :not() 是必须的：徽章/盈亏也是 row 的直接子元素，
   否则这两条通用规则的特异度会压过组件自身的着色。 */
.sales-position-row > strong:not(.sales-pnl) {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-position-row > span:not(.sales-side-badge):not(.sales-pnl) {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.sales-side-badge {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.sales-side-badge.buy {
  background: var(--success-soft, #ecfdf5);
  color: var(--success, #059669);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success, #059669) 26%, transparent);
}

.sales-side-badge.sell {
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger, #dc2626) 26%, transparent);
}

.sales-pnl {
  color: var(--text-strong, #0f172a);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.sales-pnl.positive {
  color: var(--success, #059669);
}

.sales-pnl.negative {
  color: var(--danger, #dc2626);
}

/* ---- 6. 销售动作库（armory 前缀，避开已有的 .sales-action） ---- */

.sales-armory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 236px), 1fr));
  gap: 12px;
}

.sales-armory-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 12px;
  padding: 14px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.sales-armory-icon {
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--tone-soft, var(--sales-soft));
  color: var(--tone, var(--sales));
  font-size: 17px;
  font-weight: 950;
}

.sales-armory-card > strong,
.sales-armory-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 14px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-armory-card > p,
.sales-armory-desc {
  grid-column: 2 / -1;
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 800;
}

.sales-armory-badge {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-muted, #f3f6fb);
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.sales-armory-badge.approval {
  background: var(--warning-soft, #fff7ed);
  color: var(--warning, #c2410c);
}

.sales-armory-badge.instant {
  background: var(--success-soft, #ecfdf5);
  color: var(--success, #059669);
}

.sales-armory-badge.blocked {
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

.sales-armory-card:hover {
  border-color: color-mix(in srgb, var(--tone, var(--sales)) 40%, transparent);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--tone, var(--sales)) 18%, transparent);
  transform: translateY(-2px);
}

.sales-armory-card.is-blocked {
  border-style: dashed;
  background: var(--surface-muted, #f3f6fb);
  cursor: not-allowed;
  opacity: 0.62;
  filter: grayscale(0.45);
  box-shadow: none;
}

.sales-armory-card.is-blocked:hover {
  border-color: var(--border, #d8e1ef);
  box-shadow: none;
  transform: none;
}

.sales-armory-history {
  display: grid;
  gap: 8px;
}

.sales-armory-item {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
}

.sales-armory-item > div {
  min-width: 0;
}

.sales-armory-item strong {
  display: block;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-armory-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

/* ---- 7. 回访日历 ---- */

.sales-calendar-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.sales-calendar-head span {
  padding: 4px 0;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 950;
  text-align: center;
}

.sales-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.sales-calendar-day {
  min-width: 0;
  min-height: 108px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-raised, #fff);
}

.sales-calendar-grid.week .sales-calendar-day {
  min-height: 168px;
}

.sales-calendar-day.is-today {
  border-color: var(--sales);
  background: color-mix(in srgb, var(--sales-soft) 46%, var(--surface-raised, #fff));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sales) 16%, transparent);
}

.sales-calendar-day.is-outside {
  background: var(--surface-muted, #f3f6fb);
  opacity: 0.56;
}

.sales-calendar-day.has-overdue {
  border-color: color-mix(in srgb, var(--danger, #dc2626) 42%, transparent);
  background: color-mix(in srgb, var(--danger-soft, #fff1f2) 46%, var(--surface-raised, #fff));
}

.sales-calendar-daynum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-strong, #0f172a);
  font-size: 12px;
  font-weight: 950;
}

.sales-calendar-count {
  min-width: 20px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sales-soft);
  color: var(--sales);
  font-size: 11px;
  font-weight: 900;
}

.sales-calendar-day.has-overdue .sales-calendar-count {
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

.sales-calendar-event {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 4px 7px;
  overflow: hidden;
  border: 0;
  border-left: 3px solid var(--tone, var(--sales));
  border-radius: 6px;
  background: color-mix(in srgb, var(--tone, var(--sales)) 13%, var(--surface-soft, #f7faff));
  color: var(--text-strong, #0f172a);
  font: inherit;
  font-size: 11px;
  font-weight: 880;
  text-align: left;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease;
}

.sales-calendar-event:hover {
  background: color-mix(in srgb, var(--tone, var(--sales)) 24%, var(--surface-soft, #f7faff));
}

.sales-calendar-more {
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.sales-calendar-more:hover {
  color: var(--sales);
}

.sales-calendar-timeline {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-raised, #fff);
}

.sales-calendar-hour {
  padding: 10px;
  border-right: 1px solid var(--border-light, #e8edf5);
  border-bottom: 1px solid var(--border-light, #e8edf5);
  background: var(--surface-soft, #f7faff);
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.sales-calendar-slot {
  min-width: 0;
  min-height: 56px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

.sales-calendar-slot.is-now {
  background: color-mix(in srgb, var(--sales-soft) 42%, transparent);
}

.sales-calendar-hour:last-of-type,
.sales-calendar-slot:last-of-type {
  border-bottom: 0;
}

/* ---- 8. 漏斗与图表 ---- */

.sales-funnel-chart {
  display: grid;
  gap: 10px;
}

.sales-funnel-step {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(84px, 124px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.sales-funnel-step > span {
  overflow: hidden;
  color: var(--text, #0f172a);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-funnel-fill {
  min-width: 132px;
  width: var(--pct, 100%);
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-radius: 7px;
  background: linear-gradient(
    90deg,
    var(--tone, var(--sales)),
    color-mix(in srgb, var(--tone, var(--sales)) 58%, transparent)
  );
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: width 0.3s ease;
}

.sales-funnel-fill em {
  font-style: normal;
  opacity: 0.86;
}

.sales-funnel-drop {
  grid-column: 2 / -1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: -4px;
  color: var(--danger, #dc2626);
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.sales-funnel-drop::before {
  content: "▾";
  font-size: 12px;
}

.sales-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 176px;
  padding: 18px 4px 0;
  border-bottom: 1px solid var(--border-light, #e8edf5);
}

.sales-chart-bar {
  position: relative;
  flex: 1 1 0;
  min-width: 8px;
  height: var(--h, 8%);
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(
    180deg,
    var(--tone, var(--sales)),
    color-mix(in srgb, var(--tone, var(--sales)) 46%, transparent)
  );
  transition: height 0.3s ease, filter 0.14s ease;
}

.sales-chart-bar::after {
  content: attr(data-value);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  color: var(--muted, #64748b);
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translateX(-50%);
}

.sales-chart-bar:hover {
  filter: brightness(1.08);
}

.sales-chart-line {
  position: relative;
  width: 100%;
  min-width: 0;
}

.sales-chart-line svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.sales-chart-line .chart-grid {
  fill: none;
  stroke: var(--border-light, #e8edf5);
  stroke-width: 1;
}

.sales-chart-line .chart-area {
  stroke: none;
  fill: color-mix(in srgb, var(--tone, var(--sales)) 16%, transparent);
}

.sales-chart-line .chart-stroke {
  fill: none;
  stroke: var(--tone, var(--sales));
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sales-chart-line .chart-dot {
  fill: var(--surface-raised, #fff);
  stroke: var(--tone, var(--sales));
  stroke-width: 2;
}

.sales-chart-line .chart-text {
  fill: var(--muted, #64748b);
  font-size: 10px;
  font-weight: 900;
}

.sales-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 10px;
}

.sales-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-chart-legend span::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--tone, var(--sales));
}

.sales-chart-axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.sales-chart-axis span {
  flex: 1 1 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-sparkline {
  display: inline-block;
  width: 78px;
  height: 22px;
  vertical-align: middle;
}

.sales-sparkline svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sales-sparkline path {
  fill: none;
  stroke: var(--tone, var(--sales));
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sales-sparkline.positive {
  --tone: var(--success, #059669);
}

.sales-sparkline.negative {
  --tone: var(--danger, #dc2626);
}

/* ---- 9. 批量工具条与选择 ---- */

.sales-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-height: 0;
  padding: 0 16px;
  overflow: hidden;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--sales-soft) 62%, var(--surface-raised, #fff));
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.2s ease, padding 0.2s ease, opacity 0.18s ease, transform 0.18s ease;
}

.sales-bulk-bar.is-visible {
  max-height: 120px;
  padding: 12px 16px;
  border-bottom-color: var(--sales-border, #c7d8ff);
  opacity: 1;
  transform: none;
}

.sales-bulk-count {
  flex: 0 0 auto;
  color: var(--sales);
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

.sales-bulk-count strong {
  font-size: 15px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.sales-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sales-table th.sales-check-cell,
.sales-table td.sales-check-cell {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  padding-right: 0;
  padding-left: 14px;
  text-align: left;
}

.sales-check-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--sales);
  cursor: pointer;
}

.sales-table tbody tr.is-selected td {
  background: color-mix(in srgb, var(--sales-soft) 76%, var(--surface-raised, #fff));
}

.sales-table tbody tr.is-selected td.actions-cell {
  background: color-mix(in srgb, var(--sales-soft) 76%, var(--surface-raised, #fff));
}

/* ---- 10. 确认对话框（复用 .sales-backdrop） ---- */

.sales-confirm {
  position: relative;
  width: min(100%, 428px);
  display: grid;
  gap: 12px;
  padding: 24px 22px 20px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 12px;
  background: var(--surface-raised, #fff);
  color: var(--text, #0f172a);
  text-align: center;
  box-shadow: var(--shadow-floating, 0 24px 70px rgba(15, 23, 42, 0.22));
}

.sales-confirm-icon {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  justify-self: center;
  border-radius: 999px;
  background: var(--tone-soft, var(--surface-muted, #f3f6fb));
  color: var(--tone, var(--muted, #64748b));
  font-size: 24px;
  font-weight: 950;
}

.sales-confirm-title {
  color: var(--text-strong, #0f172a);
  font-size: 17px;
  line-height: 1.3;
  font-weight: 950;
}

.sales-confirm-text {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 13px;
  line-height: 1.6;
  font-weight: 800;
}

.sales-confirm-reason {
  width: 100%;
  min-height: 86px;
  padding: 10px 12px;
  border: 1px solid var(--border, #d8e1ef);
  border-radius: 8px;
  background: var(--input-bg, #fff);
  color: var(--text, #0f172a);
  font: inherit;
  font-size: 13px;
  font-weight: 780;
  text-align: left;
  resize: vertical;
}

.sales-confirm-reason::placeholder {
  color: var(--icon-muted, #94a3b8);
  font-weight: 780;
}

.sales-confirm-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

/* ---- 11. 客户详情页布局 ---- */

.sales-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(296px, 348px);
  align-items: start;
  gap: 16px;
}

.sales-detail-hero {
  min-width: 0;
  display: grid;
  gap: 13px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-detail-hero :is(h1, h2) {
  margin: 0;
  color: var(--text-strong, #0f172a);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: 0;
}

.sales-detail-hero p {
  margin: 6px 0 0;
  color: var(--muted, #64748b);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 800;
}

.sales-detail-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.sales-detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--border-light, #e8edf5);
}

.sales-detail-stat {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px;
  background: var(--surface-raised, #fff);
}

.sales-detail-stat span {
  overflow: hidden;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-detail-stat strong {
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 17px;
  line-height: 1.15;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-detail-tabs {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-muted, #f3f6fb);
}

.sales-detail-tab {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #64748b);
  font: inherit;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.sales-detail-tab.is-active {
  background: var(--surface-raised, #fff);
  color: var(--sales);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-detail-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-detail-side {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
}

.sales-detail-sticky {
  position: sticky;
  top: calc(var(--app-chrome-height, 131px) + 12px);
  display: grid;
  align-content: start;
  gap: 14px;
}

.sales-timeline-item {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
}

/* 竖直连接线，最后一条不画 */
.sales-timeline-item::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: -12px;
  left: 12px;
  width: 2px;
  background: var(--border-light, #e8edf5);
}

.sales-timeline-item:last-child::before {
  display: none;
}

.sales-timeline-dot {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--tone-soft, var(--sales-soft));
  color: var(--tone, var(--sales));
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 0 0 3px var(--surface-raised, #fff);
}

.sales-timeline-body {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding-bottom: 6px;
}

.sales-timeline-body > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 920;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-timeline-body p {
  margin: 0;
  color: var(--text, #0f172a);
  font-size: 12px;
  line-height: 1.55;
  font-weight: 780;
}

.sales-timeline-time {
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 850;
}

/* ---- 12. 合规提示 ---- */

.sales-compliance-banner {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--tone, var(--danger, #dc2626)) 34%, transparent);
  border-left-width: 4px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone, var(--danger, #dc2626)) 11%, var(--surface-raised, #fff));
  color: var(--text, #0f172a);
}

.sales-compliance-banner {
  --tone: var(--danger, #dc2626);
}

.sales-compliance-banner.amber {
  --tone: var(--warning, #c2410c);
}

.sales-compliance-banner.blue {
  --tone: var(--blue, #2f66e8);
}

.sales-compliance-banner > span:first-child {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--danger, #dc2626)) 18%, transparent);
  color: var(--tone, var(--danger, #dc2626));
  font-size: 15px;
  font-weight: 950;
}

.sales-compliance-banner strong {
  display: block;
  color: var(--tone, var(--danger, #dc2626));
  font-size: 13px;
  font-weight: 950;
}

.sales-compliance-list {
  display: grid;
  gap: 5px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.sales-compliance-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text, #0f172a);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 820;
}

.sales-compliance-item::before {
  content: "";
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--tone, var(--danger, #dc2626));
}

.sales-risk-pill {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--tone, var(--muted, #64748b)) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--muted, #64748b)) 11%, transparent);
  color: var(--tone, var(--muted, #64748b));
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

/* ---- 13. 团队配置 ---- */

.sales-team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 252px), 1fr));
  gap: 12px;
}

.sales-team-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
  padding: 14px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised, #fff) 97%, transparent);
  box-shadow: var(--shadow-soft, 0 12px 28px rgba(15, 23, 42, 0.05));
}

.sales-team-card.is-disabled {
  background: var(--surface-muted, #f3f6fb);
  opacity: 0.64;
}

.sales-team-avatar {
  grid-row: 1 / 3;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: var(--tone-soft, var(--sales-soft));
  color: var(--tone, var(--sales));
  font-size: 17px;
  font-weight: 950;
}

.sales-team-card > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 14px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-team-card > span {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-team-targets {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-light, #e8edf5);
}

.sales-team-targets > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.sales-team-targets small {
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 850;
}

.sales-team-targets strong {
  overflow: hidden;
  color: var(--text-strong, #0f172a);
  font-size: 14px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-team-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.sales-config-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.sales-config-row-actions button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border, #d8e1ef);
  border-radius: 7px;
  background: var(--surface-raised, #fff);
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.sales-config-row-actions button:hover {
  border-color: var(--sales-border, #c7d8ff);
  background: var(--sales-soft);
  color: var(--sales);
}

.sales-config-row-actions button.danger:hover {
  border-color: color-mix(in srgb, var(--danger, #dc2626) 34%, transparent);
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

/* ---- 14. 表格溢出修复：让粘性操作列真正「浮在上层」而不是遮挡内容 ---- */

/* 横向滚动更明确：细滚动条常驻可见，滚动到底时操作列不再吃掉相邻列 */
.sales-table-wrap {
  overscroll-behavior-x: contain;
  scroll-padding-right: 180px;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #d8e1ef) transparent;
}

.sales-table-wrap::-webkit-scrollbar {
  height: 10px;
}

.sales-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.sales-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--border, #d8e1ef);
  background-clip: content-box;
}

/* 压缩列宽：1431px → 约 1050px，1440 视口下表格已能完整放进容器 */
.sales-table {
  min-width: 980px;
  --sales-cell-max: 148px;
}

.sales-table th,
.sales-table td {
  padding: 12px 10px;
}

.sales-table th:first-child,
.sales-table td:first-child {
  padding-left: 16px;
}

.sales-table th:last-child,
.sales-table td:last-child {
  padding-right: 16px;
}

.sales-table td {
  font-size: 13px;
}

/* 单元格文本给出上限，撑不开表格；strong/small 已经是 block + ellipsis */
.sales-table td > strong,
.sales-table td > small,
.sales-table td > .sales-cell-text {
  max-width: var(--sales-cell-max, 148px);
}

.sales-table td > .sales-status-pill,
.sales-table td > .sales-pool-pill,
.sales-table td > .sales-substatus-pill,
.sales-table td > .sales-side-badge,
.sales-table td > .sales-risk-pill {
  max-width: 100%;
}

/* 操作列按钮收紧，省下约 60px */
.sales-table .actions-cell .sales-row-actions {
  gap: 6px;
}

.sales-table .actions-cell :is(.sales-action, .sales-secondary, .sales-danger, .sales-icon-action) {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

/* sticky 操作列：加左侧分隔阴影 + 细边，读起来是浮在上层的一列 */
.sales-table .actions-cell {
  border-left: 1px solid var(--border-light, #e8edf5);
  box-shadow: -8px 0 12px -8px rgba(0, 0, 0, 0.15);
}

/* 表头同一列一起 sticky，避免横向滚动时表头错位 */
.sales-table:has(td.actions-cell) thead th:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface-soft, #f7faff);
  border-left: 1px solid var(--border-light, #e8edf5);
  box-shadow: -8px 0 12px -8px rgba(0, 0, 0, 0.15);
}

/* 行态高亮要覆盖 sticky 单元格的不透明底色，否则悬停/选中会「断一格」 */
.sales-table tr:hover td.actions-cell {
  background: color-mix(in srgb, var(--sales-soft) 42%, var(--surface-raised, #fff));
}

.sales-table tr.is-focused td.actions-cell {
  background: color-mix(in srgb, var(--sales-soft) 72%, var(--surface-raised, #fff));
}

/* ---- 响应式 ---- */

@media (max-width: 1400px) {
  .sales-table {
    --sales-cell-max: 132px;
  }
}

@media (max-width: 1180px) {
  .sales-detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-detail-sticky {
    position: static;
  }
}

@media (max-width: 1100px) {
  .sales-calendar-grid,
  .sales-calendar-head {
    gap: 6px;
  }

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

@media (max-width: 760px) {
  .sales-desk-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-account-figures,
  .sales-team-targets {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-position-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }

  .sales-funnel-step {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-funnel-drop {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .sales-calendar-grid,
  .sales-calendar-head {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  }

  .sales-calendar-timeline {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .sales-bulk-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .sales-bulk-actions {
    justify-content: flex-start;
  }

  .sales-dialer {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .sales-dialer-mini {
    right: 16px;
    bottom: 16px;
  }

  .sales-detail-hero {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sales-dialer,
  .sales-dialer-mini,
  .sales-armory-card,
  .sales-bulk-bar,
  .sales-margin-bar > i,
  .sales-funnel-fill,
  .sales-chart-bar {
    transition: none;
    animation: none;
  }
}

/* ---- 深色模式：只覆盖硬编码的白字与阴影，其余走主题变量自动跟随 ---- */

:root[data-theme="dark"] body[data-layout-page^="sales-"] :is(.sales-dialer-call, .sales-dialer-hangup, .sales-dialer-mini, .sales-dialer-mini em, .sales-dialer-outcome.is-active, .sales-funnel-fill) {
  color: var(--neutral-ink, #07111f);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-dialer {
  border-color: var(--border, #253247);
  background: var(--surface-raised, #151f2f);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-dialer-outcome.is-active {
  border-color: var(--sales, #6ea8ff);
  background: var(--sales, #6ea8ff);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] :is(.sales-signal-card, .sales-armory-card, .sales-team-card, .sales-detail-hero, .sales-detail-panel, .sales-account-card) {
  border-color: var(--border-light, #1e293b);
  background: var(--surface-raised, #151f2f);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-armory-card:hover {
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-armory-card.is-blocked {
  background: var(--surface-muted, #1b2638);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] :is(.sales-table .actions-cell, .sales-table:has(td.actions-cell) thead th:last-child) {
  box-shadow: -10px 0 16px -8px rgba(0, 0, 0, 0.62);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-table:has(td.actions-cell) thead th:last-child {
  background: var(--surface-soft, #172033);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-table .actions-cell {
  background: var(--surface-raised, #151f2f);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-margin-bar::before,
:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-margin-bar::after {
  background: color-mix(in srgb, var(--surface-raised, #151f2f) 88%, transparent);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-calendar-day {
  background: var(--surface-soft, #172033);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-calendar-day.is-outside {
  background: var(--surface-muted, #1b2638);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-timeline-dot {
  box-shadow: 0 0 0 3px var(--surface-raised, #151f2f);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-confirm {
  border-color: var(--border, #253247);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-desk-option.is-active {
  background: var(--surface-raised, #151f2f);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-detail-tab.is-active {
  background: var(--sales-soft, rgba(96, 165, 250, 0.16));
  color: var(--sales, #6ea8ff);
}

:root[data-theme="dark"] body[data-layout-page^="sales-"] .sales-chart-line .chart-dot {
  fill: var(--surface-raised, #151f2f);
}

/* ===== 客户归属与数据范围：策略提示 / IB 保护池 / 归属路由配置 ===== */

.sales-pool-pill.ib {
  background: var(--purple-soft, #f3e8ff);
  color: var(--purple, #7c3aed);
}

.sales-view-tabs .sales-view-count {
  margin-left: 6px;
  color: inherit;
  font-size: 11px;
  font-weight: 850;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
}

/* 置灰但可点：点击时用提示条说明为什么不能操作（手机上没有悬停提示）。 */
.sales-action[aria-disabled="true"],
.sales-secondary[aria-disabled="true"],
.sales-danger[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.sales-policy-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: -6px 0 16px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.sales-policy-hint strong {
  min-width: 0;
  color: var(--text-strong, #0f172a);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.sales-policy-hint small {
  min-width: 0;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.sales-policy-tag {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--sales-soft);
  color: var(--sales);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.sales-policy-hint.is-denied .sales-policy-tag {
  background: var(--danger-soft, #fff1f2);
  color: var(--danger, #dc2626);
}

.sales-policy-hint.is-denied strong {
  color: var(--danger, #dc2626);
}

.sales-attribution-reason {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-light, #e8edf5);
  border-radius: 8px;
  background: var(--surface-soft, #f7faff);
  color: var(--text, #0f172a);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.6;
}

/* 归属路由：优先级链 + 规则表里的启用开关 / 删除按钮 */
.sales-routing-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-routing-flow .sales-mini-chip {
  white-space: nowrap;
}

.sales-routing-note {
  margin: 0 0 14px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.6;
}

.sales-routing-fallback {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  max-width: 360px;
  margin: 0 0 16px;
}

.sales-routing-fallback span {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 850;
}

.sales-routing-fallback select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-light, #dbe5f2);
  border-radius: 8px;
  background: var(--surface-raised, #fff);
  color: var(--text-strong, #0f172a);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  padding: 10px 11px;
}

.sales-config-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--sales);
}

.sales-config-table td.sales-toggle-cell,
.sales-config-table th.sales-toggle-cell {
  width: 64px;
  text-align: center;
}

.sales-config-table td.sales-row-tools,
.sales-config-table th.sales-row-tools {
  width: 52px;
}

.sales-config-table tr.is-disabled input:not([type="checkbox"]),
.sales-config-table tr.is-disabled select {
  opacity: 0.6;
}

.sales-config-row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.sales-config-add {
  margin: -6px 0 16px;
}

.sales-config-table .sales-team-table {
  min-width: 0;
  --sales-cell-max: none;
}

.sales-team-table td strong,
.sales-team-table td small {
  display: block;
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.sales-team-table td .sales-status-pill {
  margin-top: 6px;
}

@media (max-width: 760px) {
  .sales-policy-hint {
    margin-top: -4px;
  }

  .sales-routing-fallback {
    max-width: none;
  }
}

.sales-routing-readonly {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warning-soft, #fff7ed);
  color: var(--warning, #c2410c);
  font-weight: 850;
}

/* 归属组织全路径、品牌 / 法人较长：这一组允许换行，不截断。 */
.sales-attribution-grid .sales-snapshot-item strong {
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Sales workflow refinements */
.sales-detail-stat strong { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .sales-detail-layout { grid-template-columns: minmax(0, 1fr); } .sales-detail-sticky { position: static; } }
.sales-detail-mobile-actions { display: none; }
@media (max-width: 760px) {
  .sales-detail-mobile-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
  .sales-detail-mobile-actions button { flex: 1 1 140px; min-height: 44px; }
  .sales-detail-side .sales-detail-buttons button { display: none; }
}
.sales-diagnostics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin-top: 14px; }
.sales-diagnostic { display: grid; gap: 9px; padding: 16px; color: var(--text, #0f172a); background: var(--surface-muted, #f3f6fb); border-radius: 8px; text-decoration: none; }
.sales-diagnostic strong { font-size: 26px; }
.sales-diagnostic small { color: var(--muted, #64748b); line-height: 1.6; }
.sales-diagnostic em { color: var(--sales); font-size: 12px; font-style: normal; }
