widget-common.scss 5.27 KB
// 绿纤工作台 · Soft UI Evolution
// Primary 对齐项目主色 #409EFF,背景/文字取 SaaS Trust Blue 体系

$wb-primary: #409eff;
$wb-primary-soft: #ecf5ff;
$wb-primary-deep: #2f7fd4;
$wb-bg: #f5f7fb;
$wb-surface: #ffffff;
$wb-text: #1e293b;
$wb-text-secondary: #64748b;
$wb-text-muted: #94a3b8;
$wb-border: #e8eef5;
$wb-radius: 12px;
$wb-radius-sm: 8px;
$wb-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
$wb-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(64, 158, 255, 0.1);
$wb-ease: 200ms ease;

// 语义色(克制使用,仅图标底/状态点)
$wb-orange: #f59e0b;
$wb-orange-soft: #fff7ed;
$wb-green: #10b981;
$wb-green-soft: #ecfdf5;
$wb-purple: #8b5cf6;
$wb-purple-soft: #f5f3ff;
$wb-red: #ef4444;
$wb-red-soft: #fef2f2;
$wb-cyan: #06b6d4;
$wb-cyan-soft: #ecfeff;

.wb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  padding: 6px 8px;
  text-align: center;
  overflow: hidden;

  &__circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: $wb-primary-soft;
    color: $wb-primary;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 8px;
    flex-shrink: 0;
  }

  &__title {
    font-size: 13px;
    font-weight: 500;
    color: $wb-text-secondary;
    margin-bottom: 2px;
  }

  &__desc {
    font-size: 12px;
    color: $wb-text-muted;
    line-height: 1.4;
    max-width: 160px;
  }

  &__action {
    margin-top: 6px;
  }
}

.wb-metric-row {
  display: grid;
  gap: 10px;
  height: 100%;
  align-content: stretch;
  overflow: hidden;

  &--3 { grid-template-columns: repeat(3, 1fr); }
  &--4 { grid-template-columns: repeat(2, 1fr); }
}

.wb-metric {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: $wb-radius-sm;
  background: $wb-bg;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color $wb-ease, background $wb-ease, box-shadow $wb-ease;
  min-height: 0;
  overflow: hidden;

  &:hover {
    background: $wb-surface;
    border-color: #d6e8ff;
    box-shadow: $wb-shadow;
  }

  &__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  &__body { min-width: 0; flex: 1; overflow: hidden; }

  &__num {
    font-size: 20px;
    font-weight: 700;
    color: $wb-text;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }

  &__label {
    margin-top: 2px;
    font-size: 12px;
    color: $wb-text-secondary;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &--orange .wb-metric__icon { background: $wb-orange-soft; color: $wb-orange; }
  &--blue .wb-metric__icon { background: $wb-primary-soft; color: $wb-primary; }
  &--purple .wb-metric__icon { background: $wb-purple-soft; color: $wb-purple; }
  &--green .wb-metric__icon { background: $wb-green-soft; color: $wb-green; }
  &--red .wb-metric__icon { background: $wb-red-soft; color: $wb-red; }
  &--cyan .wb-metric__icon { background: $wb-cyan-soft; color: $wb-cyan; }
}

.wb-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.wb-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 6px;
  margin: 0 -2px;
  border-radius: $wb-radius-sm;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background $wb-ease;
  flex-shrink: 0;

  & + & {
    border-top: 1px solid #f1f5f9;
  }

  &:hover { background: $wb-primary-soft; }

  &__left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    gap: 8px;
  }

  &__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: $wb-primary;
    flex-shrink: 0;
  }

  &__title {
    font-size: 13px;
    color: $wb-text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &__meta {
    font-size: 12px;
    color: $wb-text-muted;
    flex-shrink: 0;
    white-space: nowrap;
  }

  &__badge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    height: 18px;
    line-height: 18px;
    border-radius: 9px;
    font-size: 11px;
    background: $wb-orange-soft;
    color: $wb-orange;
    flex-shrink: 0;
  }
}

.wb-kpi-grid {
  display: grid;
  gap: 8px;
  height: 100%;
}

.wb-kpi-cell {
  padding: 12px 10px;
  border-radius: $wb-radius-sm;
  background: $wb-bg;
  text-align: left;
  border: 1px solid transparent;

  &__label {
    font-size: 12px;
    color: $wb-text-secondary;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &__value {
    font-size: 16px;
    font-weight: 700;
    color: $wb-text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
  }

  &--primary { border-left: 3px solid $wb-primary; }
  &--success { border-left: 3px solid $wb-green; }
  &--warning { border-left: 3px solid $wb-orange; }
  &--danger { border-left: 3px solid $wb-red; }
  &--info { border-left: 3px solid $wb-text-muted; }
}

@media (prefers-reduced-motion: reduce) {
  .wb-metric,
  .wb-list-item {
    transition: none !important;
  }
}