.ry-sd,
.ry-sd-modal {
  --ry-ink: #1d2633;
  --ry-body: #3d4756;
  --ry-muted: #6b7584;
  --ry-faint: #98a1ae;
  --ry-line: #e3e6ea;
  --ry-line-soft: #eef0f3;
  --ry-canvas: #f4f5f7;
  --ry-brand: #0e8f63;
  --ry-brand-tint: #e9f4ef;
  --ry-amber: #a35a0b;
  --ry-amber-tint: #fbf3e8;
  --ry-red: #b42318;
  --ry-red-tint: #fcefee;
}

.ry-sd {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
  padding: 20px 24px 28px;
  font-size: 13px;
  color: var(--ry-body);
  background: var(--ry-canvas);
}

.ry-sd .tabular-nums,
.ry-sd-modal .tabular-nums {
  font-variant-numeric: tabular-nums;
}

.ry-sd b {
  font-weight: 600;
  color: var(--ry-ink);
}

.ry-sd .is-red {
  color: var(--ry-red);
}

.ry-sd .is-amber {
  color: var(--ry-amber);
}

.ry-sd-faint {
  color: var(--ry-faint);
}

.ry-sd-ico {
  margin-right: 6px;
  font-size: 15px;
  vertical-align: -3px;
}

.ry-sd-ico--solo {
  margin-right: 0;
}

/* 顶栏 */
.ry-sd-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: flex-end;
  justify-content: space-between;
}

.ry-sd-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  color: var(--ry-ink);
}

.ry-sd-sub {
  margin: 2px 0 0;
  color: var(--ry-muted);
}

.ry-sd-head__actions {
  display: flex;
  gap: 8px;
}

/* AntD 覆盖：全局主色是薄荷绿，这里统一为品牌深绿 */
.ry-sd .ant-btn,
.ry-sd-modal .ant-btn {
  border-radius: 6px;
  box-shadow: none;
}

.ry-sd .ant-btn-default,
.ry-sd-modal .ant-btn-default {
  color: var(--ry-body);
  border-color: var(--ry-line);
}

.ry-sd .ant-btn-default:not(:disabled):hover {
  color: var(--ry-brand);
  border-color: var(--ry-brand);
}

.ry-sd .ant-btn-primary:not(:disabled) {
  background: var(--ry-brand);
}

.ry-sd .ant-btn-primary:not(:disabled):hover {
  background: #0b7a54;
}

.ry-sd .ant-btn-link {
  color: var(--ry-brand);
}

.ry-sd .ant-input-affix-wrapper,
.ry-sd .ant-select:not(.ant-select-customize-input) .ant-select-selector,
.ry-sd-modal .ant-input-affix-wrapper,
.ry-sd-modal .ant-picker {
  border-color: var(--ry-line);
  border-radius: 6px;
}

.ry-sd .ant-input-affix-wrapper-focused,
.ry-sd .ant-input-affix-wrapper:hover,
.ry-sd-modal .ant-input-affix-wrapper-focused,
.ry-sd-modal .ant-input-affix-wrapper:hover,
.ry-sd-modal .ant-picker:hover,
.ry-sd-modal .ant-picker-focused {
  border-color: var(--ry-brand);
  box-shadow: none;
}

.ry-sd-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 240px;
}

.ry-sd-card {
  background: #fff;
  border: 1px solid var(--ry-line);
  border-radius: 8px;
}

.ry-sd-card__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  min-height: 52px;
  padding: 10px 16px 10px 20px;
  border-bottom: 1px solid var(--ry-line-soft);
}

.ry-sd-card__head h2,
.ry-sd-clients__bar h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ry-ink);
}

.ry-sd-card__meta {
  color: var(--ry-faint);
}

.ry-sd-empty {
  padding: 32px 16px;
  margin: 0;
  color: var(--ry-faint);
  text-align: center;
}

.ry-sd-link {
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font: inherit;
  color: var(--ry-brand);
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: 0;
}

.ry-sd-link:hover:not(:disabled) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ry-sd-link.is-ink {
  font-weight: 500;
  color: var(--ry-ink);
}

.ry-sd-link.is-ink:hover:not(:disabled) {
  color: var(--ry-brand);
}

.ry-sd-link:disabled {
  cursor: default;
}

.ry-sd-dot {
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: 2px;
  background: currentcolor;
  border-radius: 50%;
}

.ry-sd button:focus-visible {
  outline: 2px solid var(--ry-brand);
  outline-offset: 2px;
}

/* 指标条 */
.ry-sd-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ry-sd-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  min-width: 0;
  padding: 14px 20px 16px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-left: 1px solid var(--ry-line-soft);
  transition: background-color 0.15s;
}

