/* ============================================================
   仪表盘组件样式（用户中心 + 后台）
   独立文件，避免与旧版 skin-ink.css 缓存冲突
   ============================================================ */

/* ---------- 通用指标三宫格 ---------- */
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.dash-metric {
  position: relative;
  background: #f8fafc;
  border: 1px solid #e6e9ef;
  border-radius: 12px;
  padding: 14px 14px 14px 18px;
  overflow: hidden;
  min-width: 0;
}

.dash-metric::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: linear-gradient(180deg, #7c3aed 0%, #a78bfa 100%);
}

.dash-metric-label {
  font-size: 12px;
  line-height: 1.3;
  color: #7b8798;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-metric-value {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.05;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  word-break: break-all;
}

.dash-metric-value .unit {
  font-size: 13px;
  font-weight: 600;
  color: #7b8798;
  margin-left: 2px;
  letter-spacing: 0;
}

/* 后台配色：深蓝 */
.admin-panel .dash-metric::before {
  background: linear-gradient(180deg, #1e293b 0%, #475569 100%);
}

/* ---------- 趋势柱状图 ---------- */
.dash-trend {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 180px;
  margin-top: 14px;
  padding: 18px 2px 0;
}

.dash-trend-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #7b8798;
  font-size: 13px;
}

.dash-trend-bar {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.dash-trend-bar-fill {
  position: relative;
  width: 100%;
  max-width: 28px;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #7c3aed 0%, #c4b5fd 100%);
  transition: height 0.3s ease;
}

.admin-panel .dash-trend-bar-fill {
  background: linear-gradient(180deg, #1e293b 0%, #64748b 100%);
}

.dash-trend-bar-val {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.dash-trend-bar-date {
  margin-top: 7px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

/* ---------- 后台：即将到期列表 ---------- */
.admin-expiring-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 300px;
  overflow: auto;
}

.admin-expiring-empty {
  padding: 22px 0;
  text-align: center;
  color: #7b8798;
  font-size: 13px;
}

.admin-expiring-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
}

.admin-expiring-info {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-expiring-name {
  font-size: 13px;
  font-weight: 650;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-expiring-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #7b8798;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-expiring-days {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
  white-space: nowrap;
}

/* ---------- 后台：用户排行 ---------- */
.admin-top-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-height: 300px;
  overflow: auto;
}

.admin-top-users-empty {
  padding: 22px 0;
  text-align: center;
  color: #7b8798;
  font-size: 13px;
}

.admin-top-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
}

.admin-top-user-rank {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-top-user-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-top-user-count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
}

.admin-top-user-avg {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
}

/* ---------- 仪表盘两列布局 ---------- */
.dash-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.dash-row > * {
  flex: 1 1 360px;
  min-width: 0;
}

/* ---------- 窄屏适配 ---------- */
@media (max-width: 760px) {
  .dash-metrics {
    gap: 8px;
  }
  .dash-metric {
    padding: 11px 10px 11px 14px;
    border-radius: 10px;
  }
  .dash-metric::before {
    width: 3px;
  }
  .dash-metric-label {
    font-size: 10.5px;
  }
  .dash-metric-value {
    margin-top: 6px;
    font-size: 18px;
  }
  .dash-metric-value .unit {
    font-size: 10.5px;
  }
  .dash-trend {
    height: 140px;
    gap: 4px;
  }
  .dash-trend-bar-fill {
    max-width: 20px;
  }
  .dash-trend-bar-val {
    font-size: 9.5px;
    top: -15px;
  }
  .dash-trend-bar-date {
    font-size: 9.5px;
  }
  .dash-row > * {
    flex: 1 1 100%;
  }
}

@media (max-width: 400px) {
  .dash-metric-value {
    font-size: 15px;
  }
  .dash-metric-label {
    font-size: 9.5px;
  }
}
