/* ==========================================================================
   奕链 YiLink · 共享组件（.yl-*）
   ---------------------------------------------------------------------------
   只依赖 tokens.css 的变量，三页通用。目前监控台的三态卡片、骨架、按钮
   已改用这里的类；新增页面不要再复制一套自己的卡片/按钮/空态样式。
   ========================================================================== */

/* ---- 卡片 ---- */
.yl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---- 按钮 ---- */
.yl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  font: 500 13px/1.3 var(--font-sans);
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.yl-btn:hover { background: var(--soft-bg); }
.yl-btn:active { transform: translateY(1px); }
.yl-btn--primary {
  background: var(--text);
  color: var(--page-bg);
  border-color: var(--text);
}
.yl-btn--primary:hover { opacity: 0.88; background: var(--text); }
.yl-btn--ghost { border-color: var(--line); color: var(--muted); }
.yl-btn--ghost:hover { color: var(--text); }

/* ---- 徽章 ---- */
.yl-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}

/* ---- 三态卡片：空 / 错误（加载用 .yl-skel） ---- */
.yl-state {
  max-width: 640px;
  margin: 20px auto;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}
.yl-state__ico { color: var(--muted); margin-bottom: 10px; }
.yl-state--error .yl-state__ico { color: var(--danger); }
.yl-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.yl-state__text { font-size: 13px; color: var(--muted); line-height: 1.7; }
.yl-state__text code {
  font-family: var(--font-mono); font-size: 12px;
  padding: 1px 5px; background: var(--soft-bg); border-radius: var(--radius-xs);
}
.yl-state__meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px; margin: 16px 0 4px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.yl-state__meta dt { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.yl-state__meta dd {
  font-size: 12.5px; font-family: var(--font-mono);
  color: var(--text); word-break: break-word;
}
.yl-state__actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.yl-state__detail { margin-top: 14px; font-size: 12px; color: var(--muted); }
.yl-state__detail summary { cursor: pointer; }
.yl-state__detail pre {
  margin-top: 8px; padding: 10px;
  background: var(--soft-bg); border-radius: var(--radius-xs);
  overflow-x: auto; font-family: var(--font-mono); font-size: 11.5px;
}

/* ---- 骨架屏 ---- */
.yl-skel { padding: 20px 4px; }
.yl-skel i {
  display: block; height: 14px; margin: 12px 0;
  border-radius: var(--radius-xs);
  background: var(--soft-bg);
  animation: yl-pulse 1.2s ease-in-out infinite;
}
.yl-skel i:nth-child(1) { width: 42%; }
.yl-skel i:nth-child(2) { width: 88%; }
.yl-skel i:nth-child(3) { width: 66%; }
@keyframes yl-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ---- KPI ---- */
.yl-kpi { padding: 12px 14px; }
.yl-kpi__label { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.yl-kpi__value {
  font-size: 22px; font-weight: 600; line-height: 1.2;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}

@media (prefers-reduced-motion: reduce) {
  .yl-skel i { animation: none; }
}
