/* Derival Unified Design Library — CMP-FILTER-CHIPS biến thể jelly + nút biểu tượng + chú giải [data-tip] (CY-2026-11-05-jelly). Đi cùng library/derival-controls.js. Chỉ dùng token.
   Chuyển động chép từ React Bits Jelly Radio (MIT + Commons Clause © 2026 David Haz — dùng trong website được phép, giữ ghi chú này);
   vật liệu theo Derival: nhiều tầng chìm — thẻ kính › rãnh chìm (well) › mục đang chọn chìm sâu hơn (well-pressed). */
.jr { display: inline-flex; align-items: center; gap: var(--jr-gap, 4px); padding: var(--jr-pad-y, 4px) var(--jr-pad-x, 8px); border-radius: var(--radius-full);
  background: var(--well); box-shadow: var(--well-shadow); user-select: none; -webkit-user-select: none; }
.jr > button { position: relative; margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; transform-origin: 50% 50%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.jr > button::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, var(--hit-min)); height: var(--hit-min); transform: translate(-50%, -50%); }   /* vùng chạm 44px */
.jr > button:focus-visible { outline: none; } .jr > button:focus-visible .jr-skin { outline: var(--border-width-focus) solid var(--border-focus); outline-offset: 2px; }
.jr-skin { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); height: var(--control-xs); min-width: var(--control-xs); padding: 0 var(--space-2);
  box-sizing: border-box; border-radius: var(--radius-full); color: var(--text-secondary); font: 700 var(--type-caption-size)/1 var(--font-body); white-space: nowrap;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 200ms ease, box-shadow 200ms ease, color 200ms ease; }
.jr > button[aria-checked="true"] { cursor: default; }
.jr > button[aria-checked="true"] .jr-skin { background: var(--well-pressed); box-shadow: var(--well-shadow); color: var(--text-primary); }
@media (hover: hover) and (pointer: fine) { .jr > button[aria-checked="false"]:hover .jr-skin { color: var(--text-primary); } }
.jr > button:active .jr-skin { transform: scale(0.97); }
.jr-skin svg { width: var(--icon-sm); height: var(--icon-sm); }
/* chấm mã sản phẩm — cùng ngôn ngữ với chart sổ (đặc = thắng, rỗng = thua) */
.ic-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.ic-dot.s { background: var(--stock-line); } .ic-dot.d { background: var(--deriv-line); } .ic-dot.loss { background: transparent; box-shadow: inset 0 0 0 1.6px currentColor; }
.ic-dots { display: inline-flex; gap: 3px; }
/* nút biểu tượng bật/tắt (aria-pressed): tròn, chìm khi bật */
.itg { position: relative; display: inline-grid; place-items: center; width: var(--control-xs); height: var(--control-xs); padding: 0; border: 0; border-radius: var(--radius-full); background: var(--well); box-shadow: var(--well-shadow);
  color: var(--text-secondary); cursor: pointer; transition: background-color 200ms ease, color 200ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
.itg::after { content: ""; position: absolute; inset: calc((var(--control-xs) - var(--hit-min)) / 2); }
.itg[aria-pressed="true"] { background: var(--well-pressed); color: var(--text-primary); }
.itg:active { transform: scale(0.94); } .itg:focus-visible { outline: var(--border-width-focus) solid var(--border-focus); outline-offset: 2px; }
.itg svg { width: var(--icon-sm); height: var(--icon-sm); }
/* chú giải bằng con trỏ/focus (title thay chữ) — kính popup nhỏ, không chặn chạm */
[data-tip] { position: relative; }
[data-tip]::before { content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translate(-50%, -4px); opacity: 0; pointer-events: none; z-index: var(--z-popover);
  padding: 4px 8px; border-radius: var(--radius-mini); background: var(--glass-frost-popup); -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); box-shadow: var(--glass-rim), var(--shadow-lift);
  font: 700 var(--type-label-size)/1.3 var(--font-body); color: var(--text-primary); white-space: nowrap; transition: opacity var(--duration-fast) ease, transform var(--duration-fast) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { [data-tip]:hover::before { opacity: 1; transform: translate(-50%, 0); transition-delay: 350ms; } }
[data-tip]:focus-visible::before { opacity: 1; transform: translate(-50%, 0); }
/* chú giải nằm DƯỚI phần tử (khung có overflow ẩn phía trên); phần tử cuối hàng neo phải để không tràn mép thẻ */
[data-tip-end]::before { left: auto; right: 0; transform: translate(0, -4px); } [data-tip-end]:hover::before, [data-tip-end]:focus-visible::before { transform: translate(0, 0); }
[data-tip-up]::before { top: auto; bottom: calc(100% + 8px); }
/* chú giải sang trái — cho phần tử ở đầu khung chart: không đè lên dữ liệu bên dưới (FB-014) */
[data-tip-start]::before { top: 50%; left: auto; right: calc(100% + 8px); transform: translate(4px, -50%); } [data-tip-start]:hover::before, [data-tip-start]:focus-visible::before, [data-tip-start].hint::before { transform: translate(0, -50%); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .jr-skin, .itg, [data-tip]::before { transition: none; } .jr > button:active .jr-skin, .itg:active { transform: none; } }
