/*
 * LinsGeek ERP 首页 —— 「销售趋势」卡片（配合 11-home-trend.js；颜色变量来自 10-home-new.css 的 body.lg-home-new）
 * 回滚：删除 11-home-trend.css + 11-home-trend.js。
 */

/* 原来并排的两个图表：收起不显示（组件照常运行）。新卡片排在任务区和下半部分之间 */
body.lg-home-trend #app .flex.justify-between:has(> .h-\[540px\]) {
  position: absolute !important; left: 0 !important; top: 0 !important; width: 1px !important; height: 1px !important;
  overflow: hidden !important; visibility: hidden !important; pointer-events: none !important;
}
#lg-home-trend {
  order: 2; width: 100%; max-width: 1440px; margin: 0 auto; padding: 16px var(--g, 24px) 0; box-sizing: border-box;
  color: var(--ink, #0f1a18); font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
#lg-home-trend *, #lg-home-trend *::before, #lg-home-trend *::after { box-sizing: border-box; }
#lg-home-trend .lgt { padding: 16px 18px 12px; }

/* 标题 + 筛选 */
#lg-home-trend .lgt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
#lg-home-trend .lgt-head .lg-title { margin-bottom: 0; }
#lg-home-trend .lgt-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
#lg-home-trend .lgt-select, #lg-home-trend .lgt-custom input {
  font: inherit; font-size: 13px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid #dfe6e4; background: #fff; color: inherit; outline: none; min-width: 0;
}
#lg-home-trend .lgt-select:focus, #lg-home-trend .lgt-custom input:focus { border-color: var(--brand-2, #13b8a6); box-shadow: 0 0 0 3px rgba(19, 184, 166, .15); }
#lg-home-trend .lgt-seg { display: inline-flex; padding: 3px; border-radius: 12px; background: #f1f5f4; }
#lg-home-trend .lgt-pill { all: unset; cursor: pointer; height: 28px; padding: 0 12px; border-radius: 9px; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2, #55635f); white-space: nowrap; display: inline-flex; align-items: center; }
#lg-home-trend .lgt-pill:hover { color: var(--brand, #0d7b6d); }
#lg-home-trend .lgt-pill.on { background: #fff; color: var(--brand, #0d7b6d); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
#lg-home-trend .lgt-pill:focus-visible { outline: 2px solid var(--brand-2, #13b8a6); outline-offset: 1px; }
#lg-home-trend .lgt-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3, #8a9794); }
#lg-home-trend .lgt-custom[hidden] { display: none; }
#lg-home-trend .lgt-custom i { font-style: normal; }

/* 三个数字：前两个可以点，切换下面的图 */
#lg-home-trend .lgt-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
#lg-home-trend .lgt-kpi {
  all: unset; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line, rgba(15, 35, 30, .08)); background: #fff; font-family: inherit;
}
#lg-home-trend button.lgt-kpi { cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
#lg-home-trend button.lgt-kpi:hover { border-color: rgba(13, 123, 109, .35); }
#lg-home-trend button.lgt-kpi:focus-visible { outline: 2px solid var(--brand-2, #13b8a6); outline-offset: 2px; }
#lg-home-trend .lgt-kpi.on { background: var(--brand-soft, #e7f2f0); border-color: rgba(13, 123, 109, .45); box-shadow: inset 0 -3px 0 var(--brand-2, #13b8a6); }
#lg-home-trend .lgt-kpi.plain { background: #f8faf9; }
#lg-home-trend .lgt-kpi > span { font-size: 12.5px; color: var(--ink-2, #55635f); }
#lg-home-trend .lgt-kpi > b { font-size: clamp(18px, 2.2vw, 24px); line-height: 1.25; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lg-home-trend .lgt-kpi > em { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 18px; font-style: normal; font-size: 12px; color: var(--ink-3, #8a9794); }
#lg-home-trend .lgt-kpi > em i { font-style: normal; font-variant-numeric: tabular-nums; }
#lg-home-trend .lgt-delta { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
#lg-home-trend .lgt-delta.up { color: #1f8a4c; }
#lg-home-trend .lgt-delta.down { color: #d64545; }
#lg-home-trend .dim { opacity: .55; transition: opacity .15s ease; }

/* 图 */
#lg-home-trend .lgt-chart { position: relative; min-height: 130px; touch-action: pan-y; }
#lg-home-trend .lgt-svg { display: block; width: 100%; height: auto; }
#lg-home-trend .lgt-svg text { font-family: inherit; font-size: 12px; fill: #8a9794; font-variant-numeric: tabular-nums; }
#lg-home-trend .lgt-svg .ax { text-anchor: end; }
#lg-home-trend .lgt-svg .xl { text-anchor: middle; }
#lg-home-trend .lgt-svg .none { text-anchor: middle; font-size: 13.5px; fill: #8a9794; }
#lg-home-trend .lgt-svg .grid { stroke: #eef2f1; }
#lg-home-trend .lgt-svg .base { stroke: #c9d3d1; stroke-width: 1.5; }
#lg-home-trend .lgt-svg .area { fill: url(#lgt-fill); }
#lg-home-trend .lgt-svg .line { fill: none; stroke: #0d7b6d; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
#lg-home-trend .lgt-svg .pt { fill: #fff; stroke: #0d7b6d; stroke-width: 2; }
#lg-home-trend .lgt-svg .cross { stroke: #9fb1ad; stroke-dasharray: 3 3; }
#lg-home-trend .lgt-svg .dot { fill: #fff; stroke: #0d7b6d; stroke-width: 3; }
#lg-home-trend .lgt-tip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 150px; padding: 8px 10px; border-radius: 10px; background: #0f1a18; color: #fff; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5);
}
#lg-home-trend .lgt-tip[hidden] { display: none; }
#lg-home-trend .lgt-tip b { display: block; margin-bottom: 2px; font-weight: 600; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
#lg-home-trend .lgt-tip span { display: flex; justify-content: space-between; gap: 14px; color: rgba(255, 255, 255, .75); }
#lg-home-trend .lgt-tip span i { font-style: normal; font-variant-numeric: tabular-nums; }
#lg-home-trend .lgt-tip span.on { color: #fff; font-weight: 700; }
#lg-home-trend .lgt-state { all: unset; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 240px; color: var(--ink-3, #8a9794); font-size: 13.5px; font-family: inherit; }
#lg-home-trend .lgt-retry { cursor: pointer; color: #d64545; }

@media (max-width: 720px) {
  #lg-home-trend .lgt { padding: 14px 12px 10px; }
  #lg-home-trend .lgt-filters { width: 100%; }
  #lg-home-trend .lgt-select { flex: 1 1 100%; }
  #lg-home-trend .lgt-seg { flex: 1 1 100%; }
  #lg-home-trend .lgt-pill { flex: 1 1 0; justify-content: center; padding: 0 6px; }
  #lg-home-trend .lgt-custom { flex: 1 1 100%; }
  #lg-home-trend .lgt-custom input { flex: 1 1 0; }
  #lg-home-trend .lgt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #lg-home-trend .lgt-kpi.plain { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 10px; }
  #lg-home-trend .lgt-kpi.plain > b { font-size: 16px; }
}
