/* Design tokens và component dùng chung cho design-system.html và app-ui.html (Light + Dark). */

/* ---------- Light (mặc định) ---------- */
:root,
[data-theme="light"] {
  /* Nền be ấm */
  --bg: #F3EFEA;
  --bg-top: #E8DDD1;
  --surface: #FFFFFF;
  --surface-2: #F8F5F1;
  --surface-3: #EEE8E0;
  --line: #E9E2D9;
  --line-2: #DCCFBF;
  --ink: #1C1A18;
  --ink-2: #6B655E;
  --ink-3: #A39C93;

  /* Than đen cho khối nổi bật và thanh điều hướng */
  --charcoal: #1F1E1C;
  --hero-bg: linear-gradient(160deg, #3A3733 0%, #1D1C1A 100%);
  --hero-deco: rgba(255, 255, 255, .10);
  --nav-bg: #1F1E1C;

  /* Đỏ san hô cho hành động chính và nút trợ lý */
  --primary: #D93D42;
  --on-primary: #FFFFFF;
  --accent-ink: #C8353A;
  --accent-soft: #FBE4E3;

  /* Be nhấn: badge trạng thái, nền gợi ý, tab đang chọn */
  --primary-soft: #F3E7D8;
  --primary-strong: #87592F;

  --voice-bg: #F3EFEA;
  --bubble-user: #EDE4D8;
  --bubble-agent: #FFFFFF;

  --spend: #B8452F; --spend-bg: #FBE6DF;
  --save: #2F7D4A; --save-bg: #E3F2E7;
  --warn: #87592F; --warn-bg: #F3E7D8;
  --info: #3E6488; --info-bg: #E3ECF5;
  --rose: #A93D52; --rose-bg: #F8E4E8;
  --plum: #6B4F92; --plum-bg: #EEE8F6;
  --coffee: #7B5B3D; --coffee-bg: #F3ECE3;
  --family: #7A5A44; --family-bg: #F2EAE2;
  --shop: #2E7C80; --shop-bg: #E0F1F1;
  --house: #56636F; --house-bg: #E9ECF0;
  --edu: #4A5BA8; --edu-bg: #E6E9F7;
  --danger-fill: #1F1E1C;

  /* Biểu đồ */
  --ch-food: #D2694B; --ch-market: #6E9A7A; --ch-bill: #D0A048; --ch-move: #6D8DB3; --ch-other: #C9B7A2;
  --ch-ink: #1B1510;
  --bar: #E9E0D4; --bar-active: #1F1E1C;
  --heat-0: #F4EFE8; --heat-1: #EADFD0; --heat-2: #D9C5AB; --heat-3: #B99A77; --heat-4: #5C4632; --heat-4-ink: #FFFFFF;

  --shadow-1: 0 1px 2px rgba(60, 45, 30, .04), 0 6px 20px rgba(60, 45, 30, .06);
  --shadow-2: 0 16px 40px rgba(30, 25, 20, .22);
  --orb-hi: #F58A84; --orb-mid: #E04B4F; --orb-lo: #C3343A;
  --orb-glow: rgba(217, 61, 66, .32);
  color-scheme: light;
}

/* ---------- Dark ---------- */
[data-theme="dark"] {
  --bg: #131211;
  --bg-top: #221E1A;
  --surface: #1D1B19;
  --surface-2: #252220;
  --surface-3: #2F2B27;
  --line: #33302C;
  --line-2: #433D37;
  --ink: #F4F0EB;
  --ink-2: #AFA79D;
  --ink-3: #7D766D;

  --charcoal: #2A2724;
  --hero-bg: linear-gradient(160deg, #403B35 0%, #26231F 100%);
  --hero-deco: rgba(255, 255, 255, .08);
  --nav-bg: #2A2724;

  --primary: #D93D42;
  --on-primary: #FFFFFF;
  --accent-ink: #FF8E8A;
  --accent-soft: #3B1F1F;

  --primary-soft: #3A2F25;
  --primary-strong: #E3C39F;

  --voice-bg: #131211;
  --bubble-user: #2F2B27;
  --bubble-agent: #1D1B19;

  --spend: #F2A08A; --spend-bg: #3A211B;
  --save: #8ED3A3; --save-bg: #1B3123;
  --warn: #E3C39F; --warn-bg: #3A2F25;
  --info: #9FC0E3; --info-bg: #1C2A39;
  --rose: #F09CB0; --rose-bg: #3B1F27;
  --plum: #C7B2EA; --plum-bg: #2C2439;
  --coffee: #DCC2A6; --coffee-bg: #342A20;
  --family: #D9BBA1; --family-bg: #352A21;
  --shop: #86D0D2; --shop-bg: #183032;
  --house: #B7C1CC; --house-bg: #262B31;
  --edu: #AEB9EE; --edu-bg: #1F2440;
  --danger-fill: #3A3631;

  --ch-food: #E07D5F; --ch-market: #7EAE8B; --ch-bill: #DDB15A; --ch-move: #7F9FC6; --ch-other: #C9B7A2;
  --ch-ink: #1B1510;
  --bar: #34302B; --bar-active: #F4F0EB;
  --heat-0: #252220; --heat-1: #3A322A; --heat-2: #5A4A3A; --heat-3: #8C7258; --heat-4: #E3C39F; --heat-4-ink: #1B1510;

  --shadow-1: 0 0 0 1px #2C2925;
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .55), 0 0 0 1px #3A3631;
  --orb-hi: #F58A84; --orb-mid: #E04B4F; --orb-lo: #B92F35;
  --orb-glow: rgba(229, 72, 77, .3);
  color-scheme: dark;
}

/* Khối than đen: đảo token chữ/nền bên trong để nội dung luôn sáng rõ */
.hero {
  background: var(--hero-bg);
  --ink: #FFFFFF;
  --ink-2: #C9C2B8;
  --surface: rgba(255, 255, 255, .10);
  --line: rgba(255, 255, 255, .12);
  --primary-soft: rgba(255, 255, 255, .10);
  --primary-strong: #FFFFFF;
  --save: #9BE0B0;
  --save-bg: rgba(155, 224, 176, .16);
  --shadow-1: none;
  --bar: rgba(255, 255, 255, .14);
  --bar-active: #E9DCCB;
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(30, 25, 20, .25);
}

/* ---------- Nền tảng ---------- */
.theme-root { background: var(--bg); color: var(--ink); font-family: 'Be Vietnam Pro', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.theme-root button, .theme-root input { font-family: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }

/* Icon */
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ic-xs { width: 16px; height: 16px; } .ic-sm { width: 18px; height: 18px; } .ic-lg { width: 28px; height: 28px; }

/* Typography: nét vừa, gọn như ảnh tham chiếu */
.t-display { font-size: 42px; font-weight: 700; letter-spacing: -1.4px; line-height: 1; }
.t-h1 { font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.15; margin: 0; }
.t-h2 { font-size: 19px; font-weight: 600; letter-spacing: -.3px; line-height: 1.25; margin: 0; }
.t-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.t-body { font-size: 15px; font-weight: 500; line-height: 1.5; }
.t-label { font-size: 13px; font-weight: 500; line-height: 1.35; }
.t-cap { font-size: 12px; font-weight: 500; line-height: 1.3; }

/* Card & list */
.card { background: var(--surface); border-radius: 22px; padding: 16px; box-shadow: var(--shadow-1); }
.list { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-1); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 66px; text-decoration: none; color: inherit; }
.li + .li { border-top: 1px solid var(--line); }
.li .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.amt { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec-h a { font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }

/* Buttons */
.btn { height: 50px; border-radius: 25px; padding: 0 22px; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 18px var(--orb-glow); }
.btn-dark { background: var(--charcoal); color: #FFFFFF; }
.btn-tonal { background: var(--primary-soft); color: var(--primary-strong); }
.btn-outline { background: var(--surface); border: 1px solid var(--line-2); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--accent-ink); }
.btn-danger { background: var(--accent-soft); color: var(--accent-ink); }
.btn-sm { height: 40px; border-radius: 20px; padding: 0 16px; font-size: 14px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; border: 0; color: var(--ink); box-shadow: var(--shadow-1); position: relative; cursor: pointer; text-decoration: none; flex-shrink: 0; }
.icon-btn .dot { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); }

/* Chip, badge, segmented, toggle, field */
.chip { height: 34px; padding: 0 14px; border-radius: 17px; background: transparent; border: 1px solid var(--line-2); font-size: 13px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.chip.on { background: var(--surface); border-color: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.badge { height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.b-spend { background: var(--spend-bg); color: var(--spend); } .b-save { background: var(--save-bg); color: var(--save); }
.b-warn { background: var(--warn-bg); color: var(--warn); } .b-info { background: var(--info-bg); color: var(--info); }
.b-neutral { background: var(--surface-3); color: var(--ink); } .b-primary { background: var(--bar-active); color: var(--surface); }
.b-accent { background: var(--accent-soft); color: var(--accent-ink); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface-3); border-radius: 22px; padding: 4px; gap: 4px; }
.seg button { height: 38px; border: 0; background: transparent; border-radius: 19px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.seg a { height: 38px; border-radius: 19px; font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; display: grid; place-items: center; }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.toggle { width: 50px; height: 30px; border-radius: 15px; background: var(--primary); position: relative; flex-shrink: 0; border: 0; cursor: pointer; }
.toggle::after { content: ''; position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.toggle.off { background: var(--surface-3); } .toggle.off::after { right: auto; left: 4px; }
.field { height: 50px; border-radius: 25px; background: var(--surface); border: 0; box-shadow: var(--shadow-1); display: flex; align-items: center; gap: 10px; padding: 0 6px 0 16px; color: var(--ink-2); }
.field input { flex: 1; border: 0; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink); outline: none; min-width: 0; }
.field input::placeholder { color: var(--ink-2); }
.field .mic { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; border: 0; }

/* Category tiles: nền sáng trung tính, icon mang màu danh mục */
.cat { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.cat-sm { width: 38px; height: 38px; border-radius: 12px; }
.cat-lg { width: 56px; height: 56px; border-radius: 18px; }
.c-food { background: var(--spend-bg); color: var(--spend); } .c-market { background: var(--save-bg); color: var(--save); }
.c-bill { background: var(--warn-bg); color: var(--warn); } .c-move { background: var(--info-bg); color: var(--info); }
.c-health { background: var(--rose-bg); color: var(--rose); } .c-fun { background: var(--plum-bg); color: var(--plum); }
.c-coffee { background: var(--coffee-bg); color: var(--coffee); } .c-family { background: var(--family-bg); color: var(--family); }
.c-primary { background: var(--primary-soft); color: var(--primary-strong); }
.c-rose { background: var(--shop-bg); color: var(--shop); } .c-house { background: var(--house-bg); color: var(--house); }
.c-edu { background: var(--edu-bg); color: var(--edu); }

/* Voice orb: đỏ san hô như nút "+" của ảnh tham chiếu */
.orb { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #FFFFFF; text-decoration: none; flex-shrink: 0;
  background: radial-gradient(circle at 34% 28%, var(--orb-hi) 0%, var(--orb-mid) 55%, var(--orb-lo) 100%);
  box-shadow: 0 10px 24px var(--orb-glow), inset 0 -4px 10px rgba(0, 0, 0, .15), inset 0 2px 5px rgba(255, 255, 255, .35); }
.orb.flat { box-shadow: none; }
.wave { display: flex; align-items: center; gap: 5px; }
.wave i { display: block; width: 6px; border-radius: 3px; background: currentColor; }

/* Bottom navigation: viên thuốc than đen, cả 5 tab đều có icon + nhãn, nút trợ lý nhô lên ở giữa */
.nav { position: sticky; bottom: 16px; margin: 8px 16px 16px; height: 74px; background: var(--nav-bg); border-radius: 30px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; padding: 0 4px; box-shadow: var(--shadow-2); z-index: 5; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 62px; color: #B3ACA2; font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav a .pill { width: 46px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .2s; }
.nav a.on { color: #FFFFFF; font-weight: 600; }
.nav a.on .pill { background: rgba(255, 255, 255, .16); }
.nav a.voice { color: #FFFFFF; font-weight: 600; margin-top: -30px; height: auto; }
.nav a.voice .orb { width: 62px; height: 62px; border: 4px solid var(--nav-bg); }

/* Thương hiệu */
.logo { display: inline-grid; place-items: center; border-radius: 30%; background: var(--primary); color: #FFFFFF; flex-shrink: 0; }
.avatar { border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; color: #5A3E26; background: linear-gradient(140deg, #F6E7D3 0%, #E3C7A3 100%); box-shadow: 0 0 0 2px var(--surface); }

/* Bars */
.bars { display: grid; gap: 8px; align-items: end; }
.bars > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bars .bar { width: 100%; border-radius: 10px 10px 4px 4px; background: var(--bar); }
.bars .bar.on { background: var(--bar-active); }
/* Biểu đồ có đường trung bình: nhãn số nổi trên đường kẻ */
.bars.avg > div > span { position: relative; z-index: 1; padding: 0 4px; border-radius: 6px; }
.bars.avg > div > span.t-cap { background: var(--surface); }

/* ---------- Agent overlay: trợ lý hiện trên mọi màn hình mà không che nội dung ---------- */
:root, [data-theme="light"] { --island-bg: rgba(24, 22, 20, .94); --island-line: rgba(255, 255, 255, .06); --scrim: rgba(20, 18, 16, .38); }
[data-theme="dark"] { --island-bg: rgba(48, 44, 40, .96); --island-line: rgba(255, 255, 255, .10); --scrim: rgba(0, 0, 0, .55); }

@keyframes xu-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes xu-bar { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes xu-blink { 50% { opacity: 0; } }
@keyframes xu-spin { to { transform: rotate(360deg); } }
@keyframes xu-ring { 0% { box-shadow: 0 0 0 0 rgba(217, 61, 66, .45); } 100% { box-shadow: 0 0 0 14px rgba(217, 61, 66, 0); } }

/* Hạt trợ lý: quả cầu thu nhỏ, đổi hình theo trạng thái */
.blob { position: relative; width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #FFFFFF;
  background: radial-gradient(circle at 34% 28%, var(--orb-hi) 0%, var(--orb-mid) 55%, var(--orb-lo) 100%); }
.blob.live { animation: xu-breathe 2.4s ease-in-out infinite, xu-ring 1.6s ease-out infinite; }
.blob.think::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--orb-hi); border-right-color: var(--orb-hi); animation: xu-spin 1s linear infinite; }
.blob.wait { background: #FFFFFF; color: var(--primary); }
.blob.err { background: #5B5650; }
.eq { display: flex; align-items: center; gap: 3px; height: 18px; }
.eq i { width: 3px; height: 100%; border-radius: 2px; background: currentColor; animation: xu-bar 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.25s; } .eq i:nth-child(3) { animation-delay: -.5s; } .eq i:nth-child(4) { animation-delay: -.75s; } .eq i:nth-child(5) { animation-delay: -.1s; }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 1px; vertical-align: -3px; background: var(--primary); animation: xu-blink 1s steps(1) infinite; }

/* Đảo trợ lý (agent island) */
.island { position: absolute; left: 14px; right: 14px; bottom: 102px; z-index: 6; min-height: 60px; padding: 10px; border-radius: 30px; background: var(--island-bg); color: #FFFFFF;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .3), inset 0 0 0 1px var(--island-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.island.inline { position: relative; left: auto; right: auto; bottom: auto; }
.island .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.island .k { font-size: 12px; font-weight: 600; color: #F7A29D; display: flex; align-items: center; gap: 6px; }
.island .v { font-size: 14px; font-weight: 500; color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island .ib { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .12); display: grid; place-items: center; color: #FFFFFF; border: 0; flex-shrink: 0; cursor: pointer; text-decoration: none; }
.island .qb { height: 36px; padding: 0 14px; border-radius: 18px; border: 0; background: rgba(255, 255, 255, .14); color: #FFFFFF; font: 600 13px 'Be Vietnam Pro', sans-serif; cursor: pointer; }
.island .qb.yes { background: var(--primary); }
.island .prog { position: absolute; left: 62px; right: 62px; bottom: 6px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.island .prog i { display: block; height: 100%; border-radius: 2px; background: var(--orb-hi); }

/* Phụ đề: chỉ hiện câu trả lời của trợ lý, thời gian hiển thị theo độ dài câu */
.caption { position: absolute; z-index: 6; bottom: 176px; max-width: 300px; padding: 12px 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); font-size: 16px; font-weight: 500; line-height: 1.45; display: flex; flex-direction: column; gap: 6px; }
.caption.agent { left: 18px; border-radius: 20px 20px 20px 6px; }
.caption .who { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.caption .timer { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.caption .timer i { display: block; height: 100%; background: var(--ink-3); }

/* Thông báo kết quả, kèm Hoàn tác */
.toast { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 7; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-2); }
.toast.inline { position: relative; top: auto; left: auto; right: auto; }

/* Phần tử trợ lý đang thao tác */
.agent-focus { position: relative; outline: 2px solid var(--primary); outline-offset: 3px; box-shadow: 0 0 0 9px rgba(217, 61, 66, .10); }
.agent-tag { position: absolute; top: -15px; right: 12px; z-index: 2; height: 26px; padding: 0 10px 0 4px; border-radius: 13px; background: var(--primary); color: #FFFFFF; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; box-shadow: 0 6px 14px var(--orb-glow); }
.agent-tag .lg { width: 18px; height: 18px; border-radius: 50%; background: rgba(255, 255, 255, .22); display: grid; place-items: center; }

/* Bảng chi tiết trợ lý */
.scrim { position: absolute; inset: 0; z-index: 6; background: var(--scrim); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; background: var(--bg); border-radius: 32px 32px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .22); display: flex; flex-direction: column; overflow: hidden; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 10px auto 2px; }
.tl { position: relative; display: flex; flex-direction: column; gap: 14px; }
.tl::before { content: ''; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-row { position: relative; display: flex; gap: 12px; align-items: flex-start; }
.tl-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 0 0 4px var(--bg); }
.tl-said { font-size: 13px; font-weight: 500; color: var(--ink-2); padding-top: 9px; }
.tl-said b { color: var(--ink); font-weight: 600; }

.nav a.voice.live .orb { animation: xu-ring 1.6s ease-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .blob.live, .blob.think::after, .eq i, .caret, .nav a.voice.live .orb { animation: none; }
}

/* Xếp hạng danh mục: thanh ngang, mở rộng tốt khi có nhiều danh mục */
.rank { display: flex; flex-direction: column; gap: 14px; }
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rank-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rank-bar { display: flex; align-items: center; gap: 8px; }
.rank-bar .track { flex: 1; height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.rank-bar .track i { display: block; height: 100%; border-radius: 5px; }
.rank-bar .pct { width: 34px; text-align: right; font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.tab-panel[hidden] { display: none; }

/* Bản hội thoại trong bảng chi tiết: có cả phụ đề người dùng (dạng thu nhỏ chỉ hiện phụ đề của trợ lý) */
.tr { display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.tr-user { align-self: flex-end; max-width: 82%; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tr-user .bubble { background: var(--bubble-user); color: var(--ink); border-radius: 20px 20px 6px 20px; padding: 10px 14px; font-size: 15px; font-weight: 500; line-height: 1.45; }
.tr-user.live .bubble { background: transparent; border: 1.5px dashed var(--line-2); }
.tr-time { font-size: 12px; font-weight: 500; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.tr-agent { display: flex; gap: 10px; align-items: flex-start; max-width: 94%; }
.tr-agent .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tr-agent .say { font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--ink); }
.interim { color: var(--ink-3); }