.ry-sd-kpi:first-child {
  border-left: 0;
  border-radius: 8px 0 0 8px;
}

.ry-sd-kpi:last-child {
  border-radius: 0 8px 8px 0;
}

.ry-sd-kpi:hover:not(:disabled, .is-static) {
  background: #fafbfc;
}

.ry-sd-kpi:disabled,
.ry-sd-kpi.is-static {
  cursor: default;
}

.ry-sd-kpi.is-active {
  box-shadow: inset 0 -2px 0 var(--ry-ink);
}

.ry-sd-kpi__label {
  color: var(--ry-muted);
}

.ry-sd-kpi__value {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  color: var(--ry-ink);
}

.ry-sd-kpi__value small {
  font-size: 13px;
  font-weight: 400;
  color: var(--ry-muted);
}

.ry-sd-kpi__sub {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--ry-faint);
  white-space: nowrap;
}

/* 空状态 */
.ry-sd-onboard {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 28px 28px 32px;
}

.ry-sd-onboard__ico {
  flex: none;
  padding: 10px;
  font-size: 44px;
  color: var(--ry-muted);
  background: var(--ry-line-soft);
  border-radius: 8px;
}

.ry-sd-onboard h2 {
  margin: 2px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ry-ink);
}

.ry-sd-onboard p {
  max-width: 640px;
  margin: 0 0 16px;
  line-height: 1.7;
  color: var(--ry-muted);
}

/* 日程 + 预警 */
.ry-sd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: stretch;
}

.ry-sd-sched,
.ry-sd-alerts {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ry-sd-month {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}

.ry-sd-month__label {
  min-width: 84px;
  font-weight: 500;
  color: var(--ry-ink);
  text-align: center;
}

.ry-sd-month .ant-btn {
  margin-left: 6px;
}

.ry-sd-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 16px;
  color: var(--ry-muted);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 6px;
}

.ry-sd-icon-btn:hover {
  color: var(--ry-ink);
  background: var(--ry-line-soft);
}

.ry-sd-sched__body {
  display: grid;
  flex: 1;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 0;
}

.ry-sd-cal {
  padding: 12px 16px 16px;
  border-right: 1px solid var(--ry-line-soft);
}

.ry-sd-cal__row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.ry-sd-cal__wd span {
  padding: 4px 0 6px;
  font-size: 12px;
  color: var(--ry-faint);
  text-align: center;
}

.ry-sd-cal__cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  justify-content: center;
  height: 42px;
  margin: 1px;
  font: inherit;
  color: var(--ry-ink);
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
}

.ry-sd-cal__cell:hover {
  background: var(--ry-line-soft);
}

.ry-sd-cal__cell.is-out {
  color: #c4cad2;
}

.ry-sd-cal__cell.is-today {
  border-color: var(--ry-brand);
}

.ry-sd-cal__cell.is-today .ry-sd-cal__num {
  font-weight: 600;
  color: var(--ry-brand);
}

.ry-sd-cal__cell.is-selected {
  background: var(--ry-ink);
  border-color: var(--ry-ink);
}

.ry-sd-cal__cell.is-selected .ry-sd-cal__num,
.ry-sd-cal__cell.is-selected .ry-sd-cal__count {
  color: #fff;
}

.ry-sd-cal__num {
  font-size: 13px;
  line-height: 18px;
}

.ry-sd-cal__count {
  min-height: 14px;
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  color: var(--ry-brand);
}

.ry-sd-cal__cell.is-out .ry-sd-cal__count {
  color: #b7c1cb;
}

.ry-sd-day {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: 340px;
}

.ry-sd-day__head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 20px 10px;
  color: var(--ry-faint);
}

.ry-sd-day__head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ry-ink);
}

.ry-sd-tasks {
  flex: 1;
  padding: 0 8px 8px;
  margin: 0;
  overflow-y: auto;
  list-style: none;
}

.ry-sd-task {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
}

.ry-sd-task + .ry-sd-task {
  border-top: 1px solid var(--ry-line-soft);
}

.ry-sd-task:hover {
  background: #fafbfc;
}

.ry-sd-task__time {
  flex: none;
  width: 44px;
  font-weight: 500;
  color: var(--ry-ink);
}

.ry-sd-task__main {
  flex: 1;
  min-width: 0;
}

.ry-sd-task__title {
  display: block;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font: inherit;
  font-weight: 500;
  color: var(--ry-ink);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: 0;
}

.ry-sd-task__title:hover:not(:disabled) {
  color: var(--ry-brand);
}

.ry-sd-task__title:disabled {
  cursor: default;
}

