/* 客户管理 — 模块样式（基于 vehicle-management vm-*） */

.cm-page {
  padding-bottom: 48px;
}

.cm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  color: var(--ln-muted);
}

.cm-breadcrumb-list {
  margin-bottom: 4px;
}

.cm-breadcrumb-muted {
  color: var(--ln-muted);
}

.cm-breadcrumb-link {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--ln-body);
  cursor: pointer;
  font: inherit;
}

.cm-breadcrumb-link:hover {
  color: var(--ln-primary);
}

.cm-breadcrumb-current {
  color: var(--ln-ink);
  font-weight: 500;
}

.cm-page-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ln-ink);
  letter-spacing: -0.02em;
}

.cm-filter-card .vm-filter-header {
  margin-bottom: 16px;
}

.cm-filter-actions {
  margin-top: 0;
}

.cm-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.cm-date-input {
  flex: 1;
  min-width: 0;
}

.cm-date-sep {
  color: var(--ln-muted-soft);
}

.cm-multi-field {
  position: relative;
  width: 100%;
}

.cm-multi-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.cm-multi-clear {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--ln-muted);
  cursor: pointer;
  display: inline-flex;
  padding: 2px;
}

.cm-multi-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow: auto;
  background: var(--ln-surface-card);
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-control);
  box-shadow: var(--ln-shadow-hover);
  padding: 6px;
}

.cm-multi-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--ln-radius-xs);
  cursor: pointer;
  font-size: 0.875rem;
}

.cm-multi-option:hover {
  background: var(--ln-surface-pearl);
}

.cm-table-wrap {
  overflow: auto;
}

.cm-table {
  min-width: 2240px;
}

.cm-col-check {
  width: 48px;
}

.cm-col-code {
  min-width: 120px;
}

.cm-col-name {
  min-width: 200px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-col-labels {
  min-width: 140px;
  max-width: 180px;
}

.cm-col-credit {
  min-width: 200px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-col-address {
  min-width: 240px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-col-time {
  min-width: 176px;
  white-space: nowrap;
}

.cm-col-actions {
  min-width: 220px;
}

.sticky-col-left {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ln-surface-card);
}

.sticky-col-right {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--ln-surface-card);
}

.cm-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.cm-action-sep {
  color: var(--ln-hairline);
}

.cm-link-danger {
  color: var(--ln-error) !important;
}

.cm-muted {
  color: var(--ln-muted-soft);
}

.cm-label-tags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.cm-label-count {
  position: relative;
}

.cm-label-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: var(--ln-surface-card);
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-control);
  box-shadow: var(--ln-shadow-hover);
  min-width: 120px;
}

.cm-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cm-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cm-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cm-table-total {
  color: var(--ln-muted);
  font-size: 0.875rem;
}

.cm-create-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 80px;
}

.cm-form-card {
  background: var(--ln-surface-card);
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-card);
  box-shadow: var(--ln-shadow-soft);
  padding: 20px 24px 24px;
}

.cm-form-card-title {
  margin: 0 0 20px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ln-ink);
}

.cm-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 24px;
}

.cm-form-grid .cm-form-field:last-child:nth-child(3n + 1) {
  grid-column: 1 / -1;
}

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

@media (max-width: 640px) {
  .cm-form-grid {
    grid-template-columns: 1fr;
  }
}

.cm-form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cm-form-label {
  font-size: 0.875rem;
  color: var(--ln-body);
}

.cm-required {
  color: var(--ln-error);
  margin-left: 2px;
}

.cm-form-hint {
  font-size: 0.75rem;
  color: var(--ln-muted);
}

.cm-textarea {
  min-height: 80px;
  resize: vertical;
  padding-top: 8px;
  padding-bottom: 8px;
}

.cm-input-disabled {
  background: var(--ln-surface-pearl) !important;
  color: var(--ln-muted) !important;
  cursor: not-allowed;
}

.cm-select-placeholder {
  color: var(--ln-muted);
}

.cm-city-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cm-create-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  margin: 0 -32px -32px;
  background: var(--ln-surface-card);
  border-top: 1px solid var(--ln-hairline);
  box-shadow: 0 -2px 10px rgba(24, 24, 27, 0.05);
}

@media (prefers-reduced-motion: reduce) {
  .cm-multi-trigger,
  .cm-label-count {
    transition: none;
  }
}

/* ==========================================================================
   风险标签 — 列表展示 / 抽屉 / 批量打标
   ========================================================================== */

.cm-role-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-control);
  background: var(--ln-surface-pearl);
  font-size: 0.875rem;
}

.cm-role-bar-label {
  color: var(--ln-muted);
}

.cm-role-select {
  width: auto;
  min-width: 200px;
  min-height: var(--vm-control-height);
  height: var(--vm-control-height);
}

.cm-role-hint {
  color: var(--ln-warning);
  font-size: 0.8125rem;
}

.cm-risk-label-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.cm-risk-tag {
  display: inline-flex;
  align-items: center;
  max-width: 88px;
  padding: 0 6px;
  line-height: 20px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--ln-surface-card);
  cursor: default;
}

button.cm-risk-tag {
  cursor: pointer;
  font: inherit;
}

button.cm-risk-tag:hover {
  filter: brightness(0.98);
}

.cm-risk-tag--low {
  border-color: #c9cdd4;
  color: #4e5969;
}

.cm-risk-tag--medium {
  border-color: #ffcf8b;
  color: #b45309;
  background: #fffbeb;
}

.cm-risk-tag--high {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fef2f2;
}

