summary-metric-card.component.scss 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. @use '../../styles/card' as card;
  2. @use '../../styles/state' as state;
  3. @use '../../styles/tokens' as t;
  4. :host {
  5. display: block;
  6. min-width: 0;
  7. }
  8. .summary-metric-card {
  9. --metric-accent: #{t.$color-text-secondary};
  10. @include card.metric-card(default);
  11. min-height: 132px;
  12. &.compact {
  13. min-height: 108px;
  14. padding: 14px 16px;
  15. }
  16. &.size-sm {
  17. min-height: 96px;
  18. padding: 12px 14px;
  19. .metric-value-row strong {
  20. font-size: 22px;
  21. }
  22. }
  23. &.size-lg {
  24. min-height: 156px;
  25. padding: 22px 24px;
  26. .metric-value-row strong {
  27. font-size: 36px;
  28. }
  29. }
  30. &.size-xl {
  31. min-height: 148px;
  32. padding: 22px 24px;
  33. .metric-value-row strong {
  34. font-size: 40px;
  35. letter-spacing: -0.03em;
  36. }
  37. }
  38. &.variant-plain {
  39. box-shadow: none;
  40. background: t.$color-surface;
  41. border: 1px solid t.$color-border-soft;
  42. &::before {
  43. display: none;
  44. }
  45. }
  46. &.variant-elevated {
  47. box-shadow: t.$shadow-float;
  48. }
  49. &.variant-gradient-soft {
  50. background: linear-gradient(145deg, #ffffff 0%, t.$color-surface-muted 100%);
  51. }
  52. &.variant-warning {
  53. background: linear-gradient(135deg, rgba(t.$color-amber, 0.08), t.$color-surface 46%);
  54. border-color: rgba(t.$color-amber, 0.3);
  55. }
  56. &.variant-urgent {
  57. background: linear-gradient(135deg, rgba(t.$color-red, 0.11), t.$color-surface 58%);
  58. border-color: rgba(t.$color-red, 0.36);
  59. box-shadow: 0 14px 34px rgba(t.$color-red, 0.12);
  60. &::before {
  61. width: 4px;
  62. background: linear-gradient(180deg, rgba(t.$color-red, 0.98), rgba(t.$color-red, 0.42));
  63. }
  64. .metric-icon {
  65. color: t.$color-red;
  66. background: rgba(t.$color-red, 0.1);
  67. box-shadow: none;
  68. }
  69. }
  70. &.emphasis-primary {
  71. .metric-value-row strong {
  72. color: var(--metric-accent);
  73. }
  74. }
  75. &.clickable {
  76. cursor: pointer;
  77. &::after {
  78. content: '›';
  79. position: absolute;
  80. top: 16px;
  81. right: 14px;
  82. color: #94a3b8;
  83. font-size: 18px;
  84. line-height: 1;
  85. font-weight: 500;
  86. }
  87. &:hover {
  88. transform: translateY(-1px);
  89. background: t.$color-accent;
  90. border-color: t.$color-border;
  91. box-shadow: t.$shadow-elev-1;
  92. }
  93. &:focus-visible {
  94. @include t.focus-ring;
  95. }
  96. }
  97. &.tone-blue {
  98. --metric-accent: #{t.$color-blue};
  99. @include card.metric-card(blue);
  100. }
  101. &.tone-green {
  102. --metric-accent: #{t.$color-green};
  103. @include card.metric-card(green);
  104. }
  105. &.tone-amber {
  106. --metric-accent: #{t.$color-amber};
  107. @include card.metric-card(amber);
  108. }
  109. &.tone-red {
  110. --metric-accent: #{t.$color-red};
  111. @include card.metric-card(red);
  112. }
  113. &.tone-purple {
  114. --metric-accent: #{t.$color-purple};
  115. @include card.metric-card(purple);
  116. }
  117. }
  118. .metric-secondary-value {
  119. margin-left: 6px;
  120. color: t.$color-text-muted;
  121. font-size: 13px;
  122. font-style: normal;
  123. font-weight: 700;
  124. }
  125. .metric-meta {
  126. position: relative;
  127. z-index: 1;
  128. display: flex;
  129. align-items: center;
  130. flex-wrap: wrap;
  131. gap: 4px 12px;
  132. margin-top: 8px;
  133. padding-top: 8px;
  134. border-top: 1px dashed t.$color-border-soft;
  135. color: t.$color-text-muted;
  136. font-size: 12px;
  137. strong {
  138. color: t.$color-text;
  139. font-weight: 700;
  140. font-variant-numeric: tabular-nums;
  141. }
  142. }
  143. .metric-meta-confidence {
  144. display: inline-flex;
  145. align-items: center;
  146. gap: 4px;
  147. .dot {
  148. width: 8px;
  149. height: 8px;
  150. border-radius: 50%;
  151. display: inline-block;
  152. &.confidence-high { background: t.$color-green; }
  153. &.confidence-medium { background: t.$color-amber; }
  154. &.confidence-low { background: t.$color-red; }
  155. }
  156. }
  157. .metric-slot {
  158. position: relative;
  159. z-index: 1;
  160. &:empty {
  161. display: none;
  162. }
  163. }
  164. .metric-topline,
  165. .metric-value-row,
  166. .metric-footer {
  167. position: relative;
  168. z-index: 1;
  169. }
  170. .metric-topline {
  171. display: flex;
  172. align-items: center;
  173. justify-content: space-between;
  174. gap: 10px;
  175. color: t.$color-text-muted;
  176. font-size: 13px;
  177. font-weight: 700;
  178. }
  179. .metric-label {
  180. display: inline-flex;
  181. align-items: center;
  182. gap: 4px;
  183. }
  184. .metric-help {
  185. display: inline-flex;
  186. align-items: center;
  187. justify-content: center;
  188. width: 16px;
  189. height: 16px;
  190. border-radius: 50%;
  191. border: 1px solid t.$color-border-soft;
  192. background: t.$color-surface-muted;
  193. color: t.$color-text-muted;
  194. font-size: 11px;
  195. font-weight: 600;
  196. cursor: help;
  197. position: relative;
  198. line-height: 1;
  199. &:hover,
  200. &:focus-visible {
  201. border-color: t.$color-blue;
  202. color: t.$color-blue;
  203. background: rgba(t.$color-blue, 0.08);
  204. .metric-tooltip {
  205. display: block;
  206. }
  207. }
  208. }
  209. .metric-tooltip {
  210. display: none;
  211. position: absolute;
  212. top: calc(100% + 8px);
  213. left: 50%;
  214. transform: translateX(-50%);
  215. background: rgba(0, 0, 0, 0.82);
  216. color: #fff;
  217. padding: 10px 14px;
  218. border-radius: 6px;
  219. font-size: 12px;
  220. font-weight: 400;
  221. line-height: 1.6;
  222. width: 260px;
  223. z-index: 1000;
  224. white-space: normal;
  225. box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
  226. &::before {
  227. content: '';
  228. position: absolute;
  229. top: -6px;
  230. left: 50%;
  231. transform: translateX(-50%);
  232. border-left: 6px solid transparent;
  233. border-right: 6px solid transparent;
  234. border-bottom: 6px solid rgba(0, 0, 0, 0.82);
  235. }
  236. }
  237. .metric-icon {
  238. display: inline-flex;
  239. align-items: center;
  240. justify-content: center;
  241. width: 30px;
  242. height: 30px;
  243. border-radius: 12px;
  244. background: t.$color-surface-muted;
  245. border: 1px solid t.$color-border-soft;
  246. box-shadow: t.$shadow-card-flat;
  247. }
  248. .metric-value-row {
  249. display: flex;
  250. align-items: baseline;
  251. gap: 6px;
  252. margin-top: 14px;
  253. strong {
  254. color: t.$color-text;
  255. font-size: 30px;
  256. font-weight: t.$font-weight-metric;
  257. font-variant-numeric: tabular-nums;
  258. letter-spacing: -0.03em;
  259. line-height: 1.1;
  260. }
  261. span {
  262. color: t.$color-text-muted;
  263. font-size: 13px;
  264. font-weight: 700;
  265. }
  266. }
  267. .metric-footer {
  268. display: flex;
  269. flex-wrap: wrap;
  270. align-items: center;
  271. justify-content: space-between;
  272. gap: 8px;
  273. margin-top: 14px;
  274. color: t.$color-text-muted;
  275. font-size: 12px;
  276. line-height: 1.5;
  277. }
  278. .metric-trend {
  279. display: inline-flex;
  280. align-items: center;
  281. gap: 4px;
  282. font-weight: 700;
  283. &.up {
  284. color: t.$color-green;
  285. }
  286. &.down {
  287. color: t.$color-red;
  288. }
  289. &.flat {
  290. color: t.$color-text-muted;
  291. }
  292. }
  293. .metric-skeleton {
  294. @include state.skeleton-line;
  295. position: relative;
  296. z-index: 1;
  297. &.title {
  298. width: 42%;
  299. }
  300. &.value {
  301. width: 58%;
  302. height: 30px;
  303. margin-top: 18px;
  304. }
  305. &.desc {
  306. width: 76%;
  307. margin-top: 18px;
  308. }
  309. }
  310. @media (max-width: 768px) {
  311. .summary-metric-card {
  312. min-height: 112px;
  313. padding: 14px;
  314. }
  315. .metric-topline {
  316. font-size: 12px;
  317. }
  318. .metric-icon {
  319. width: 28px;
  320. height: 28px;
  321. border-radius: 10px;
  322. }
  323. .metric-value-row {
  324. margin-top: 10px;
  325. strong {
  326. font-size: 26px;
  327. font-variant-numeric: tabular-nums;
  328. letter-spacing: -0.025em;
  329. }
  330. }
  331. .metric-footer {
  332. margin-top: 10px;
  333. font-size: 12px;
  334. }
  335. }