.ry-sd-task__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ry-muted);
}

.ry-sd-task__meta > * + *::before {
  margin-right: 6px;
  color: #c4cad2;
  content: '·';
}

.ry-sd-task__done {
  display: inline-flex;
  flex: none;
  gap: 4px;
  align-items: center;
  font-size: 12px;
  color: var(--ry-faint);
}

.ry-sd-task.is-done .ry-sd-task__title,
.ry-sd-task.is-done .ry-sd-task__time {
  color: var(--ry-faint);
}

.ry-sd-task.is-done .ry-sd-task__title {
  text-decoration: line-through;
}

.ry-sd-task__act.ant-btn {
  flex: none;
}

.ry-sd-toggle {
  display: inline-flex;
  padding: 2px;
  margin-left: 4px;
  background: var(--ry-line-soft);
  border-radius: 6px;
}

.ry-sd-toggle button {
  padding: 2px 10px;
  font: inherit;
  font-size: 12px;
  line-height: 20px;
  color: var(--ry-muted);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 4px;
}

.ry-sd-toggle button.is-active {
  font-weight: 500;
  color: var(--ry-ink);
  background: #fff;
  box-shadow: 0 0 0 1px var(--ry-line);
}

.ry-sd-more {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  padding: 0;
  margin-left: auto;
  font: inherit;
  font-size: 12px;
  color: var(--ry-muted);
  cursor: pointer;
  background: none;
  border: 0;
}

.ry-sd-more:hover {
  color: var(--ry-brand);
}

.ry-sd-alert-list {
  flex: 1;
  max-height: 340px;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  list-style: none;
}

.ry-sd-alert {
  padding: 12px 20px;
  border-bottom: 1px solid var(--ry-line-soft);
}

.ry-sd-alert:last-child {
  border-bottom: 0;
}

.ry-sd-alert__top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ry-sd-alert__level {
  flex: none;
  font-size: 12px;
  font-weight: 500;
}

.ry-sd-alert.is-red .ry-sd-alert__level {
  color: var(--ry-red);
}

.ry-sd-alert.is-yellow .ry-sd-alert__level {
  color: var(--ry-amber);
}

.ry-sd-alert.is-green .ry-sd-alert__level {
  color: var(--ry-muted);
}

.ry-sd-alert__rule {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--ry-ink);
  white-space: nowrap;
}

.ry-sd-alert__time {
  flex: none;
  font-size: 12px;
  color: var(--ry-faint);
}

.ry-sd-alert__summary {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  -webkit-line-clamp: 2;
  font-size: 12px;
  line-height: 18px;
  color: var(--ry-muted);
  -webkit-box-orient: vertical;
}

.ry-sd-alert__foot {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
}

.ry-sd-alert__status {
  color: var(--ry-faint);
}

.ry-sd-alert.is-pending .ry-sd-alert__status {
  color: var(--ry-body);
}

.ry-sd-alert.is-closed .ry-sd-alert__rule {
  font-weight: 400;
  color: var(--ry-muted);
}

/* 客户表 */
.ry-sd-clients {
  overflow: hidden;
}

.ry-sd-clients__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--ry-line-soft);
}

.ry-sd-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
}

.ry-sd-tab {
  position: relative;
  padding: 15px 0 13px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ry-muted);
  cursor: pointer;
  background: none;
  border: 0;
}

.ry-sd-tab span {
  margin-left: 4px;
  color: var(--ry-faint);
}

.ry-sd-tab:hover {
  color: var(--ry-ink);
}

.ry-sd-tab.is-active {
  font-weight: 600;
  color: var(--ry-ink);
}

.ry-sd-tab.is-active span {
  color: var(--ry-muted);
}

.ry-sd-tab.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: '';
  background: var(--ry-ink);
}

.ry-sd-clients__tools {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  margin-left: auto;
}

.ry-sd-search.ant-input-affix-wrapper {
  width: 240px;
}

.ry-sd-sort.ant-select {
  width: 128px;
}

.ry-sd-kbd {
  padding: 0 5px;
  font-family: inherit;
  font-size: 11px;
  line-height: 16px;
  color: var(--ry-faint);
  border: 1px solid var(--ry-line);
  border-radius: 4px;
}

.ry-sd-table-wrap {
  overflow-x: auto;
}

.ry-sd-table {
  width: 100%;
  min-width: 1040px;
  table-layout: fixed;
  border-collapse: collapse;
}

.ry-sd-table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ry-muted);
  text-align: left;
  white-space: nowrap;
  background: #fafbfc;
  border-bottom: 1px solid var(--ry-line-soft);
}

.ry-sd-table td {
  padding: 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--ry-line-soft);
}