.cm-risk-tag--critical {
  border-color: #f87171;
  color: #991b1b;
  background: #fee2e2;
}

.cm-risk-tag-count {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  line-height: 20px;
  border-radius: 4px;
  border: 1px solid var(--ln-hairline);
  font-size: 12px;
  color: var(--ln-muted);
  cursor: default;
  position: relative;
}

.cm-risk-tag-pending {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  line-height: 18px;
  border-radius: 4px;
  font-size: 11px;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.cm-risk-tag-tooltip {
  min-width: 140px;
}

.cm-risk-tag-status {
  margin-left: 4px;
  font-size: 10px;
  color: var(--ln-muted);
}

.cm-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(24, 24, 27, 0.35);
}

.cm-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 56;
  display: flex;
  flex-direction: column;
  width: min(520px, 100vw);
  height: 100vh;
  background: var(--ln-surface-card);
  border-left: 1px solid var(--ln-hairline);
  box-shadow: var(--ln-shadow-modal);
}

.cm-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--ln-hairline);
}

.cm-drawer-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ln-ink);
}

.cm-drawer-header p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--ln-muted);
}

.cm-drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--ln-hairline);
}

.cm-drawer-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ln-muted);
  font-size: 0.875rem;
  cursor: pointer;
}

.cm-drawer-tabs button.is-active {
  color: var(--ln-primary);
  border-bottom-color: var(--ln-primary);
  font-weight: 600;
}

.cm-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
}

.cm-drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--ln-hairline);
  background: var(--ln-surface-card);
}

.cm-risk-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.cm-risk-form-full {
  margin-top: 14px;
}

.cm-risk-form .cm-form-field {
  gap: 6px;
}

.cm-risk-upload {
  min-height: 96px;
  padding: 16px;
}

.cm-risk-upload p {
  margin: 6px 0 0;
  font-size: 0.875rem;
}

.cm-risk-upload .hint {
  font-size: 0.75rem;
  color: var(--ln-muted);
}

.cm-risk-attachments {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.cm-risk-attachments li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.cm-risk-alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--ln-radius-control);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.875rem;
}

.cm-risk-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--ln-radius-control);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.875rem;
}

.cm-risk-tag-list {
  display: grid;
  gap: 12px;
}

.cm-risk-tag-item {
  padding: 12px 14px;
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-control);
  background: var(--ln-canvas-soft);
}

.cm-risk-tag-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cm-risk-tag-item-head strong {
  display: block;
  color: var(--ln-ink);
}

.cm-risk-tag-meta {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--ln-muted);
}

.cm-risk-tag-reason {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--ln-body);
  line-height: 1.5;
}

.cm-risk-tag-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 8px;
}

.cm-risk-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--ln-radius-pill);
  font-size: 0.75rem;
  white-space: nowrap;
}

.cm-risk-status--生效中 {
  color: #047857;
  background: #ecfdf5;
}

.cm-risk-status--待审批,
.cm-risk-status--待确认 {
  color: #b45309;
  background: #fffbeb;
}

.cm-risk-status--已驳回,
.cm-risk-status--已移除 {
  color: #b91c1c;
  background: #fef2f2;
}

.cm-risk-status--已过期 {
  color: var(--ln-muted);
  background: var(--ln-surface-pearl);
}

.cm-risk-log-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.cm-risk-log-list li {
  padding: 10px 12px;
  border-left: 3px solid var(--ln-primary);
  background: var(--ln-canvas-soft);
  border-radius: 0 var(--ln-radius-control) var(--ln-radius-control) 0;
}

.cm-risk-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cm-risk-log-head time {
  font-size: 0.75rem;
  color: var(--ln-muted);
}

.cm-risk-log-list p {
  margin: 6px 0 4px;
  font-size: 0.875rem;
  color: var(--ln-body);
}

.cm-drawer-subpanel {
  position: absolute;
  inset: auto 16px 80px 16px;
  z-index: 2;
  max-height: 60vh;
  overflow: auto;
}

.cm-drawer-overlay-panel {
  position: absolute;
  inset: auto 16px 80px 16px;
  z-index: 3;
  padding: 16px;
  background: var(--ln-surface-card);
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-card);
  box-shadow: var(--ln-shadow-hover);
}

.cm-drawer-overlay-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

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

.cm-link-danger-btn {
  background: var(--ln-error) !important;
  border-color: var(--ln-error) !important;
  color: #fff !important;
}

.cm-risk-detail-card {
  padding: 14px 16px;
  background: var(--ln-surface-card);
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-card);
  box-shadow: var(--ln-shadow-hover);
}

.cm-risk-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.cm-risk-detail-head h4 {
  margin: 0 0 6px;
}

.cm-risk-detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.cm-risk-detail-list div {
  min-width: 0;
}

.cm-risk-detail-list dt {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ln-muted);
}

.cm-risk-detail-list dd {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--ln-ink);
}

.cm-risk-detail-full {
  grid-column: 1 / -1;
}

.cm-batch-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.cm-batch-chip {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--ln-radius-pill);
  background: var(--ln-canvas-soft);
  border: 1px solid var(--ln-hairline);
  font-size: 0.8125rem;
  color: var(--ln-body);
}

.cm-batch-risk-modal {
  max-height: calc(100vh - 48px);
  overflow: auto;
}

@media (max-width: 640px) {
  .cm-drawer {
    width: 100vw;
  }

  .cm-risk-form-grid,
  .cm-risk-detail-list {
    grid-template-columns: 1fr;
  }
}