.ry-sd-table th:first-child,
.ry-sd-table td:first-child {
  padding-left: 20px;
}

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

.ry-sd-table tbody tr:last-child td {
  border-bottom: 0;
}

.ry-sd-table tbody tr:hover td {
  background: #fafbfc;
}

.ry-sd-table .is-right {
  text-align: right;
}

.ry-sd-table__empty {
  padding: 40px 12px !important;
  color: var(--ry-faint);
  text-align: center;
}

.ry-sd-client {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.ry-sd-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ry-body);
  background: var(--ry-line-soft);
  border-radius: 50%;
}

.ry-sd-client__text {
  min-width: 0;
}

.ry-sd-client__name {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.ry-sd-name {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ry-ink);
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: 0;
}

.ry-sd-name:hover {
  color: var(--ry-brand);
}

.ry-sd-badge {
  flex: none;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  color: var(--ry-red);
  background: var(--ry-red-tint);
  border-radius: 4px;
}

.ry-sd-client__sub {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--ry-faint);
  white-space: nowrap;
}

.ry-sd-status {
  white-space: nowrap;
}

.ry-sd-status.is-brand .ry-sd-dot {
  color: var(--ry-brand);
}

.ry-sd-status.is-amber {
  color: var(--ry-amber);
}

.ry-sd-status.is-faint {
  color: var(--ry-muted);
}

.ry-sd-status.is-faint .ry-sd-dot {
  color: #b7c1cb;
}

.ry-sd-risk {
  margin-top: 4px;
  font-size: 12px;
}

.ry-sd-risk.is-high {
  color: var(--ry-red);
}

.ry-sd-risk.is-medium {
  color: var(--ry-amber);
}

.ry-sd-stage__label {
  white-space: nowrap;
}

.ry-sd-stage {
  display: flex;
  gap: 3px;
  width: 88px;
  margin-top: 8px;
}

.ry-sd-stage i {
  flex: 1;
  height: 4px;
  background: var(--ry-line);
  border-radius: 2px;
}

.ry-sd-stage i.is-on {
  background: var(--ry-brand);
}

.ry-sd-plan__name {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.ry-sd-plan__more {
  flex: none;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  color: var(--ry-muted);
  background: var(--ry-line-soft);
  border-radius: 4px;
}

.ry-sd-plan__meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ry-faint);
}

.ry-sd-progress {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 220px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ry-muted);
}

.ry-sd-progress__track {
  flex: 1;
  height: 4px;
  overflow: hidden;
  background: var(--ry-line);
  border-radius: 2px;
}

.ry-sd-progress__fill {
  display: block;
  height: 100%;
  background: var(--ry-brand);
  border-radius: 2px;
}

.ry-sd-next {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  color: var(--ry-ink);
  -webkit-box-orient: vertical;
}

.ry-sd-row-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
}

.ry-sd-row-more.ant-btn {
  width: 28px;
  padding: 0;
}

.ry-sd-row-more .iconify {
  font-size: 15px;
  vertical-align: -3px;
}

/* 随访记录弹窗 */
.ry-sd-modal .ant-modal-content {
  border-radius: 8px;
}

.ry-sd-modal .ant-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ry-ink);
}

.ry-sd-fq__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}

.ry-sd-fq__search.ant-input-affix-wrapper {
  width: 280px;
}

.ry-sd-fq__thumb img {
  object-fit: cover;
  border-radius: 4px;
}

.ry-sd-modal .ant-table-thead > tr > th {
  font-weight: 500;
  color: var(--ry-muted);
  background: #fafbfc;
}

.ry-sd-modal .ant-pagination-item-active {
  border-color: var(--ry-brand);
}

.ry-sd-modal .ant-pagination-item-active a {
  color: var(--ry-brand);
}

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

  .ry-sd-alert-list {
    max-height: 300px;
  }
}

@media (max-width: 960px) {
  .ry-sd {
    padding: 16px;
  }

  .ry-sd-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ry-sd-kpi {
    border-top: 1px solid var(--ry-line-soft);
    border-left: 0;
  }

  .ry-sd-kpi:nth-child(-n + 2) {
    border-top: 0;
  }

  .ry-sd-kpi:nth-child(even) {
    border-left: 1px solid var(--ry-line-soft);
  }

  .ry-sd-sched__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .ry-sd-cal {
    border-right: 0;
    border-bottom: 1px solid var(--ry-line-soft);
  }

  .ry-sd-clients__tools {
    width: 100%;
    margin-left: 0;
  }

  .ry-sd-search.ant-input-affix-wrapper {
    flex: 1;
    width: auto;
  }
}
