/* ==========================================================================
   Aristock – giao diện (sáng / tối)
   Hệ thiết kế: một họ chữ (Inter, số canh cột), nền trung tính lạnh, mực xanh đậm làm màu thương hiệu,
   viền mảnh thay cho bóng đổ đậm. Màu tăng / giảm / trần / sàn chọn sắc tươi (11/2026): nền sáng ≥ 3.4:1 trên nền thẻ
   (giảm, trần ≥ 4.3:1), tham chiếu (vàng) ~2.8:1 để giữ sắc vàng; nền tối ≥ 6:1.
   ========================================================================== */
:root {
  color-scheme: light;
  /* bề mặt */
  --bg: #f4f6f9;            /* nền trang */
  --card: #ffffff;          /* thẻ */
  --card-2: #f8f9fb;        /* nền phụ trong thẻ: đầu bảng, ô ghi chú */
  --track: #eef1f5;         /* rãnh nút chọn, thanh tiến độ, nền rê chuột */
  --seg-on: #ffffff;        /* nút đang chọn trong rãnh */
  --border: #e3e7ee;
  --border-strong: #cfd6e0;
  --grid-line: #eef1f5;
  /* chữ */
  --text: #0f1b2d;
  --text-2: #3b4859;
  --muted: #667085;
  /* thương hiệu */
  --navy: #14532d;          /* màu chủ đạo đậm (nút chính, mục đang chọn): xanh lá rừng */
  --navy-dark: #0f3f22;
  --accent: #15803d;        /* xanh lá: chữ/link trên nền trắng 5.0:1 */
  --accent-soft: #e7f6ec;
  --gold: #b0863a;          /* vàng đồng Aristock: chỉ cho hình; chữ vàng trên nền sáng dùng #7b5e29 */
  /* giá: tăng / giảm / tham chiếu / trần / sàn. Tăng/giảm là màu chữ, bản đậm để chữ số nhỏ đạt 4.5:1 trên nền trắng
     (bộ nhận diện Aristock); bản tươi cho hình ở --up-fill / --down-fill */
  --up: #0a7d45;
  --down: #c2261f;
  --flat: #cf8b00;
  --ceil: #9b3ff5;
  --floor: #0796b8;
  --up-bg: #e2f7eb;
  --down-bg: #fde9e8;
  --flat-bg: #fff3d6;
  /* màu tô cho đồ hoạ (thanh, chấm, đường/cột biểu đồ, nến): không phải chữ nên được tươi hơn màu chữ ở nền sáng */
  --up-fill: #12b76a;
  --down-fill: #f04438;
  --flat-fill: #f5b301;
  --chart-main: #16a34a;    /* màu chủ đạo của biểu đồ một chuỗi (Vĩ mô) */
  /* hình khối */
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 1px 3px rgba(15, 27, 45, .03);
  --shadow-md: 0 6px 16px -6px rgba(15, 27, 45, .12), 0 2px 4px -2px rgba(15, 27, 45, .05);
  --shadow-lg: 0 20px 44px -12px rgba(15, 27, 45, .24), 0 4px 10px -4px rgba(15, 27, 45, .08);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 60px;
  --grid-gap: 16px;
  --page-max: 1880px; /* bề rộng tối đa chung: nội dung, menu, chân trang (màn 1920 gần như tràn) */
  --page-max-read: 1360px; /* trang chủ yếu là chữ / biểu mẫu: dòng chữ không quá dài */
  --gutter: 24px;
  --font: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Montserrat, Inter, "Segoe UI", sans-serif;   /* tiêu đề lớn theo bộ nhận diện Aristock */
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b111c;
  --card: #121a28;
  --card-2: #172031;
  --track: #1b2537;
  --seg-on: #2b3852;
  --border: #243047;
  --border-strong: #34425d;
  --grid-line: #1b2537;
  --text: #e6eaf0;
  --text-2: #b6c0cf;
  --muted: #8b98ad;
  --navy: #1d6b43;
  --navy-dark: #185a38;
  --accent: #4fd88a;
  --accent-soft: #123222;
  --gold: #d2ae63;
  --up: #35d283;
  --down: #ff6461;
  --flat: #f5c445;
  --ceil: #cd8cff;
  --floor: #38dcf0;
  --up-bg: #0f2e20;
  --down-bg: #35171a;
  --flat-bg: #2f2610;
  --up-fill: #35d283;
  --down-fill: #ff6461;
  --flat-fill: #f5c445;
  --chart-main: #3ccf7c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, .75), 0 4px 10px -4px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; scrollbar-width: thin; }
html, body { margin: 0; padding: 0; }
html { scrollbar-color: var(--border-strong) transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1, .band h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.container { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--gutter); }
.container:is(.news-page, .about, .tg-page) { max-width: var(--page-max-read); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.c-up { color: var(--up) !important; }
.c-down { color: var(--down) !important; }
.c-flat { color: var(--flat) !important; }
.c-ceil { color: var(--ceil) !important; }
.c-floor { color: var(--floor) !important; }
.c-muted { color: var(--muted) !important; }
.c-accent { color: var(--accent) !important; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wrap { flex-wrap: wrap; }

/* ---------- Thanh điều hướng ---------- */
.topnav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border); }
.topnav-inner { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--gutter); height: var(--nav-h); display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; flex: none; }
/* logo Aristock (svg nội dòng, chữ đã chuyển thành nét): chữ A + chữ ARISTOCK màu xanh rừng, cây nến vàng đồng;
   nền tối: kem + vàng sáng. File gốc: branding/aristock */
.brand-logo { display: block; height: 34px; width: auto; }
.brand-logo .lg-ink { fill: #14532d; }
.brand-logo .lg-gold { fill: #b0863a; }
:root[data-theme="dark"] .brand-logo .lg-ink { fill: #f7f3e8; }
:root[data-theme="dark"] .brand-logo .lg-gold { fill: #d2ae63; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); position: relative; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--track); color: var(--text); }
.nav-burger { display: none; }
.menu { display: flex; align-items: center; gap: 2px; margin-left: 14px; flex: 1; }
.menu-item { position: relative; }
.menu-link { display: inline-flex; align-items: center; gap: 4px; padding: 7px 11px; border-radius: 8px; font-weight: 600; font-size: 15.5px; color: var(--text-2); background: transparent; border: 0; white-space: nowrap; transition: background-color .15s, color .15s; }
.menu-link:hover { color: var(--text); background: var(--track); }
.menu-link.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.caret { font-size: 11px; color: var(--muted); }
.submenu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 320px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.submenu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; } /* cầu nối rê chuột qua khe hở */
.menu-item.open > .submenu, .menu-item:hover > .submenu { display: block; }
.submenu-link { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; transition: background-color .12s; }
.submenu-link:hover { background: var(--track); }
.submenu-link b { display: block; font-size: 14px; font-weight: 600; }
.submenu-link small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.submenu-ico { flex: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; font-size: 15px; color: var(--navy); }
:root[data-theme="dark"] .submenu-ico { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.bell-badge { position: absolute; top: 3px; right: 3px; background: var(--down); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 15px; box-shadow: 0 0 0 2px var(--card); }
.ql-badge { display: inline-block; margin-left: 4px; background: var(--down); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 15px; vertical-align: 1px; }
.ql-badge.hidden { display: none; }
.al-live-grp { margin-top: 14px; }
/* thanh trạng thái dữ liệu (app.js FB.statusBar), dòng nhỏ dưới chữ ARISTOCK của logo: chấm luồng realtime, ngày dữ liệu,
   trong/ngoài phiên, nhãn dữ liệu cũ. Lề trái = chỗ bắt đầu chữ trong logo (130/100 chiều cao logo) */
.brand-wrap { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; flex: none; }
.nav-status { display: flex; align-items: center; gap: 5px; margin: 2px 0 0 44px; font-size: 11.5px; line-height: 13px; color: var(--muted); white-space: nowrap; cursor: default; }
.ns-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; opacity: .6; }
.ns-dot.ns-ok { background: var(--up); opacity: 1; box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--up) 20%, transparent); }
.ns-dot.ns-bad { background: var(--down); opacity: 1; box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--down) 22%, transparent); }
.ns-date { font-weight: 600; color: var(--text-2); }
.ns-sess::before { content: "·"; margin-right: 5px; }
.ns-stale { background: var(--down); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .2px; border-radius: 4px; padding: 0 4px; }

/* nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 7px 14px; font-weight: 600; font-size: 14px; line-height: 1.35; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(12, 34, 68, .22), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-primary:hover { background: var(--navy-dark); }
.btn-text { background: transparent; color: var(--text); }
.btn-text:hover { color: var(--accent); }
.btn-outline { background: var(--card); border-color: var(--border); color: var(--text); box-shadow: 0 1px 1px rgba(15, 27, 45, .03); }
.btn-outline:hover { border-color: var(--border-strong); color: var(--accent); background: var(--card-2); }
.btn-google { background: var(--card); border-color: var(--border); color: var(--text); font-weight: 500; box-shadow: var(--shadow); }
.btn-google:hover { border-color: var(--border-strong); }
.btn-wide { width: 100%; padding: 11px 16px; font-size: 14.5px; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn-danger { background: var(--down); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--down) 88%, #000); }

/* tìm kiếm */
.search-overlay { position: fixed; inset: 0; background: rgba(8, 15, 28, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 88px; }
.search-box { width: min(640px, 92vw); background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.search-box input { width: 100%; border: 0; outline: 0; padding: 18px 20px; font-size: 17px; background: var(--card); border-bottom: 1px solid var(--border); }
.search-results { max-height: min(460px, 60vh); overflow-y: auto; overflow-x: hidden; padding: 4px 0; }
.search-item { display: flex; gap: 12px; align-items: center; padding: 10px 20px; cursor: pointer; }
.search-item:hover, .search-item.active { background: var(--track); }
.search-item .sym { font-weight: 700; width: 70px; color: var(--navy); }
:root[data-theme="dark"] .search-item .sym { color: #86efac; }
.search-item .ex { margin-left: auto; color: var(--muted); font-size: 12px; }
.search-empty { padding: 14px 20px; color: var(--muted); }
.search-item.feat { padding-top: 8px; padding-bottom: 8px; }
.search-item .f-ico { width: 22px; flex: none; text-align: center; font-size: 17px; }
.search-item .f-txt { display: flex; flex-direction: column; min-width: 0; }
.search-item .f-txt b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .f-txt small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .ex { flex: none; }

/* ---------- Khung trang ---------- */
.page { min-height: calc(100vh - var(--nav-h)); padding: 20px 0 40px; }
/* trang con dùng cả .container lẫn .page (Quỹ, Quant, Điểm mua…): giữ lề hai bên như mọi trang, không nhân đôi khoảng trên */
.page .container.page { min-height: 0; padding-top: 0; padding-left: var(--gutter); padding-right: var(--gutter); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: var(--grid-gap); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 50px; padding: 12px 18px; border-bottom: 1px solid var(--grid-line); }
.card-head h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.card-head.center-title { justify-content: center; position: relative; }
.card-head .head-right { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 8px 12px; }
.card-foot { padding: 8px 18px 14px; color: var(--muted); font-size: 12.5px; text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--grid-gap); }
.grid-2-1 { display: grid; grid-template-columns: 2.2fr 1fr; gap: var(--grid-gap); }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--grid-gap); }
.grid-2 > .card, .grid-3 > .card, .grid-2-1 > .card { margin-bottom: 0; }
/* ô lưới không bị nội dung (dãy nút, bảng) kéo rộng quá cột: phần tràn cuộn hoặc xuống dòng bên trong thẻ */
.grid-2 > *, .grid-3 > *, .grid-2-1 > *, .grid-1-2 > * { min-width: 0; }
.card-body > .between { flex-wrap: wrap; row-gap: 8px; }
.row-gap { margin-bottom: var(--grid-gap); }

/* segmented control & tabs */
.seg { display: inline-flex; background: var(--track); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; padding: 4px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .15s, background-color .15s, box-shadow .15s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 2px rgba(15, 27, 45, .1), 0 0 0 .5px rgba(15, 27, 45, .06); }
.seg.dark .seg-btn.active { background: var(--navy); color: #fff; }
/* gạch chân tab vẽ bằng bóng trong (không tràn ra ngoài như viền âm) nên dải tab cuộn ngang không hiện thanh cuộn dọc thừa */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tab { border: 0; background: transparent; padding: 11px 12px; font-weight: 500; font-size: 14.5px; color: var(--muted); white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; transition: color .15s, box-shadow .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.pager { display: flex; justify-content: center; gap: 4px; margin-top: 10px; }
.pager button { border: 1px solid var(--border); background: var(--card); min-width: 30px; height: 30px; border-radius: 7px; font-size: 13px; color: var(--muted); transition: border-color .15s, color .15s; }
.pager button:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.pager button.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: default; }

/* badge, pill */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; line-height: 1.35; }
.badge-a { background: color-mix(in srgb, var(--up) 13%, transparent); color: var(--up); }
.badge-b { background: color-mix(in srgb, #ea580c 14%, transparent); color: #c2410c; }
.badge-c { background: var(--track); color: var(--text-2); }
.badge-d { background: color-mix(in srgb, var(--down) 12%, transparent); color: var(--down); }
.badge-na { background: transparent; color: var(--muted); }
:root[data-theme="dark"] .badge-b { color: #fdba74; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.pill-up { background: var(--up); color: #fff; }
.pill-down { background: var(--down); color: #fff; }
.pill-flat { background: var(--flat); color: #fff; }
.pill-prebuy { background: color-mix(in srgb, var(--up) 16%, transparent); color: var(--up); }
.pill-presell { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }
.pill-bottom { background: color-mix(in srgb, var(--ceil) 15%, transparent); color: var(--ceil); }
.pill-na { background: var(--track); color: var(--muted); }
.pill-outline { background: transparent; border: 1px solid currentColor; }

/* skeleton / loading / error */
.skeleton { padding: 8px 0; }
.sk-line { background: linear-gradient(90deg, var(--track) 25%, var(--card-2) 50%, var(--track) 75%); background-size: 400% 100%; border-radius: 6px; margin: 8px 0; animation: sk 1.3s ease-in-out infinite; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.loading { color: var(--muted); padding: 16px; text-align: center; font-size: 13.5px; }
.error-line { color: var(--down); background: var(--down-bg); border: 1px solid color-mix(in srgb, var(--down) 25%, transparent); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; margin: 8px 0; }
.empty { color: var(--muted); text-align: center; padding: 20px; font-size: 13.5px; }

/* toast */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #101a2b; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; max-width: 360px; }
:root[data-theme="dark"] .toast { background: #26324a; border: 1px solid var(--border-strong); }
.toast.show { opacity: 1; transform: none; }
.toast.success { background: var(--up); }
.toast.error { background: var(--down); }
.toast.warn { background: var(--flat); }
/* dải "Aristock đang bảo trì" (FB.showMaintenance) khi Cloudflare Worker báo máy chủ ngừng */
.maint-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 300; background: #7B5E29; color: #fff; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); font-size: 14px; line-height: 1.45; text-align: center; box-shadow: 0 -4px 16px rgba(0, 0, 0, .18); }

/* bảng chung */
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--card); position: sticky; top: 0; }
.tbl td { padding: 8px 8px; border-bottom: 1px solid var(--grid-line); white-space: nowrap; }
.tbl tr:hover td { background: var(--card-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th.sorted { color: var(--text); }
.tbl th.sorted::after { content: " ▲"; font-size: 10px; color: var(--accent); }
.tbl th.sorted.desc::after { content: " ▼"; }
.tbl tr.hl td { background: #fdf6d8; }
:root[data-theme="dark"] .tbl tr.hl td { background: #33290f; }
.sym-link { font-weight: 700; color: var(--text); }
.sym-link:hover { color: var(--accent); }

/* ---------- Trang chủ ---------- */
.cta-wrap { max-width: 680px; margin: 0 auto 22px; text-align: center; }
/* banner quảng cáo trang chủ (FB.homeBanner): hết bề ngang nội dung, giữ đúng tỉ lệ ảnh; ảnh điện thoại khi màn ≤ 640 px */
.home-banner { display: block; margin: 0 0 var(--grid-gap); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); line-height: 0; }
.home-banner img { display: block; width: 100%; height: auto; }
a.home-banner:hover { border-color: var(--accent); }
a.home-banner:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Quản trị › Banner trang chủ */
.bn-slots { display: grid; gap: 12px; margin: 10px 0 12px; }
.bn-slot { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.bn-prev { margin: 8px 0 4px; border-radius: 6px; overflow: hidden; background: var(--bg); line-height: 0; }
.bn-prev img { display: block; width: 100%; height: auto; max-height: 220px; object-fit: contain; }
.bn-empty { margin: 8px 0; padding: 14px; border: 1px dashed var(--border); border-radius: 6px; text-align: center; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 10px 0; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.index-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.idx-card { display: block; border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s; }
a.idx-card:hover { box-shadow: var(--shadow-md); }
.idx-card.tint-down { background: linear-gradient(180deg, color-mix(in srgb, var(--down) 7%, var(--card)), var(--card) 75%); border-color: color-mix(in srgb, var(--down) 22%, var(--border)); }
.idx-card.tint-up { background: linear-gradient(180deg, color-mix(in srgb, var(--up) 7%, var(--card)), var(--card) 75%); border-color: color-mix(in srgb, var(--up) 22%, var(--border)); }
.idx-card.tint-flat { background: linear-gradient(180deg, color-mix(in srgb, var(--flat) 8%, var(--card)), var(--card) 75%); border-color: color-mix(in srgb, var(--flat) 24%, var(--border)); }
.idx-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; color: var(--text-2); }
.idx-top .idx-val { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.idx-mid, .idx-bot { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; }
.idx-mid .idx-date { color: var(--muted); }
.idx-bot { color: var(--muted); }
.guide h2 { font-size: 22px; letter-spacing: -.02em; margin: 24px 0 14px; }
.guide-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.guide-tile { display: flex; gap: 16px; align-items: center; padding: 16px 18px; transition: box-shadow .15s, border-color .15s; }
.guide-tile:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.guide-tile .gi { flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.guide-tile b { display: block; font-size: 16px; font-weight: 600; }
.guide-tile small { color: var(--muted); }
.band { position: relative; overflow: hidden; color: #fff; background: radial-gradient(520px 220px at 50% -40%, rgba(201, 169, 97, .22), transparent 65%), linear-gradient(135deg, #072a19 0%, #14532d 60%, #1c6b3f 100%); border-radius: 16px; padding: 40px 16px; text-align: center; margin: 32px 0 10px; box-shadow: var(--shadow-md); }
.band h2 { font-size: 24px; letter-spacing: -.02em; margin-bottom: 18px; }
.band .btn-primary { background: #fff; color: #14532d; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .45); }
.band .btn-primary:hover { background: #f1f4f9; }

/* ---------- Thị trường ---------- */
.chart-card { min-height: 460px; display: flex; flex-direction: column; }
.chart-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; border-bottom: 1px solid var(--grid-line); font-size: 13px; }
.chart-toolbar select { border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px; background: var(--card); font-weight: 600; }
.chart-toolbar select:hover { border-color: var(--border-strong); }
.chart-area { flex: 1; min-height: 360px; position: relative; }
.chart-footer { display: flex; align-items: center; gap: 4px; padding: 7px 12px; border-top: 1px solid var(--grid-line); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.range-btn { border: 0; background: transparent; padding: 3px 8px; border-radius: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; transition: background-color .15s, color .15s; }
.range-btn:hover { background: var(--track); color: var(--text); }
.range-btn.active { background: var(--accent-soft); color: var(--accent); }
.chart-legend { font-size: 12.5px; color: var(--muted); padding: 6px 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.side-col { display: flex; flex-direction: column; gap: 16px; }
.side-col .card { margin-bottom: 0; flex: 1; }
.stat-rows { margin-top: 8px; }
.stat-row { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--grid-line); font-size: 13.5px; }
.stat-row b { font-weight: 600; }
.index-trend-card { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; margin-bottom: 0; }
.index-trend-card .it-name { font-weight: 600; font-size: 15px; }
.index-trend-card .it-alloc { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.index-trend-card .it-val { font-weight: 700; font-size: 18px; letter-spacing: -.01em; text-align: right; }
.index-trend-card .it-chg { font-size: 13px; text-align: right; }

.mirror { display: flex; flex-direction: column; gap: 4px; --m-max: 200px; --m-fix: 122px; }
.mirror-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; font-size: 12.5px; }
.m-side { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.m-side.left { justify-content: flex-end; }
.m-side.right { justify-content: flex-start; }
/* độ dài thanh: --w (0–100) do charts.js đặt, tính theo phần còn trống của mỗi bên (trừ ô số + mã = --m-fix),
   dài nhất --m-max, nên thẻ rộng thì thanh dài, thẻ hẹp / điện thoại tự co lại */
.m-bar { height: 14px; border-radius: 4px; min-width: 2px; width: calc(min(100% - var(--m-fix), var(--m-max)) * var(--w, 0) / 100); flex: none; }
.m-side.left .m-bar { background: var(--up-fill); }
.m-side.right .m-bar { background: var(--down-fill); }
.m-sym { font-weight: 700; width: 54px; color: var(--text); }
.m-side.left .m-sym { text-align: right; }
.m-val { color: var(--text-2); font-weight: 600; width: 56px; }
.m-side.left .m-val { text-align: right; }
.legend { display: flex; gap: 16px; justify-content: center; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.caption { text-align: center; color: var(--accent); font-size: 13px; margin-top: 6px; }
.canvas-wrap { position: relative; width: 100%; }
.canvas-wrap canvas { width: 100% !important; }

.treemap { position: relative; width: 100%; height: 440px; border-radius: 10px; overflow: hidden; background: var(--card); }
.tm-tile { position: absolute; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; border: 1px solid var(--card); cursor: pointer; transition: filter .1s; }
.tm-tile:hover { filter: brightness(1.12); z-index: 2; }
.tm-tile b { font-size: 13px; font-weight: 600; display: block; }
.tm-tile small { font-size: 11.5px; display: block; opacity: .95; }
.tm-tile.sm b { font-size: 11px; } .tm-tile.sm small { font-size: 10px; }
.tm-tile.xs span { display: none; }
/* bản đồ nhiệt: sắc độ đậm dần theo mức biến động (l2, l3); chữ trắng đọc rõ ở mọi mức */
.tm-up { background: #1c9a5c; } .tm-down { background: #d9463b; } .tm-flat { background: #b8860b; }
.tm-up.l2 { background: #11804a; } .tm-down.l2 { background: #b8322a; }
.tm-up.l3 { background: #0a6239; } .tm-down.l3 { background: #8e231d; }
.tm-tip { position: absolute; z-index: 5; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px; font-size: 12.5px; box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap; }
.tm-crumb { font-size: 13px; color: var(--muted); padding: 4px 0 8px; display: flex; gap: 6px; align-items: center; }
.tm-crumb a { color: var(--accent); cursor: pointer; }

/* ---------- Top cổ phiếu ---------- */
.top-tabs { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 10px; margin-bottom: 14px; display: flex; align-items: center; }
.top-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; flex-wrap: wrap; }
.top-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-opt { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.top-opt .input { width: 72px; padding: 4px 8px; text-align: right; }
.date-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 11px; background: var(--card); color: var(--text); font-size: 13px; font-weight: 600; box-shadow: 0 1px 1px rgba(15, 27, 45, .03); }
.toplist-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 8px 16px; background: var(--card-2); border-bottom: 1px solid var(--border); }
.toprow { display: block; padding: 9px 16px; border-bottom: 1px solid var(--grid-line); transition: background-color .12s; }
.toprow:hover { background: var(--card-2); }
.toprow-l1, .toprow-l2 { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.toprow-l1 .sym { font-weight: 700; font-size: 14.5px; }
.toprow-l1 .fs { font-style: italic; color: var(--muted); font-size: 13px; margin-left: 2px; }
.toprow-l1 .price { font-weight: 700; font-size: 14px; }
.toprow-l2 { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.toprow .lft { display: flex; align-items: center; gap: 6px; }
.toprow .hl { background: color-mix(in srgb, var(--flat) 18%, transparent); color: var(--text); padding: 0 4px; border-radius: 4px; }
/* bảng Top chia 2 cột (trang chủ › Top cổ phiếu): 1–10 | 11–20, có số thứ tự; điện thoại xếp 1 cột */
.top-cols { display: grid; grid-template-columns: 1fr 1fr; }
.top-cols > div { min-width: 0; }
.top-cols > div + div { border-left: 1px solid var(--border); }
.toprow .rk { min-width: 18px; color: var(--muted); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.toprow.ranked .toprow-l2 { padding-left: 24px; }
.hm-top-meta { display: flex; align-items: center; gap: 12px; }
@media (max-width: 768px) {
  .top-cols { grid-template-columns: 1fr; }
  .top-cols > div + div { border-left: 0; }
  .top-cols > div + div .toplist-head { display: none; }
}

/* ---------- Tín hiệu ---------- */
.end-label { position: absolute; font-size: 12px; font-weight: 700; color: #fff; padding: 2px 6px; border-radius: 4px; }
.disclaimer { text-align: center; color: var(--muted); font-size: 12px; font-style: italic; margin: 6px 0 12px; }

/* ---------- Tin tức ---------- */
.news-list { display: flex; flex-direction: column; }
.news-item { padding: 14px 0; border-bottom: 1px solid var(--grid-line); }
.news-item a.title { font-weight: 600; font-size: 15px; line-height: 1.45; display: block; }
.news-item a.title:hover { color: var(--accent); }
.news-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.news-item .abstract { color: var(--muted); font-size: 13px; margin-top: 4px; }
.search-row { display: flex; gap: 8px; }
/* ô nhập: viền mảnh, rê chuột đậm hơn, đang gõ có vòng sáng màu nhấn */
.input { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 11px; background: var(--card); width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }

/* ---------- Bộ lọc ---------- */
.screener { display: grid; grid-template-columns: 290px 1fr; gap: 16px; align-items: start; }
.filter-panel .card-body { display: flex; flex-direction: column; gap: 10px; }
.f-group label { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-bottom: 5px; }
.f-range { display: flex; gap: 6px; }
.f-range .input { padding: 5px 8px; font-size: 13px; }
.chk-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.chk-row label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.select { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 9px; background: var(--card); width: 100%; transition: border-color .15s, box-shadow .15s; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.preset { background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; transition: background-color .15s; }
.preset:hover { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }

/* ---------- Danh mục / cảnh báo ---------- */
.wl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.stat-tile { padding: 14px 16px; }
.stat-tile .v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.stat-tile .l { font-size: 12.5px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 8px; align-items: end; }
.form-row label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.alert-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--grid-line); gap: 10px; }
.alert-item.fired { background: var(--flat-bg); padding-left: 8px; border-radius: 6px; }

/* ---------- Phái sinh ---------- */
.deriv-head { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }

/* ---------- Biểu đồ toàn màn hình ---------- */
.container.chart-page { max-width: none; }
.chart-page .chart-card { height: calc(100vh - var(--nav-h) - 48px); height: calc(100dvh - var(--nav-h) - 48px); min-height: 460px; margin-bottom: 8px; }
.chart-page .chart-area { min-height: 0; }

/* ---------- Chi tiết mã ---------- */
.stock-page { padding: 0 var(--gutter); max-width: var(--page-max); margin: 0 auto; }
.stock-header { display: flex; justify-content: space-between; align-items: center; background: radial-gradient(420px 140px at 92% -30%, rgba(201, 169, 97, .2), transparent 65%), linear-gradient(120deg, #051c12 0%, #0f3f26 60%, #17583a 100%); color: #fff; border-radius: var(--radius); padding: 11px 18px; margin-bottom: 14px; box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255, 255, 255, .06); }
.stock-header .ss { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.stock-header .sn { font-size: 13px; color: rgba(255, 255, 255, .72); }
.stock-header .hdr-right { display: flex; gap: 6px; align-items: center; }
.stock-header .date-chip { color: var(--text); }
.stock-header .icon-btn { color: #fff; }
.stock-header .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.stock-split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.stock-split > * { min-width: 0; } /* bảng rộng (BCTC) cuộn trong khung thay vì kéo giãn cột lưới */
.stock-chart { min-height: 640px; display: flex; flex-direction: column; margin-bottom: 0; }
.stock-chart .chart-area { min-height: 520px; }
.stock-panel { margin-bottom: 0; max-height: calc(100vh - var(--nav-h) - 90px); display: flex; flex-direction: column; min-height: 640px; }
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px; gap: 8px; }
.sp-id { display: flex; gap: 10px; align-items: center; }
.sp-logo { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); object-fit: contain; }
.sp-logo-ph { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.sp-sym { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.sp-name { color: var(--muted); font-size: 12px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-price { text-align: right; }
.sp-price .big { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.sp-price .vol { font-size: 12.5px; color: var(--muted); }
.sp-tabs { display: flex; flex-shrink: 0; min-height: 38px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.sp-tabs .tab { padding: 9px 10px; font-size: 14px; white-space: nowrap; }
.sp-body { overflow: auto; flex: 1; padding: 14px 16px; }
.kv-title { font-weight: 600; font-size: 14px; margin: 4px 0 6px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--grid-line); font-size: 13.5px; }
.kv span:first-child { color: var(--muted); }
.kv b { font-weight: 600; }
.note-box { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin: 12px 0; }
.note-box .lbl { color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.sub-card { border: 1px solid var(--border); border-radius: 10px; margin-top: 14px; overflow: hidden; }
.sub-card .sc-title { text-align: center; font-weight: 600; font-size: 14px; padding: 9px 10px; background: var(--card-2); border-bottom: 1px solid var(--grid-line); }
.sub-card .sc-body { padding: 12px; }
.profile-text { font-size: 13px; line-height: 1.6; }
.profile-text.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.link-btn { background: none; border: 0; color: var(--accent); font-size: 13px; padding: 0; }
.fin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fin-table th { color: var(--muted); font-weight: 600; padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--border); }
.fin-table th:first-child { text-align: left; }
.fin-table td { padding: 5px 4px; text-align: right; border-bottom: 1px solid var(--grid-line); vertical-align: top; }
.fin-table td:first-child { text-align: left; color: var(--accent); font-weight: 600; }
.fin-table .yoy { display: block; font-size: 11.5px; }
.fin-table tr.total td { font-weight: 700; background: var(--card-2); }
.peer-sum { display: flex; justify-content: space-between; align-items: center; padding: 8px; background: var(--card-2); border-radius: 6px; margin: 8px 0; font-size: 13px; }
.peer-sum b { font-size: 14px; }

/* ---------- Về Aristock ---------- */
.about h1 { font-size: 26px; margin-bottom: 10px; color: var(--navy); }
:root[data-theme="dark"] .about h1 { color: var(--text); }
.about .about-lead { font-size: 16px; font-weight: 500; color: var(--text); }
.about p { font-size: 14.5px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q { width: 100%; text-align: left; background: none; border: 0; padding: 12px 0; font-weight: 600; font-size: 14.5px; display: flex; justify-content: space-between; }
.faq-a { display: none; padding: 0 0 12px; color: var(--muted); font-size: 14px; }
.faq-item.open .faq-a { display: block; }
.src-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.src-list .card { margin: 0; padding: 12px; }

/* ---------- Đáp ứng ---------- */
/* thanh điều hướng: gọn lại trên laptop, dưới 1080px chuyển sang menu ☰ */
@media (max-width: 1599px) {
  .menu { margin-left: 4px; }
  .menu-link { padding: 8px 7px; }
  .nav-right .btn-text { display: none; }
}
@media (min-width: 1081px) and (max-width: 1599px) {
  /* các mục này cũng có trong "Công cụ ▾": ẩn khỏi thanh ngang để menu vừa một hàng tới 1081px; menu ☰ (≤1080px) vẫn hiện đủ */
  .menu > a.menu-link:is([data-nav="company"], [data-nav="reports"], [data-nav="telegram"]) { display: none; }
}
@media (min-width: 1081px) {
  /* app.js FB.fitMenu: menu ngang vẫn thiếu chỗ thì ẩn thêm các mục trùng với "Công cụ ▾" / menu tài khoản */
  .menu > a.menu-link.menu-spare { display: none; }
}
@media (max-width: 1259px) {
  :root { --gutter: 16px; }
}
@media (max-width: 1080px) {
  .nav-burger { display: inline-flex; }
  .menu { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; max-height: calc(100vh - var(--nav-h)); max-height: calc(100dvh - var(--nav-h)); overflow-y: auto; background: var(--card); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 12px 12px; margin: 0; box-shadow: var(--shadow-lg); }
  .menu.open { display: flex; }
  .menu-link { width: 100%; justify-content: space-between; padding: 10px 12px; font-size: 15.5px; }
  .submenu { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; min-width: 0; }
  .menu-item:hover > .submenu { display: none; }
  .menu-item.open > .submenu { display: block; }
}
@media (max-width: 1024px) {
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .stock-split { grid-template-columns: 1fr; }
  .stock-panel { max-height: none; }
  .screener { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .deriv-head { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .index-cards, .guide-tiles { grid-template-columns: 1fr; }
  .wl-stats { grid-template-columns: 1fr 1fr; }
  .src-list { grid-template-columns: 1fr; }
  .treemap { height: 360px; }
  .kv-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .band h2 { font-size: 21px; }
}
@media (max-width: 480px) {
  :root { --gutter: 12px; }
  .topnav-inner { gap: 6px; }
  .brand-logo { height: 28px; }
  .nav-status { margin-left: 36px; }
  .nav-status.is-stale .ns-sess { display: none; }   /* điện thoại: nhãn DỮ LIỆU CŨ chiếm chỗ, phiên xem ở chú thích */
  .nav-right .btn-primary { display: none; }
}

/* ---------------- Biểu đồ phân tích kỹ thuật (tachart.js) ---------------- */
.chart-body { display: flex; flex: 1; min-height: 0; }
.draw-tools { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; border-right: 1px solid var(--border); width: 38px; align-items: center; flex-shrink: 0; }
.dt-btn { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.dt-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dt-btn:hover { background: var(--bg); color: var(--text); }
.dt-btn.active { background: var(--accent); color: #fff; }
.dt-sep { height: 1px; width: 22px; background: var(--border); margin: 4px 0; }
.tb-btn { border: 1px solid var(--border); background: var(--card); border-radius: 6px; padding: 4px 9px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap; }
.tb-btn i { font-style: italic; font-family: Georgia, serif; }
.tb-btn:hover { border-color: var(--accent); color: var(--accent); }
.ft-btn { border: 0; background: transparent; color: var(--muted); font-size: 12.5px; padding: 2px 7px; border-radius: 4px; cursor: pointer; }
.ft-btn:hover { color: var(--text); }
.ft-btn.active { background: var(--accent); color: #fff; }
.chart-area { min-width: 0; }
.ma-quick { display: inline-flex; gap: 8px; align-items: center; }
.ta-root .ta-legends { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.ta-legend { position: absolute; left: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; max-width: calc(100% - 90px); }
.ta-legend .ohlc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* dòng chỉ báo nhận chuột (lớp chú giải thì không) để rê vào và bấm được các nút */
.ind-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; width: max-content; max-width: 100%; pointer-events: auto; padding: 0 2px 0 4px; margin-left: -4px; border-radius: 4px; }
.ind-row:hover { background: color-mix(in srgb, var(--card) 88%, transparent); box-shadow: 0 0 0 1px var(--border); }
.ind-row.off .ind-name, .ind-row.off .iv { opacity: .45; }
.ind-name { color: var(--text); font-weight: 600; }
.ind-name small { color: var(--muted); font-weight: 400; }
.ind-btns { display: inline-flex; gap: 1px; opacity: .6; transition: opacity .12s; }
.ind-row:hover .ind-btns, .ind-btns:focus-within { opacity: 1; }
.ind-btns button { border: 0; background: transparent; color: var(--muted); border-radius: 4px; width: 20px; height: 18px; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.ind-btns svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ind-btns button:hover { background: var(--bg); color: var(--accent); }
.ind-btns button.del:hover { color: var(--down); }
.ta-draw { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: visible; }
.ta-draw.active { pointer-events: auto; }
.ta-draw .drw .hit { stroke: transparent; stroke-width: 10; pointer-events: stroke; cursor: pointer; }
.ta-draw .drw .hit-fill { pointer-events: all; cursor: move; }
.ta-draw .drw .handle { pointer-events: all; cursor: grab; }
.ta-draw .drw.sel line:not(.hit) { stroke-width: 2.2; }
.ta-draw text { font-family: Inter, sans-serif; pointer-events: none; user-select: none; }
.ta-tip { position: absolute; z-index: 6; pointer-events: none; font-size: 12px; background: #111827; color: #fff; padding: 4px 6px; border-radius: 4px; }
.ta-modal-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ta-modal { background: var(--card); color: var(--text); border-radius: 10px; width: 100%; max-width: 420px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.ta-modal-ind { max-width: 600px; }
.ta-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 15px; }
.ta-modal-body { padding: 12px 14px; overflow: auto; }
.ta-search { width: 100%; margin-bottom: 8px; }
.ta-group { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 10px 0 4px; }
.ta-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.ta-item:hover { background: var(--bg); }
.ta-item span { flex: 1; }
.ta-item small { color: var(--muted); }
.ta-form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--grid-line); }
.ta-form input[type=number], .ta-form input[type=text], .ta-form select { width: 160px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; background: var(--card); color: var(--text); font-size: 13.5px; }
.ta-form input[type=color] { width: 44px; height: 26px; border: 1px solid var(--border); border-radius: 4px; padding: 1px; background: var(--card); }
.ta-form-title { font-weight: 700; margin-top: 10px; font-size: 13px; }
.ta-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
/* hộp chọn chỉ báo: nhóm bên trái, danh sách bên phải; tìm không dấu */
.ta-modal-ind { max-width: 780px; height: min(82vh, 700px); }
.ta-modal-ind .ta-modal-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.ta-ind { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.ta-ind .ta-search { margin: 0; }
.ta-ind-main { display: grid; grid-template-columns: 178px minmax(0, 1fr); gap: 10px; flex: 1; min-height: 0; }
.ta-cats { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; border-right: 1px solid var(--border); padding-right: 8px; }
.ta-cat { display: flex; justify-content: space-between; align-items: center; gap: 6px; text-align: left; border: 0; background: transparent; color: var(--text); padding: 6px 8px; border-radius: 6px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.ta-cat small { color: var(--muted); font-size: 12px; }
.ta-cat:hover { background: var(--bg); }
.ta-cat.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ta-ind-list { overflow-y: auto; min-height: 0; }
.ta-ind-list .ta-group:first-child { margin-top: 0; }
.ta-group small { font-weight: 400; }
.ta-item .ta-item-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ta-item-name b { font-weight: 600; }
.ta-item-name small { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-item .ta-tag, .ta-item .ta-on, .ta-item .ind-btns { flex: none; }
.ta-tag { font-size: 11.5px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.ta-tag.ov { color: var(--accent); border-color: var(--accent); }
.ta-on { color: var(--up); font-weight: 700; font-size: 13px; white-space: nowrap; }
.ta-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ta-item.on-row { cursor: default; }
.ta-item.on-row .ind-btns { opacity: 1; }
.ta-item.off .ta-item-name { opacity: .5; }
.ta-ind-foot { padding: 10px 8px 4px; text-align: right; }
/* hộp cài đặt chỉ báo */
.ta-en { margin-bottom: 4px; }
.ta-form input[type=date] { width: 160px; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; background: var(--card); color: var(--text); font-size: 13.5px; }
.ta-form input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.ta-style-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--grid-line); font-size: 13.5px; }
.ta-form .ta-style-row label.ta-chk { display: inline-flex; justify-content: flex-start; gap: 8px; padding: 0; border: 0; min-width: 0; }
.ta-style-ctl { display: inline-flex; gap: 6px; align-items: center; flex: none; }
.ta-form .ta-style-ctl select { width: 72px; }
/* bảng nhỏ góc phải (Hiệu suất) và nhãn chỉ báo trên lớp SVG */
.ta-table { position: absolute; z-index: 6; pointer-events: none; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12px; line-height: 1.45; }
.ta-table-h { font-weight: 700; color: var(--text); }
.ta-table td { padding: 0 4px; color: var(--muted); white-space: nowrap; }
.ta-table td.num { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.ta-table td.pos { color: var(--up); }
.ta-table td.neg { color: var(--down); }
.ta-draw .ind-lbl { paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; font-weight: 600; }
@media (max-width: 640px) {
  .ta-modal-wrap { padding: 8px; }
  .ta-modal-ind { height: 92vh; max-height: 92vh; }
  .ta-ind-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
  .ta-cats { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 6px; scrollbar-width: thin; }
  .ta-cat { flex: none; padding: 5px 9px; border: 1px solid var(--border); border-radius: 14px; }
  .ta-item { padding: 8px 4px; gap: 6px; }
  .ta-item .ta-tag { display: none; }
  .ta-form input[type=number], .ta-form input[type=text], .ta-form input[type=date], .ta-form select { width: 130px; }
  .ta-table { font-size: 11.5px; }
}
@media (max-width: 768px) {
  .chart-body { flex-direction: column; }
  .draw-tools { flex-direction: row; width: auto; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 4px 6px; }
  .dt-sep { width: 1px; height: 22px; margin: 0 4px; }
  .ma-quick { display: none; }
}

/* ---------------- Tab BCTC ---------------- */
.bctc-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bctc-bar .row { display: inline-flex; gap: 6px; align-items: center; }
.sel-sm { border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; background: var(--card); color: var(--text); font-size: 13px; }
.btn-outline[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
/* bảng BCTC: chữ 13px, số canh phải dạng bảng, mỗi kỳ một dòng, kẻ ngang mảnh (separate để viền đầu bảng dính theo khi cuộn) */
.bctc-wrap { max-height: 72vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.fin-table.bctc-table { font-size: 14px; border-collapse: separate; border-spacing: 0; }
.bctc-table th, .bctc-table td { padding: 8px 14px; border-bottom: 1px solid var(--grid-line); vertical-align: middle; }
.bctc-table th { position: sticky; top: 0; z-index: 2; background: var(--card-2); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; border-bottom-color: var(--border); }
.bctc-table th:last-child { color: var(--text); }
.bctc-table td { min-width: 104px; white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums lining-nums; }
.bctc-table th:first-child, .fin-table.bctc-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 300px; max-width: 380px; white-space: normal; text-align: left; color: var(--text); font-weight: 400; line-height: 1.35; background: var(--card); border-right: 1px solid var(--grid-line); }
.bctc-table th:first-child { z-index: 3; background: var(--card-2); color: var(--muted); font-weight: 600; }
.bctc-table tbody tr:last-child td { border-bottom: 0; }
.fin-table.bctc-table tr.hd td { font-weight: 700; background: var(--card-2); }
.bctc-table tr.hd .nm { text-transform: uppercase; font-size: 13px; letter-spacing: .3px; }
.fin-table.bctc-table tr.key td { font-weight: 600; }
.fin-table.bctc-table tr.sel td { background: var(--flat-bg); }
.fin-early { background: var(--flat-bg); border: 1px solid var(--flat); border-left-width: 3px; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13.5px; overflow-x: auto; }
.fin-early table { border-collapse: collapse; margin-top: 6px; }
.fin-early th, .fin-early td { padding: 2px 14px 2px 0; text-align: right; white-space: nowrap; }
.fin-early th:first-child, .fin-early td:first-child { text-align: left; }
@media (max-width: 600px) { .fin-early { padding: 8px; } .fin-early th, .fin-early td { padding-right: 8px; } }
.fin-table.bctc-table tbody tr:hover td { background: var(--accent-soft); }
/* rê chuột vào một kỳ: cột cùng kỳ tô nhẹ, ô cùng dòng đậm hơn, ô đang trỏ có viền */
.fin-table.bctc-table tbody tr td.cq { background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.bctc-table thead th.cq { background: color-mix(in srgb, var(--accent) 10%, var(--card-2)); color: var(--text); }
.fin-table.bctc-table tbody tr td.cq.cq-hit { background: color-mix(in srgb, var(--accent) 18%, var(--card)); font-weight: 700; }
.fin-table.bctc-table tbody tr td.cq-hit.cq-cur { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
.bctc-table .na { color: var(--muted); }
.bctc-table .yoy { display: block; font-size: 12px; font-weight: 500; line-height: 1.2; margin-top: 2px; }
.bctc-table .unit { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.bctc-table .tg { display: inline-block; width: 16px; cursor: pointer; color: var(--muted); font-size: 12px; }
.bctc-table .tg:hover { color: var(--accent); }
.bctc-table .tg-sp { display: inline-block; width: 16px; }
.bctc-table .nm { cursor: pointer; }
.bctc-table .nm:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
@media (min-width: 769px) { /* khung bên phải trang chi tiết mã hẹp: thu cột tên để thấy thêm kỳ */
  .sp-body .bctc-table th:first-child, .sp-body .fin-table.bctc-table td:first-child { min-width: 210px; max-width: 240px; }
}
@media (max-width: 768px) {
  .fin-table.bctc-table { font-size: 13.5px; }
  .bctc-table th, .bctc-table td { padding: 7px 10px; }
  .bctc-table td { min-width: 88px; }
  .bctc-table th:first-child, .fin-table.bctc-table td:first-child { min-width: 168px; max-width: 200px; }
}

/* ---------------- Chân trang ---------------- */
.footer { background: var(--card); border-top: 1px solid var(--border); margin-top: 32px; font-size: 14px; }
.footer-inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding: 40px var(--gutter) 24px; }
.footer-brand .brand { display: flex; align-items: center; }
.footer-brand .brand-logo { height: 40px; }
.footer .social { display: flex; gap: 8px; margin: 14px 0; }
.footer .social a { width: 30px; height: 30px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 13px; transition: border-color .15s, color .15s; }
.footer .social a:hover { border-color: var(--border-strong); color: var(--accent); }
.footer-note { color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 420px; }
.footer-col h4 { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
.footer-col a { display: block; color: var(--muted); padding: 4px 0; transition: color .15s; }
.footer-col a:hover { color: var(--text); }
.footer-copy { text-align: center; color: var(--muted); font-size: 12.5px; padding: 14px 16px; border-top: 1px solid var(--grid-line); }
@media (max-width: 768px) { .footer-inner { grid-template-columns: 1fr 1fr; } }

.chip { display: inline-block; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 13px; color: var(--text); transition: border-color .15s, color .15s, background-color .15s; }
.chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.wrap { flex-wrap: wrap; }

.row { display: flex; align-items: center; gap: 8px; }

/* ---------------- Trang Tin tức ---------------- */
.news-page { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.news-side { position: sticky; top: calc(var(--nav-h) + 12px); }
.news-tabs { padding: 0 8px; overflow-x: auto; white-space: nowrap; }
.news-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.news-card { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grid-line); }
.news-card.hot .title { color: var(--text); }
.news-thumb { flex: 0 0 120px; }
.news-thumb img { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; display: block; }
.news-body { flex: 1; min-width: 0; }
.news-body .title { font-weight: 600; font-size: 14.5px; display: block; line-height: 1.4; }
.news-body .title:hover { color: var(--accent); }
.news-sum { color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.45; }
.hot-badge { margin-right: 4px; }
.src-badge { background: var(--bg); border-radius: 4px; padding: 1px 6px; font-weight: 600; color: var(--text); }
.chip-xs { padding: 1px 7px; font-size: 12px; }
@media (max-width: 1024px) { .news-page { grid-template-columns: 1fr; } .news-side { position: static; } .news-thumb { flex-basis: 90px; } .news-thumb img { width: 90px; height: 64px; } }

/* ---------------- Thông báo Telegram ---------------- */
.tg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 8px; }
.tg-col h4 { margin: 0 0 8px; font-size: 14px; }
.tg-ok { background: var(--flat-bg); border-radius: 6px; padding: 8px 10px; font-size: 13.5px; }
.tg-warn { background: var(--flat-bg); border-left: 3px solid var(--warn, #e6a700); border-radius: 6px; padding: 8px 10px; font-size: 13.5px; }
.tg-page code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.tg-acct { margin-top: 14px; }
.tg-steps { margin: 6px 0 6px 20px; padding: 0; }
.tg-steps li { margin: 3px 0; }
@media (max-width: 900px) { .tg-grid { grid-template-columns: 1fr; } }
/* tùy chọn nhận tin của từng chat (auth.js FB.tgOpts) */
.alert-item:has(.tg-opts) { flex-wrap: wrap; }
.tg-opts { flex-basis: 100%; width: 100%; border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 8px; }
.tg-opts-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.tg-opt { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-size: 14px; cursor: pointer; }
.tg-opt > span { flex: 1; min-width: 0; }
.tg-opt input { margin-top: 3px; }
.tg-opt b { display: block; font-size: 14px; }
.tg-opt small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.tg-opt.tg-sub { margin-left: 24px; font-size: 13.5px; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.tg-opt.tg-sub > span { flex: 0 0 auto; }
.tg-opt.tg-sub label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.tg-opt.tg-sub input { margin-top: 0; }
.tg-opt.off { opacity: .5; }
.tg-preview { margin: 6px 0 0 24px; max-width: 560px; }
.tg-bubble { background: var(--flat-bg); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.55; margin-top: 6px; overflow-wrap: anywhere; }
.tg-bubble a { color: var(--accent); }
@media (max-width: 600px) { .tg-opt.tg-sub, .tg-preview { margin-left: 8px; } }

/* ---------------- Báo cáo doanh nghiệp ---------------- */
.corp-top { padding: 12px 16px; margin-bottom: 12px; }
.corp-rank { font-size: 13px; }
.grade { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text); }
.grade b { display: inline-block; width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 3px; color: #fff; font-size: 11.5px; }
.grade.g-a b { background: #16a34a; } .grade.g-b b { background: #65a30d; } .grade.g-c b { background: #ca8a04; } .grade.g-d b { background: #ea580c; } .grade.g-e b { background: #dc2626; }
.corp-overview { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
.corp-overview > .card { padding: 10px 14px; }
.corp-ranges { display: flex; justify-content: center; gap: 4px; background: var(--navy); border-radius: 4px; padding: 4px 8px; margin-bottom: 6px; }
.corp-ranges button { border: 0; background: transparent; color: #cbd5e1; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; cursor: pointer; }
.corp-ranges button.active { background: #fff; color: var(--navy); }
.corp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.corp-stats .kv .k { color: var(--muted); }
.corp-stats .kv .v { text-align: right; font-weight: 600; }
.range52 { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.range52 .bar { position: relative; width: 70px; height: 14px; background: var(--navy); border-radius: 2px; }
.range52 .bar i { position: absolute; top: 0; bottom: 0; width: 2px; background: #fbbf24; transform: translateX(-1px); }
.corp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 12px 14px 4px; }
.corp-panel { border: 1px solid var(--border); border-radius: 10px; padding: 12px 12px 6px; background: var(--card); }
.corp-panel-title { font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); margin-bottom: 6px; }
@media (max-width: 1280px) { .corp-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .corp-overview { grid-template-columns: 1fr; } .corp-stats { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .corp-grid { grid-template-columns: 1fr; } }
@media print { .navbar, .menu, .footer, .corp-top .row, #cp-recent { display: none !important; } .corp-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------------- Vĩ mô ---------------- */
.macro-page { display: grid; grid-template-columns: 256px 1fr; gap: 16px; align-items: start; }
.macro-nav { padding: 10px; position: sticky; top: calc(var(--nav-h) + 12px); }
/* Vĩ mô: khung biểu đồ tách 2 phần liền nhau: phần trên (tiêu đề + biểu đồ) dính trên đầu khi cuộn, chiều cao không đổi
   nên trang không giật; phần dưới (bảng giá trị theo kỳ, nguồn) trượt vào dưới. .mc-stuck chỉ đổi bóng/viền/góc, không đổi bố cục */
.mc-chart-top { margin-bottom: 0; border-bottom-color: transparent; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.mc-chart-top > .card-body { padding-bottom: 6px; }
.mc-chart-foot { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.mc-chart-foot > .card-body { padding-top: 0; }
.mc-chart-foot #mc-period-row { margin-top: 4px; }
.mc-chart-foot #mc-period-row:empty { display: none; }
.mc-chart-foot #mc-period-row:empty + #mc-src { margin-top: 2px; }
@media (min-width: 901px) {
  .mc-chart-top { position: sticky; top: calc(var(--nav-h) + 12px); z-index: 6; box-shadow: none; transition: box-shadow .2s ease, border-color .2s ease, border-radius .2s ease; }
  .mc-chart-top.mc-stuck { border-bottom-color: var(--border); border-radius: var(--radius); box-shadow: 0 8px 20px -8px rgba(16, 24, 40, .22); }
  :root[data-theme="dark"] .mc-chart-top.mc-stuck { box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .6); }
}
#mc-stick-sentinel { height: 1px; margin-bottom: -1px; }
/* bảng chỉ tiêu Vĩ mô: dòng tiêu đề dính ngay dưới biểu đồ, hàng tên cột (bản sao .mc-blk-head) dính dưới nó; bảng thật cuộn
   ngang trong .mc-blk-body, hàng tên cột thật bị khuất bằng margin âm. --mc-chart-h, --mc-tblhead-h do macro.js đo */
.macro-page { --mc-stick-top: calc(var(--nav-h) + 12px + var(--mc-chart-h, 0px)); }
.mc-tbl-card > .card-head { position: sticky; top: var(--mc-stick-top); z-index: 5; background: var(--card); border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
#mc-table.macro-table-wrap { overflow: visible; }
#mc-table .mc-blk-head { position: sticky; top: calc(var(--mc-stick-top) + var(--mc-tblhead-h, 0px)); z-index: 4; overflow: hidden; background: var(--card); }
#mc-table .mc-blk-head > table { table-layout: fixed; margin: 0; }
#mc-table .mc-blk-head th { box-sizing: border-box; }
#mc-table .mc-blk-body { overflow-x: auto; }
#mc-table .mc-blk-body > table > thead th { position: static; }
@media (max-width: 900px) { .macro-page { --mc-stick-top: var(--nav-h); } }
.macro-econ { display: flex; flex-direction: column; gap: 3px; border-bottom: 1px solid var(--grid-line); padding-bottom: 10px; margin-bottom: 10px; }
/* nút vùng (Tổng quan / Việt Nam / Thế giới): biểu tượng ô vuông cố định bên trái, chữ đi liền sau (không đẩy sang phải) */
.macro-econ-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: 14.5px; font-weight: 700; color: var(--text); cursor: pointer; }
.macro-econ-btn > .mc-flag { flex: none; width: 26px; height: 22px; margin: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; border-radius: 5px; }
.macro-econ-btn:hover, .macro-cat-btn:hover { background: var(--bg); }
.macro-econ-btn.active { background: var(--navy); color: #fff; box-shadow: 0 4px 12px -6px rgba(20, 83, 45, .55); }
.macro-econ-btn.active > .mc-flag { background: rgba(255, 255, 255, .16); color: #fff; }
/* danh sách chuyên mục: mọi dòng cấp 1 cùng cỡ, cùng độ đậm và cùng lề chữ (--mc-ind = lề trái + ô −/+ + khoảng cách của dòng có cây),
   dòng không có cây giữ chỗ ô −/+ bằng chấm nhỏ; số chỉ tiêu (macro.js vẫn in) ẩn đi theo ý người dùng */
.mc-catlist { --mc-ind: 27px; }
.macro-cat-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 8px 7px var(--mc-ind, 27px); border-radius: 6px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.mc-catlist > .macro-cat-btn::before { content: ""; position: absolute; left: 10px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 2px; background: var(--border); }
.mc-catlist > .macro-cat-btn.active::before { background: var(--accent); }
.macro-cat-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.macro-cat-btn > .xs, .mc-t1 .mc-tl > .xs { display: none; }
.macro-cat-title { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 2px 8px 8px 10px; }
/* cây chuyên mục (vd Thị trường tiền tệ › Thị trường mở › Reverse Repo): ô −/+ mở đóng, đường nối từ ô của nút cha tới từng mục */
.mc-tree { margin: 1px 0; }
.mc-tn { display: flex; align-items: center; gap: 4px; padding-left: 6px; border-radius: 6px; }
.mc-tn:hover { background: var(--bg); }
.mc-t1.on, .mc-t1.on:hover { background: var(--accent-soft); }
.mc-tog { flex: none; width: 13px; height: 13px; padding: 0; border: 0; border-radius: 3px; background: #e6e9ef; color: #667085; font: 600 12px/13px system-ui, sans-serif; text-align: center; cursor: pointer; transition: background .12s, color .12s; }
.mc-tog:hover { background: #d5dae3; color: var(--text); }
.mc-t1.on .mc-tog { background: var(--card); color: var(--accent); }
.mc-tl { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: transparent; padding: 7px 8px 7px 4px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.mc-t1.on .mc-tl { color: var(--accent); font-weight: 700; }
.mc-t2 .mc-tl { padding: 6px 8px 6px 4px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.mc-t2.on .mc-tl { color: var(--accent); font-weight: 600; }
.mc-t2.sel { background: var(--bg); }
.mc-kids { list-style: none; margin: 0; padding: 0 0 0 12px; }
.mc-kids li { position: relative; padding-left: 14px; }
.mc-kids li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--border); }
.mc-kids li:last-child::before { bottom: auto; height: 15px; }
.mc-kids li::after { content: ""; position: absolute; left: 0; top: 15px; width: 10px; border-top: 1px solid var(--border); }
.mc-leaf { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.mc-leaf:hover { background: var(--bg); color: var(--text); }
.mc-leaf.active { background: var(--bg); color: var(--text); font-weight: 600; }
:root[data-theme="dark"] .mc-t2.on .mc-tl { color: #bbf7d0; }
:root[data-theme="dark"] .macro-econ-btn.active { box-shadow: none; }
:root[data-theme="dark"] .mc-tog { background: #243047; color: #8b98ad; }
:root[data-theme="dark"] .mc-tog:hover { background: #2f3d58; color: var(--text); }
:root[data-theme="dark"] .mc-t1.on .mc-tog { background: var(--card); color: var(--accent); }
@media (min-width: 901px) { .macro-nav { max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto; scrollbar-width: thin; scrollbar-gutter: stable; } }
#mc-order-reset[hidden] { display: none; } /* .btn đặt display nên thuộc tính hidden không tự ẩn */
/* Vĩ mô › Tổng quan: lưới biểu đồ nhỏ (mặc định 5 chỉ tiêu, người dùng thêm / bỏ / đổi chỗ) */
.macro-main > [hidden], .mcd-pick[hidden] { display: none !important; }
.mcd-grid { display: flex; flex-direction: column; gap: 12px; }
.mcd-row { display: flex; gap: 12px; min-height: 200px; } /* chiều cao hàng do JS chia theo cửa sổ (dashLayout) */
.mcd-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 6px; background: var(--card); min-width: 0; flex: 1 1 0; display: flex; flex-direction: column; }
.mcd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.mcd-title { border: 0; background: transparent; padding: 0; text-align: left; font-weight: 700; font-size: 13px; color: var(--text); cursor: pointer; line-height: 1.35; }
.mcd-title:hover { color: var(--accent); text-decoration: underline; }
.mcd-tools { display: inline-flex; gap: 2px; flex: none; }
.mcd-tools button { border: 0; background: transparent; color: var(--muted); width: 22px; height: 22px; border-radius: 4px; cursor: pointer; font-size: 13px; line-height: 1; }
.mcd-tools button:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.mcd-tools button:disabled { opacity: .3; cursor: default; }
.mcd-val { margin: 2px 0 4px; font-size: 13px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.mcd-val b { font-size: 17px; }
.mcd-per { margin-left: auto; }
.mcd-chart { flex: 1 1 auto; min-height: 120px; }
.mcd-pick { padding: 0 16px 12px; }
.mcd-res { max-height: 320px; overflow: auto; margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.mcd-hit { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 7px 10px; text-align: left; font-size: 12.5px; color: var(--text); cursor: pointer; }
.mcd-hit:last-child { border-bottom: 0; }
.mcd-hit:hover, .mcd-hit:focus-visible { background: var(--bg); }
.mcd-hit .muted { text-align: right; flex: none; max-width: 45%; }
.mcd-more { padding: 6px 10px; }
.macro-table-wrap { overflow-x: auto; }
.macro-tbl tr[data-id] { cursor: pointer; }
.macro-tbl tr.active td { background: var(--flat-bg); }
.macro-tbl tr.muted td { color: var(--muted); }
/* bảng theo cây: dòng tiêu đề nhóm con › mục; nhóm dòng 'rg' (vd NHTM Nhà nước - SOBS) có ô −/+, dòng con thụt vào có đường nối
   (vẽ bằng nền để ô tên của bảng Theo kỳ vẫn dính trái); .mc-stick giữ chữ dòng tiêu đề trong khung khi bảng cuộn ngang */
.mc-stick { position: sticky; left: 8px; display: inline-flex; align-items: center; gap: 8px; }
.macro-tbl tr.macro-subhead > td { background: var(--bg-2, rgba(127,127,127,.08)); font-weight: 700; padding-top: 8px; }
.macro-tbl tr.mc-rg > td { cursor: pointer; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--navy); }
.macro-tbl tr.mc-rg-kid > td:first-child { padding-left: 32px; background-image: linear-gradient(var(--border), var(--border)), linear-gradient(var(--border), var(--border)); background-repeat: no-repeat; background-size: 1px 100%, 12px 1px; background-position: 14px 0, 14px 50%; }
.macro-tbl tr.mc-rg-kid.last > td:first-child { background-size: 1px 50%, 12px 1px; }
:root[data-theme="dark"] .macro-tbl tr.mc-rg > td { color: #86efac; }
/* cây dòng 'up' (vd Tài khóa › Thu ngân sách): thụt lề theo độ sâu, dòng cha có ô −/+; dòng gốc chữ hoa xanh, dòng lá chữ thường */
.mc-tog-sp { flex: none; display: inline-block; width: 13px; }
/* danh mục Vĩ mô: kéo thả đổi thứ tự (tay cầm ⠿ hiện khi rê chuột vào dòng chuyên mục; kéo được ở mọi dòng cùng cấp) */
.macro-cat-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mc-nav-reset { border: 0; background: transparent; padding: 0; font-size: 12px; font-weight: 600; text-transform: none; color: var(--accent); cursor: pointer; }
.mc-nav-reset:hover { text-decoration: underline; }
.mc-catlist > .macro-cat-btn, .mc-t1 { position: relative; }
.mc-ngrip { position: absolute; left: -9px; top: 50%; transform: translateY(-50%); font-size: 11px; line-height: 1; font-weight: 400; color: var(--muted); opacity: 0; transition: opacity .12s; pointer-events: none; }
.macro-cat-btn:hover > .mc-ngrip, .mc-t1:hover .mc-ngrip, .mc-ndrag .mc-ngrip { opacity: .8; }
.mc-ndrag { position: relative; z-index: 5; background: var(--card); border-radius: 6px; box-shadow: 0 6px 18px rgba(16, 24, 40, .18); }
:root[data-theme="dark"] .mc-ndrag { box-shadow: 0 6px 18px rgba(0, 0, 0, .55); }
.mc-up-pad { display: inline-block; }
.macro-tbl tr.mc-up > td:first-child .mc-tog, .macro-tbl tr.mc-up > td:first-child .mc-tog-sp { margin-right: 6px; vertical-align: -1px; }
/* dòng gốc có con (cây Tài khóa) in hoa; dòng cha hàng hoá (có nhãn F/S) hoặc trong nhóm dòng giữ chữ thường */
.macro-tbl tr.mc-up-root.mc-up-has:not(.mc-rg-kid):not(:has(.mc-kind)) > td:first-child b { color: var(--navy); text-transform: uppercase; font-size: 12.5px; letter-spacing: .02em; }
.macro-tbl tr.mc-up:not(.mc-up-has):not(.mc-up-root) > td:first-child b { font-weight: 500; }
:root[data-theme="dark"] .macro-tbl tr.mc-up-root.mc-up-has:not(.mc-rg-kid):not(:has(.mc-kind)) > td:first-child b { color: #86efac; }
.macro-period-wrap { overflow-x: auto; margin-top: 10px; }
.macro-period td.macro-fc { font-style: italic; color: var(--muted); cursor: help; }
.macro-stale { display: inline-block; font-size: 11px; line-height: 1; padding: 2px 4px; border-radius: 4px; background: var(--flat-bg); color: var(--muted); vertical-align: 1px; cursor: help; }
#mc-src .mt4 { margin-top: 4px; }
.macro-period th, .macro-period td { white-space: nowrap; font-size: 13px; }
.macro-period th:first-child, .macro-period td:first-child { position: sticky; left: 0; background: var(--card); text-align: left; min-width: 160px; }
@media (max-width: 900px) { .macro-page { grid-template-columns: 1fr; } .macro-nav { position: static; } .macro-econ { flex-direction: row; flex-wrap: wrap; } }
/* đầu thẻ biểu đồ Vĩ mô: nút (kiểu giá trị, Phiên/Tuần/Tháng, khung, Excel) xuống dòng thay vì ép tiêu đề thành cột hẹp; màn hẹp: tiêu đề
   chiếm cả dòng, dãy nút cuộn ngang */
#mc-chart-card .card-head { flex-wrap: wrap; }
#mc-chart-card .card-head > div:first-child { min-width: 0; flex: 1 1 280px; }
@media (max-width: 900px) { #mc-chart-card .card-head > div:first-child { flex-basis: 100%; } #mc-chart-card .card-head .seg { max-width: 100%; overflow-x: auto; scrollbar-width: thin; } }
.mc-flag { display: inline-block; font-style: normal; font-size: 11px; font-weight: 800; background: var(--bg); color: var(--navy); border-radius: 4px; padding: 1px 5px; margin-right: 4px; }
.macro-econ-btn.active .mc-flag { background: rgba(255,255,255,.2); color: #fff; }
/* Giá hàng hoá: nhãn loại giá F/S và nước sau tên chỉ tiêu (bảng Vĩ mô) */
.macro-tbl .mc-kind { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; line-height: 1; color: var(--muted); border: 1px solid var(--border); border-radius: 3px; padding: 1px 3px; vertical-align: 1px; }
.macro-tbl .mc-cty { margin: 0 0 0 4px; font-size: 10px; padding: 1px 4px; vertical-align: 1px; }

/* ---------------- Quỹ mở ---------------- */
.fund-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
.fund-perf { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.fund-perf > div { display: flex; flex-direction: column; min-width: 54px; }
.fund-perf > div span:last-child { font-weight: 700; }
.hbar { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 8px; font-size: 13px; margin: 3px 0; }
.hbar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .bar { height: 10px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.hbar .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.hbar .val { text-align: right; font-weight: 600; }
.fn-sub td { background: var(--flat-bg); }
@media (max-width: 900px) { .fund-grid { grid-template-columns: 1fr; } }

.tbl.heat td { padding: 4px 6px; font-size: 12.5px; }
.tbl.heat th { font-size: 12px; }

/* ---------------- tài khoản ---------------- */
.hidden { display: none !important; }
.auth-wrap { display: flex; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card.wide { max-width: 640px; }
.auth-head { text-align: center; padding: 22px 16px 6px; }
.auth-head h2 { font-size: 21px; font-weight: 800; margin-top: 8px; }
.auth-head p { margin-top: 6px; }
.auth-field { margin-bottom: 12px; }
.auth-field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.auth-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 6px 0 14px; cursor: pointer; }
.auth-check input { margin-top: 3px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.auth-links a { color: var(--accent); font-weight: 600; }
.auth-guest { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; font-size: 14px; }
.auth-guest a { color: var(--muted); font-weight: 600; }
.auth-guest a:hover { color: var(--accent); }
.auth-hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.btn-block { width: 100%; padding: 10px 14px; font-size: 15px; }
/* nút Google theo hướng dẫn thương hiệu của Google (nền trắng, viền #747775, chữ #1F1F1F, logo G 4 màu) */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #747775; font-weight: 600; text-decoration: none; }
.btn-google:hover { background: #f6f8fc; border-color: #1f1f1f; color: #1f1f1f; text-decoration: none; }
.btn-google svg { flex: none; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-err { background: var(--down-bg); color: var(--down); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; margin-bottom: 12px; }
.g-uris code { display: block; margin: 2px 0; padding: 4px 6px; background: var(--card-2); border-radius: 4px; font-size: 12px; word-break: break-all; user-select: all; }
.btn.busy { opacity: .6; pointer-events: none; }
.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 760px) { .acct-grid { grid-template-columns: 1fr; } }
.nav-user { display: flex; align-items: center; gap: 6px; }
.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 3px 10px 3px 3px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.user-btn:hover { border-color: var(--accent); }
.user-btn .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }
.user-btn .user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .user-btn .user-name { display: none; } }
.user-drop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 70; }
.user-drop.open { display: block; }
.user-drop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-drop-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.user-drop a, .user-drop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font: inherit; font-size: 14px; color: var(--text); background: transparent; border: 0; cursor: pointer; }
.user-drop a:hover, .user-drop button:hover { background: var(--bg); }
.user-drop #user-logout { color: var(--down); font-weight: 600; border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; margin-top: 4px; }

/* ---------------- tài liệu markdown ---------------- */
.md-doc { max-width: 980px; margin: 0 auto; font-size: 14.5px; line-height: 1.6; }
.md-doc h2 { font-size: 21px; font-weight: 800; margin: 4px 0 12px; }
.md-doc h3 { font-size: 17px; font-weight: 800; margin: 26px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.md-doc h4 { font-size: 15px; font-weight: 700; margin: 16px 0 6px; }
.md-doc p { margin: 8px 0; }
.md-doc ul, .md-doc ol { margin: 6px 0 10px 22px; }
.md-doc li { margin: 3px 0; }
.md-doc code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 13px; }
.md-doc pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow: auto; margin: 8px 0; }
.md-doc pre code { border: 0; background: transparent; padding: 0; }
.md-doc hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md-doc .md-tbl { font-size: 13.5px; margin: 8px 0 12px; }
.md-doc .md-tbl th { text-align: left; background: var(--card-2); }
.md-doc .md-tbl td, .md-doc .md-tbl th { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* ---------------- báo cáo phân tích CTCK (tab trên trang cổ phiếu) ---------------- */
.rs-cons { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: var(--card-2); }
.rs-cons-head { font-size: 13.5px; margin-bottom: 6px; }
.rs-cons-main { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 8px; }
.rs-tp { font-size: 21px; font-weight: 800; }
.rs-dist { display: flex; height: 22px; border-radius: 6px; overflow: hidden; font-size: 11.5px; font-weight: 700; margin-bottom: 8px; }
.rs-dist span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; min-width: 0; padding: 0 4px; }
.rs-brokers { gap: 4px; }
.rs-item { padding: 10px 0; border-bottom: 1px solid var(--grid-line, var(--border)); }
.rs-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 3px; }
.rs-date { color: var(--muted); }
.rs-broker { font-weight: 800; color: var(--navy); }
:root[data-theme="dark"] .rs-broker { color: #86efac; }
.rs-title { display: block; font-weight: 600; font-size: 14px; line-height: 1.4; color: var(--text); }
.rs-title:hover { color: var(--accent); }
.rs-meta { font-size: 13px; margin-top: 3px; }
.rs-sum { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.rs-sum.open { -webkit-line-clamp: unset; display: block; }
.rs-links { display: flex; gap: 12px; font-size: 12.5px; margin-top: 4px; }
.rs-links a { color: var(--accent); font-weight: 600; }
.rec-badge { font-size: 11.5px; font-weight: 800; padding: 1px 6px; border-radius: 4px; letter-spacing: .2px; }
.rec-buy { background: #16a34a; color: #fff; }
.rec-add { background: #dcfce7; color: #15803d; }
.rec-hold { background: #fef3c7; color: #a16207; }
.rec-under { background: #ffedd5; color: #c2410c; }
.rec-sell { background: #dc2626; color: #fff; }
.rec-none { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

/* ---------------- trang Báo cáo phân tích (#/research) ---------------- */
.rp-head { padding: 14px 16px; }
.rp-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.rp-filters .input { flex: 1 1 240px; max-width: 360px; }
.rp-filters .select { width: auto; min-width: 150px; max-width: 240px; }
.rp-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.rp-tbl td { vertical-align: top; }
.rp-row { cursor: pointer; }
.rp-row.open td { background: var(--card-2); }
.rp-dayrow td { background: var(--bg); font-weight: 700; font-size: 13px; color: var(--muted); padding: 6px 8px; }
.rp-sym { color: var(--text); font-weight: 800; }
.rp-sym:hover { color: var(--accent); }
.rp-title { max-width: 440px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rp-broker { max-width: 160px; overflow: hidden; text-overflow: ellipsis; color: var(--navy); font-weight: 700; }
:root[data-theme="dark"] .rp-broker { color: #86efac; }
.rp-sub { font-size: 12px; margin-top: 2px; font-weight: 500; }
.rp-pdf { font-size: 17px; text-decoration: none; }
.rp-detail-row td { white-space: normal; background: var(--card-2); padding: 6px 8px 12px; }
.rp-sum { font-size: 13.5px; line-height: 1.55; white-space: pre-line; max-width: 980px; }
.rp-prev { font-size: 13px; margin-top: 6px; }
.rp-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
.rp-day { font-weight: 700; font-size: 13px; color: var(--muted); padding: 10px 12px 4px; background: var(--bg); }
.rp-card { padding: 10px 12px; border-bottom: 1px solid var(--grid-line, var(--border)); cursor: pointer; }
.rp-card.open { background: var(--card-2); }
.rp-card-top { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; flex-wrap: wrap; }
.rp-title-m { font-weight: 600; font-size: 14px; line-height: 1.4; }
.rp-card-meta { font-size: 13px; margin-top: 4px; }
.rp-card .rp-detail { display: none; margin-top: 6px; }
.rp-card.open .rp-detail { display: block; }

/* ---------------- lịch sử tìm kiếm trong hộp tìm mã ---------------- */
.search-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 18px 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.search-clear { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 600; text-transform: none; cursor: pointer; padding: 2px 4px; }
.search-clear:hover { text-decoration: underline; }
.search-x { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 19px; line-height: 1; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.search-x:hover { background: var(--border); color: var(--text); }

/* ---------------- khối thanh khoản giao dịch (trang cổ phiếu) ---------------- */
.liq-card { margin-top: 12px; }
.lq-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.lq-kpi { border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; background: var(--card-2); }
.lq-kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.lq-kpi .v { font-size: 20px; font-weight: 800; margin: 2px 0; }
.lq-kpi .s { font-size: 12.5px; color: var(--muted); }
.lq-bar { height: 5px; border-radius: 3px; background: var(--down-fill); overflow: hidden; margin: 3px 0 4px; }
.lq-bar span { display: block; height: 100%; background: var(--up-fill); }
.lq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 10px; }
.lq-grid-b { grid-template-columns: 1.25fr 1fr; margin-top: 10px; }
.lq-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin: 4px 0 6px; }
.lq-tbl td, .lq-tbl th { white-space: nowrap; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); vertical-align: middle; animation: lq-pulse 1.6s infinite; }
@keyframes lq-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (max-width: 900px) { .lq-kpis { grid-template-columns: 1fr 1fr; } .lq-grid, .lq-grid-b { grid-template-columns: 1fr; } }

/* ---------------- Điểm mua đã kiểm định (#/alpha) ---------------- */
.vd { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.vd-pass { background: var(--up); color: #fff; }
.vd-watch { background: #dbeafe; color: #1e40af; }
.vd-rev { background: #fee2e2; color: #991b1b; }
.vd-avoid { background: var(--down); color: #fff; }
.vd-avoidw { background: #ffedd5; color: #9a3412; }
.vd-fail, .vd-na { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
:root[data-theme="dark"] .vd-watch { background: #1e3a8a; color: #bfdbfe; }
:root[data-theme="dark"] .vd-rev { background: #450a0a; color: #fca5a5; }
:root[data-theme="dark"] .vd-avoidw { background: #431407; color: #fdba74; }
.al-body { padding: 12px 16px 16px; }
.al-intro { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-size: 13.5px; line-height: 1.6; }
.al-h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .3px; margin: 4px 0 8px; color: var(--muted); }
.al-regime { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border-left: 5px solid var(--muted); }
.al-regime.on { border-left-color: var(--up); background: linear-gradient(90deg, var(--up-bg), var(--card) 55%); }
.al-regime.off { border-left-color: var(--down); background: linear-gradient(90deg, var(--down-bg), var(--card) 55%); }
.al-regime-main { flex: 1 1 520px; }
.al-kicker { letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.al-regime-title { font-size: 21px; font-weight: 800; margin: 2px 0 4px; }
.al-regime.on .al-regime-title { color: var(--up); }
.al-regime.off .al-regime-title { color: var(--down); }
.al-regime-kpi { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.al-regime-kpi .kpi { min-width: 150px; }
.al-kpi-v { font-size: 18px; font-weight: 800; }
.al-score { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.al-score .bar { display: inline-block; width: 52px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.al-score .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.al-score .bar i.hi { background: var(--up); }
.al-score .bar i.lo { background: var(--down); }
.al-score b { min-width: 22px; text-align: right; }
.al-sig { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 999px; margin: 1px 3px 1px 0; white-space: nowrap; border: 1px solid var(--border); }
.al-sig small { color: var(--muted); }
.al-chips { white-space: normal; min-width: 150px; max-width: 290px; line-height: 1.9; }
.al-wrap { white-space: normal; min-width: 220px; max-width: 380px; }
.al-sig.up { background: var(--up-bg); color: var(--up); border-color: transparent; }
.al-sig.down { background: var(--down-bg); color: var(--down); border-color: transparent; }
.al-per { display: inline-flex; gap: 2px; }
.al-per i { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 36px; text-align: center; padding: 1px 3px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.al-per i.pos { background: var(--up-bg); color: var(--up); }
.al-per i.neg { background: var(--down-bg); color: var(--down); }
.al-per i.na { color: var(--muted); background: var(--bg); }
.al-detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.al-mini { font-size: 13px; }
.al-mini td, .al-mini th { padding: 4px 8px; }
.al-w { display: grid; grid-template-columns: 190px 1fr 74px; align-items: center; gap: 8px; font-size: 13px; margin: 3px 0; }
.al-w i { display: block; height: 8px; border-radius: 4px; }
.al-w i.pos { background: var(--up); }
.al-w i.neg { background: var(--down); }
.al-w b { text-align: right; font-variant-numeric: tabular-nums; }
.al-big { font-size: 34px; font-weight: 800; line-height: 1.1; }
.al-big small { font-size: 15px; color: var(--muted); font-weight: 600; }
.al-stock { padding: 4px 2px; }
.al-sig-row { padding: 6px 8px; border-radius: 6px; margin-top: 6px; border-left: 3px solid var(--border); background: var(--card-2); }
.al-sig-row.up { border-left-color: var(--up); }
.al-sig-row.down { border-left-color: var(--down); }
.al-note { font-size: 13px; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft); }
.c-accent { color: var(--accent); }
@media (max-width: 900px) {
  .al-detail-grid { grid-template-columns: 1fr; }
  .al-w { grid-template-columns: 130px 1fr 64px; }
  .al-regime-title { font-size: 18px; }
}

/* ---------------- phân tích lệnh (#/orderflow) ---------------- */
.of-page .card-head h3 { margin-bottom: 2px; }
.of-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px 6px; }
.of-toolbar .select { width: auto; min-width: 150px; }
.of-add { display: flex; gap: 6px; align-items: center; }
.of-add .input { width: 110px; text-transform: uppercase; }
.of-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 0 16px 8px; font-size: 12.5px; color: var(--text); }
.of-sw { display: inline-block; width: 14px; height: 11px; border-radius: 2px; vertical-align: -1px; margin-left: 4px; }
.of-wrap { overflow: auto; max-height: calc(100vh - 250px); min-height: 280px; border-top: 1px solid var(--border); }
.of-tbl { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.of-tbl th, .of-tbl td { padding: 3px 7px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid-line, var(--border)); min-width: 54px; }
.of-tbl thead th { position: sticky; z-index: 2; background: var(--navy); color: #fff; font-weight: 700; }
.of-tbl thead tr.of-grp th { top: 0; text-align: center; font-size: 12.5px; border-left: 1px solid rgba(255, 255, 255, .25); }
.of-tbl thead tr.of-syms th { top: var(--of-h1, 0); }
.of-tbl thead tr.of-total th { top: var(--of-h2, 40px); background: var(--card-2); color: var(--text); border-bottom: 2px solid var(--border); }
.of-tbl th.of-corner, .of-tbl th.of-t { position: sticky; left: 0; z-index: 3; text-align: left; min-width: 64px; }
.of-tbl thead th.of-corner { z-index: 4; }
.of-tbl tbody th.of-t { background: var(--card); color: var(--text); font-weight: 600; }
.of-sym { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.of-sym a { color: #fff; }
.of-x { border: 0; background: transparent; color: rgba(255, 255, 255, .55); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.of-x:hover { color: #fff; }
.of-px { font-size: 11px; font-weight: 600; opacity: .95; }
.of-tbl thead .of-px.c-up { color: #86efac !important; }
.of-tbl thead .of-px.c-down { color: #fca5a5 !important; }
.of-tbl thead .of-px.c-flat { color: #fde68a !important; }
.of-tbl .of-tot { font-weight: 800; }
.of-tbl td.of-na { color: var(--muted); }
.of-b1 { background: rgba(22, 163, 74, .28); }
.of-b2 { background: #16a34a; color: #fff; font-weight: 700; }
.of-s1 { background: rgba(220, 38, 38, .25); }
.of-s2 { background: #dc2626; color: #fff; font-weight: 700; }
.of-legend .of-b1, .of-legend .of-b2, .of-legend .of-s1, .of-legend .of-s2 { color: inherit; }
.of-note { padding: 8px 16px 12px; line-height: 1.6; }

/* ---------------- giá realtime (FB.live): ô giá nhấp nháy (Web Animations) khi giá đổi ---------------- */
[data-lq], [data-li] { border-radius: 3px; }
/* ===== funds v2 ===== */
/* Quỹ đầu tư (#/funds, funds.js): nhãn trạng thái / nguồn, điều khiển kỳ, lưới chi tiết; bảng cuộn ngang trong thẻ trên điện thoại */
.fv-page .fund-grid > *, .fv-page .card { min-width: 0; }
.fv-page .card-head { flex-wrap: wrap; }
.fv-page .card-head > h3 { min-width: 0; }
.fv-page .mt4 { margin-top: 4px; }
.fv-page .seg-btn { white-space: nowrap; }
.fv-page .card-head .seg { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.fv-top { padding: 14px 16px; margin-bottom: 12px; }
.fv-nav { display: flex; align-items: center; gap: 8px; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.fv-nav .seg, .fv-nav .btn { flex-shrink: 0; }
.fv-title { font-size: 21px; font-weight: 800; overflow-wrap: anywhere; }
.fv-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; align-items: center; }
.fv-badge { display: inline-block; font-size: 11px; font-weight: 700; line-height: 1.35; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; vertical-align: 1px; cursor: default; }
.fv-badge.ok { background: var(--up-bg); color: var(--up); border-color: transparent; }
.fv-badge.warn { background: var(--flat-bg); color: #b45309; border-color: transparent; }
.fv-badge.bad { background: var(--down-bg); color: var(--down); border-color: transparent; }
.fv-badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
:root[data-theme="dark"] .fv-badge.warn { color: #fbbf24; }
.fv-kpis { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; }
.fv-kpis > div { display: flex; flex-direction: column; min-width: 70px; }
.fv-ctrl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; max-width: 100%; }
.fv-sel { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; background: var(--card); color: var(--text); font-size: 13px; max-width: 100%; }
.fv-cov { padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--grid-line); line-height: 1.6; }
.fv-cov:empty { display: none; }
.fv-note { padding: 8px 14px; line-height: 1.55; }
.fv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fv-clip { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.fv-click tbody tr[data-sym] { cursor: pointer; }
.fv-page .fn-sub td { white-space: normal; }
.fv-subtabs { flex: 1 1 auto; min-width: 0; max-width: 100%; border-bottom: 0; }
.fv-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fv-alloc { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.fv-alloc > div:first-child { flex: 1 1 220px; min-width: 0; }
.fv-alloc > div:last-child { flex: 0 1 200px; min-width: 0; }
.fv-segw { display: block; max-width: 100%; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.fv-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.fv-risk { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.fv-page .hbar { grid-template-columns: minmax(80px, 170px) minmax(40px, 1fr) 64px; }
.fv-page .hbar .lbl a { color: inherit; }
.fv-page .hbar .bar i.pos { background: var(--up); }
.fv-page .hbar .bar i.neg { background: var(--down); }
/* số không còn hiện hành (NAV cũ, hiệu suất tính đến ngày cũ, 'từ lập quỹ' bắt đầu muộn, chênh lệch khi khớp rất ít) */
.fv-muted { opacity: .55; cursor: help; }
.fv-muted .xs { font-size: 11px; white-space: nowrap; }
.fund-perf > .fv-muted { opacity: .5; }
@media (max-width: 900px) { .fv-risk, .fv-2col { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .fv-alloc > div:last-child { flex-basis: 100%; }
  .fv-actions { justify-content: flex-start; }
  .fv-top .fund-perf { width: 100%; }
  .fv-clip { max-width: 150px; }
  .fv-title { font-size: 19px; }
}
/* ===== end funds v2 ===== */
/* ---------------- Quant – xác suất có điều kiện (#/quant, quant.js) ---------------- */
.qt-page .card-head h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 600; }
.qt-hero { padding: 14px 16px; }
.qt-hero h2 { margin: 0 0 4px; }
.qt-status { margin-top: 8px; line-height: 1.6; }
.qt-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 0; }
.qt-dot.up { background: var(--up); } .qt-dot.down { background: var(--down); } .qt-dot.warn { background: var(--flat); }
.qt-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.qt-lib { position: sticky; top: calc(var(--nav-h) + 8px); max-height: calc(100vh - var(--nav-h) - 24px); display: flex; flex-direction: column; }
.qt-lib-search { padding: 10px 12px 6px; }
.qt-lib-body { overflow: auto; padding: 0 8px 10px; flex: 1; min-height: 0; }
.qt-cat { border-bottom: 1px solid var(--grid-line); }
.qt-cat > summary { cursor: pointer; padding: 8px 4px; font-weight: 700; font-size: 13.5px; list-style-position: inside; }
.qt-tool { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 4px 6px 8px; border-radius: 6px; }
.qt-tool:hover { background: var(--card-2); }
.qt-tool-main { min-width: 0; }
.qt-tool-main b { display: block; font-size: 13.5px; }
.qt-tool-main small { font-size: 12px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qt-tool .btn { flex: none; min-width: 34px; padding: 3px 8px; }
.qt-page .btn:disabled, .qt-page .chip:disabled { opacity: .45; cursor: not-allowed; }
.qt-main { min-width: 0; }
.qt-tplbar { padding: 10px 14px; }
.qt-tplrow { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr); gap: 8px 12px; align-items: end; }
.qt-tplbtns { grid-column: 1 / -1; gap: 6px; }
.qt-f { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; position: relative; }
.qt-f > span:first-child { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.qt-f .input, .qt-f .select { padding: 6px 8px; font-size: 13.5px; }
.qt-note { font-size: 12px; line-height: 1.35; }
.qt-chk { flex-direction: row; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }
.qt-f.qt-chk > span:first-child, .qt-chk span { color: var(--text); font-weight: 500; font-size: 13.5px; }
.qt-chk input { margin: 0; flex: none; }
.qt-form { display: flex; flex-direction: column; gap: 10px; }
.qt-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qt-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.qt-emptybox { border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px; color: var(--muted); font-size: 13.5px; text-align: center; }
.qt-cond { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; background: var(--card); transition: box-shadow .3s; }
.qt-cond.mkt { border-left-color: var(--flat); }
.qt-cond.qt-new { box-shadow: 0 0 0 3px var(--accent-soft); }
.qt-cond-head { display: flex; gap: 10px; align-items: flex-start; }
.qt-cond-title { flex: 1; min-width: 0; }
.qt-cond-act { display: flex; gap: 2px; flex: none; }
.qt-cond-act .btn { padding: 3px 8px; }
.qt-x { color: var(--muted); }
.qt-x:hover { color: var(--down); }
.qt-id { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 6px; background: var(--navy); color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.qt-id.sm { min-width: 20px; height: 20px; font-size: 12px; padding: 0 4px; border-radius: 4px; }
.qt-cond.mkt .qt-id, .qt-id.mkt { background: var(--flat); }
.qt-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.qt-params > .qt-err, .qt-period > .qt-err { grid-column: 1 / -1; }
.qt-cond-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--grid-line); align-items: end; }
.qt-seg { align-self: flex-start; }
.qt-static { font-size: 13.5px; padding: 5px 0; }
.qt-sum { margin-top: 8px; line-height: 1.5; }
.qt-logic { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-top: 4px; }
.qt-lbl { font-weight: 700; font-size: 13px; }
.qt-expr { flex: 1 1 260px; width: auto; font-family: ui-monospace, Consolas, monospace; }
.qt-hint { flex-basis: 100%; }
.qt-page code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.qt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.qt-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 4px 3px 10px; font-weight: 700; font-size: 13px; }
.qt-chip button { border: 0; background: transparent; color: inherit; width: 20px; height: 20px; border-radius: 50%; padding: 0; line-height: 1; }
.qt-chip button:hover { background: var(--card); color: var(--down); }
.qt-hadd { gap: 6px; }
.qt-hadd .input { width: 80px; }
.qt-hadd .chip { padding: 2px 9px; }
.qt-padd { gap: 6px; margin-bottom: 6px; }
.qt-padd .select { width: auto; max-width: 100%; }
.qt-period { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, 1fr) minmax(120px, 1fr) auto; gap: 6px 8px; align-items: end; padding: 6px 0; border-bottom: 1px dashed var(--grid-line); }
.qt-runbar { position: sticky; bottom: 8px; z-index: 5; padding: 10px 14px; box-shadow: var(--shadow-lg); }
.qt-run-main { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.qt-runbtn { padding: 9px 22px; font-size: 14.5px; }
.qt-runbtn:disabled { opacity: .55; cursor: not-allowed; }
.qt-prog { margin-top: 8px; font-size: 13.5px; }
.qt-prog-bar { height: 4px; background: var(--grid-line); border-radius: 2px; overflow: hidden; margin-bottom: 6px; position: relative; }
.qt-prog-bar i { position: absolute; top: 0; bottom: 0; width: 35%; background: var(--accent); border-radius: 2px; animation: qt-slide 1.3s ease-in-out infinite; }
@keyframes qt-slide { 0% { left: -35%; } 100% { left: 100%; } }
.qt-invalid > .input, .qt-invalid > .select, .qt-invalid > input.input, .qt-invalid > .seg { border: 1px solid var(--down) !important; box-shadow: 0 0 0 2px var(--down-bg); }
.qt-cond.qt-invalid, .qt-period.qt-invalid, .card.qt-invalid, .qt-chip.qt-invalid, .qt-logic.qt-invalid, .qt-params.qt-invalid { box-shadow: 0 0 0 2px var(--down-bg); border-color: var(--down); }
.qt-logic.qt-invalid, .qt-params.qt-invalid { border: 1px solid var(--down); border-radius: 6px; padding: 6px; }
.qt-err { color: var(--down); font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.card.qt-invalid > .qt-err { padding: 0 16px 10px; }
.qt-errlist { margin: 4px 0 0; padding-left: 18px; }
.qt-warnbox { background: var(--flat-bg); border: 1px solid var(--flat); border-radius: 6px; padding: 8px 12px; font-size: 13px; margin: 8px 0; }
.qt-warnbox ul { margin: 4px 0 0; padding-left: 18px; }
.qt-term { cursor: help; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.qt-gloss > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 14px; }
.qt-gloss[open] > summary { border-bottom: 1px solid var(--border); }
.qt-gloss h4 { margin: 14px 0 6px; font-size: 14px; }
.qt-gloss-dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 14px; margin: 0 0 8px; font-size: 13.5px; line-height: 1.45; }
.qt-gloss-dl dt { font-weight: 600; }
.qt-gloss-dl dd { margin: 0; color: var(--muted); }
.qt-gloss-dl dd ul { margin: 4px 0 0; padding-left: 18px; }
.qt-hsel:empty { display: none; }
.qt-hsel { margin: 6px 0 2px; padding: 6px 10px; border-left: 3px solid var(--border); background: var(--bg-soft, rgba(127,127,127,.06)); border-radius: 0 4px 4px 0; line-height: 1.45; }
.qt-phelp { margin: 6px 0 4px; font-size: 13px; }
.qt-phelp > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 2px 0; }
.qt-phelp[open] > summary { margin-bottom: 6px; }
.qt-phelp .qt-gloss-dl { font-size: 13px; }
@media (max-width: 640px) { .qt-gloss-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .qt-gloss-dl dd { margin-bottom: 6px; } }
.qt-mform label { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; border-bottom: 0; }
.qt-mform input[type=text], .qt-mform input:not([type]), .qt-mform .input { width: 100%; }
.qt-ta { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; resize: vertical; }
/* kết quả */
.qt-res-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 24px; }
.qt-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.qt-legend li { display: flex; gap: 6px; align-items: baseline; }
.qt-res-info > div { margin-bottom: 4px; }
.qt-badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.qt-badge.warn { background: var(--flat-bg); color: var(--flat); border: 1px solid var(--flat); }
.qt-verdict { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; cursor: help; }
.qt-verdict.good { background: #f3e8ff; color: #7e22ce; border-color: #a855f7; }
:root[data-theme="dark"] .qt-verdict.good { background: #3b0764; color: #d8b4fe; border-color: #a855f7; }
.qt-verdict.ok { background: var(--up-bg); color: var(--up); }
.qt-verdict.warn { background: var(--flat-bg); color: var(--flat); border-color: var(--flat); }
.qt-verdict.bad { background: var(--down-bg); color: var(--down); }
.qt-verdict.sm { font-size: 11px; padding: 0 6px; }
.qt-card-head .qt-verdict { margin-left: auto; }
.qt-cell .qt-verdict { margin-top: 2px; }
.qt-warn-ico { color: var(--flat); cursor: help; }
.qt-matrix th, .qt-matrix td { vertical-align: middle; }
.qt-matrix td { padding: 4px; }
.qt-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-width: 130px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; background: var(--card); text-align: left; }
.qt-cell b { font-size: 16px; }
.qt-cell small { color: var(--muted); font-size: 11.5px; }
.qt-cell.tint-up { background: var(--up-bg); }
.qt-cell.tint-down { background: var(--down-bg); }
.qt-cell.thin { opacity: .55; border-style: dashed; }
.qt-cell.sel, .qt-card.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.qt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.qt-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--card); cursor: pointer; min-width: 0; }
.qt-card:hover { border-color: var(--accent); }
.qt-card.thin { background: var(--card-2); }
.qt-card.thin .qt-pv { opacity: .6; }
.qt-card-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-bottom: 6px; }
.qt-prow { display: flex; gap: 12px; align-items: center; }
.qt-p { flex: none; min-width: 92px; }
.qt-pv { font-size: 26px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.qt-cmp, .qt-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.qt-cmp dt, .qt-kv dt { color: var(--muted); }
.qt-cmp dd, .qt-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.qt-cmp { flex: 1; }
.qt-kv { margin-top: 6px; }
.qt-track { position: relative; height: 16px; margin: 12px 0 4px; background: var(--grid-line); border-radius: 4px; }
/* CI cụm: dải rộng, nền nhạt + viền đứt; CI Wilson: thanh đặc, mảnh, nằm giữa */
.qt-tr-cc { position: absolute; top: 0; bottom: 0; background: rgba(29, 111, 242, .14); border: 1.5px dashed #1d6ff2; border-radius: 4px; box-sizing: border-box; min-width: 3px; }
.qt-tr-ci { position: absolute; top: 5px; bottom: 5px; background: #1d4ed8; border-radius: 3px; min-width: 2px; }
:root[data-theme="dark"] .qt-tr-cc { background: rgba(96, 165, 250, .16); border-color: #60a5fa; }
:root[data-theme="dark"] .qt-tr-ci { background: #93c5fd; }
.qt-tr-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11.5px; color: var(--muted); margin: 0 0 6px; }
.qt-tr-legend span { display: inline-flex; align-items: center; gap: 4px; }
.qt-sw { display: inline-block; flex: none; vertical-align: middle; }
dt .qt-sw { margin-right: 5px; }
.qt-sw.ci { width: 14px; height: 6px; background: #1d4ed8; border-radius: 2px; }
.qt-sw.cc { width: 14px; height: 10px; background: rgba(29, 111, 242, .14); border: 1.5px dashed #1d6ff2; border-radius: 3px; box-sizing: border-box; }
.qt-sw.p { width: 8px; height: 8px; border-radius: 50%; background: var(--up); }
.qt-sw.base { width: 3px; height: 12px; background: var(--flat); border-radius: 1px; }
:root[data-theme="dark"] .qt-sw.ci { background: #93c5fd; }
:root[data-theme="dark"] .qt-sw.cc { background: rgba(96, 165, 250, .16); border-color: #60a5fa; }
.qt-tr-base { position: absolute; top: -4px; bottom: -4px; z-index: 1; width: 3px; margin-left: -1px; background: var(--flat); border-radius: 1px; }
.qt-tr-p { position: absolute; top: 1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); box-sizing: content-box; top: 1px; z-index: 2; }
.qt-tr-p.up { background: var(--up); } .qt-tr-p.down { background: var(--down); }
.qt-dist { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.qt-dist th { color: var(--muted); font-weight: 600; text-align: left; padding: 2px 4px; border-bottom: 1px solid var(--border); }
.qt-dist td { padding: 2px 4px; border-bottom: 1px solid var(--grid-line); white-space: nowrap; }
.qt-dist .num { text-align: right; }
.qt-dist tr.qt-mfe td { color: var(--muted); }
.qt-cardfoot { margin-top: 6px; line-height: 1.4; }
.qt-blocksel { width: auto; max-width: 100%; }
.qt-inline { width: auto; }
.qt-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.qt-mini { font-size: 13px; }
.qt-mini td, .qt-mini th { padding: 4px 8px; }
.tbl tr.qt-thin td { opacity: .55; }
.tbl tr.qt-full td { background: var(--accent-soft); }
.qt-combo { display: inline-flex; align-items: center; gap: 2px; }
.qt-combo i { font-style: normal; color: var(--muted); font-size: 12px; padding: 0 1px; }
.qt-symchips { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 1100px) {
  .qt-layout { grid-template-columns: minmax(0, 1fr); }
  .qt-lib { position: static; max-height: none; }
  .qt-lib-body { max-height: 46vh; }
}
@media (max-width: 900px) {
  .qt-settings, .qt-res-meta, .qt-detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .qt-tplrow, .qt-2 { grid-template-columns: minmax(0, 1fr); }
  .qt-period { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qt-period > .qt-f:first-child { grid-column: 1 / -1; }
  .qt-cards { grid-template-columns: minmax(0, 1fr); }
  .qt-params, .qt-cond-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qt-pv { font-size: 22px; }
  .qt-runbar { bottom: 4px; padding: 8px 10px; }
  .qt-runbtn { flex: 1 1 auto; }
  #qt-run-note { flex-basis: 100%; }
  .qt-page .card-head { flex-wrap: wrap; }
}

/* ---------------- Chỉ số tài chính (#/ratios) ---------------- */
.rt-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rt-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rt-form { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.rt-tools { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rt-cmp { position: relative; display: inline-flex; }
.rt-cmp .input { width: 120px; padding: 4px 8px; text-transform: uppercase; }
.rt-ac { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 260px; max-height: 280px; overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.rt-ac a { display: block; padding: 6px 10px; font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-ac a.on, .rt-ac a:hover { background: var(--accent-soft); }
.rt-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 13px; font-weight: 600; }
.rt-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 5px; }
.rt-chip button:hover { color: var(--down, #dc2626); }
label.rt-ind { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.rt-set { font-weight: 700; letter-spacing: .3px; }
.rt-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 340px; max-width: calc(100vw - 32px); background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); padding: 10px 12px; }
.rt-pop-list { max-height: 52vh; overflow: auto; margin: 8px 0; }
.rt-pop-g { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 10px 2px 4px; cursor: pointer; user-select: none; }
.rt-pop-g:hover { color: var(--accent); }
.rt-pop-i { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 14px; border-bottom: 1px solid var(--grid-line); cursor: pointer; }
.rt-pop-i input { accent-color: var(--accent); }
.rt-pop-foot { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.rt-table td.num { text-align: right; }
.fin-table.rt-table tr.rt-sub td { font-style: italic; color: var(--muted); }
.fin-table.rt-table tr.rt-sub td:first-child { padding-left: 30px; color: var(--muted); }
.fin-table.rt-table tr.rt-sub td.c-up { color: var(--up, #16a34a); }
.fin-table.rt-table tr.rt-sub td.c-down { color: var(--down, #dc2626); }
.fin-table.rt-table td.rt-ind, .rt-table th.rt-ind { background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
@media (max-width: 640px) {
  .fin-table.rt-table th:first-child, .fin-table.rt-table td:first-child { min-width: 170px; max-width: 210px; }
  .rt-tools { width: 100%; }
}
/* Điểm mua: các mẫu Quant dàn ngang thành nút chọn */
.al-tpls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.al-tpls:empty { display: none; }
.al-tpl { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer; max-width: 100%; }
.al-tpl:hover { border-color: var(--accent); color: var(--accent); }
.al-tpl.active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.al-tpl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.al-tpl.off { color: var(--muted); }
.al-cnt { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
.al-tpl.active .al-cnt { background: #fff; color: var(--navy); }
/* Điểm mua: thẻ tín hiệu của mọi mẫu */
.al-chip { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); font: inherit; font-size: 12.5px; line-height: 1.5; cursor: pointer; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.al-chip:hover { border-color: var(--accent); color: var(--accent); }
.al-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.al-chip.lost { color: var(--muted); text-decoration: line-through; }
.al-all tr.al-new td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.al-fresh { color: var(--accent); font-weight: 700; white-space: nowrap; }
#al-pick { scroll-margin-top: 72px; }   /* bấm tên mẫu ở thẻ tín hiệu: cuộn tới, không bị thanh menu che */
/* Điểm mua Aristock (mẫu quản trị, ẩn tên): số hiệu tín hiệu + dòng phụ "3 năm gần nhất" */
.al-sig { display: inline-block; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; color: var(--text); white-space: nowrap; }
.al-sub { font-size: 11.5px; color: var(--muted); line-height: 1.3; white-space: nowrap; }
.al-picktbl td { vertical-align: top; }

/* Trang BCTC: bảng file báo cáo gốc (năm × kỳ) */
.rf-wrap { overflow-x: auto; margin-top: 10px; }
.rf-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
.rf-table th, .rf-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.rf-table thead th { font-size: 13px; font-weight: 700; color: var(--muted); background: var(--bg); white-space: nowrap; }
.rf-table thead th:first-child, .rf-table tbody th { width: 56px; }
.rf-table tbody th { font-weight: 800; color: var(--text); }
.rf-table tbody tr:hover td, .rf-table tbody tr:hover th { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.rf-sub { font-size: 11.5px; font-weight: 500; }
.rf-link { display: inline-flex; align-items: center; gap: 3px; margin: 1px 4px 1px 0; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text); background: var(--card); white-space: nowrap; text-decoration: none; }
.rf-link:hover { border-color: var(--accent); color: var(--accent); }
.rf-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rf-link.rf-other { color: var(--muted); }
.rf-tag { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.rf-none { color: var(--muted); opacity: .5; }
/* Vĩ mô: kéo thả đổi thứ tự chỉ tiêu (tay cầm ⠿ trước tên) */
.mc-grip { display: inline-block; vertical-align: -1px; margin: 0 6px 0 -4px; padding: 0 3px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 15px; line-height: 1.2; cursor: grab; opacity: .35; touch-action: none; }
.macro-tbl tr:hover .mc-grip, .mc-grip:focus-visible { opacity: 1; }
.mc-grip:hover { background: var(--bg); color: var(--text); }
.mc-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
body.mc-drag-active, body.mc-drag-active * { cursor: grabbing !important; user-select: none; }
body.mc-drag-active .macro-tbl tr:hover td { background: transparent; }
.macro-tbl.mc-sorting tr[data-id] { transition: transform .2s cubic-bezier(.2, .7, .2, 1); }
/* chỗ trống nơi dòng sẽ hạ xuống */
.macro-tbl tr.mc-placeholder td { background: color-mix(in srgb, var(--accent) 7%, transparent) !important; border-bottom-color: transparent; }
.macro-tbl tr.mc-placeholder td > * { visibility: hidden; }
.macro-tbl tr.mc-placeholder td { color: transparent; }
.macro-tbl tr.mc-placeholder td:first-child { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
/* bản nổi của dòng đang kéo */
.mc-ghost { position: fixed; z-index: 1000; pointer-events: none; overflow: hidden; background: var(--card); border-radius: 6px; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); transform-origin: 30px 50%; transition: transform .16s ease-out, box-shadow .16s ease-out; }
.mc-ghost.lifted { transform: scale(1.015); box-shadow: 0 12px 28px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .1); }
.mc-ghost.dropping { transition: top .19s cubic-bezier(.2, .7, .2, 1), transform .19s ease, box-shadow .19s ease; }
.mc-ghost .tbl td { background: var(--card); border-bottom-color: transparent; }
.mc-ghost .mc-grip { opacity: 1; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .macro-tbl.mc-sorting tr[data-id], .mc-ghost, .mc-ghost.dropping { transition: none; } }
/* Quỹ: thanh "Mua chứng chỉ quỹ" nổi góc dưới, đi theo khi cuộn (tím nhạt) */
.fund-buy { position: fixed; right: 24px; bottom: 24px; z-index: 900; display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px 10px 12px; border: 1px solid #c4b5fd; border-radius: 999px; background: #ede9fe; color: #5b21b6; font-size: 14px; line-height: 1.25; text-decoration: none; box-shadow: 0 8px 24px rgba(91, 33, 182, .18), 0 1px 3px rgba(91, 33, 182, .12); transition: background .15s, box-shadow .15s, transform .15s; }
.fund-buy:hover { background: #ddd6fe; color: #4c1d95; text-decoration: none; transform: translateY(-1px); box-shadow: 0 12px 28px rgba(91, 33, 182, .24), 0 2px 4px rgba(91, 33, 182, .14); }
.fund-buy:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }
.fund-buy .fb-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; font-size: 18px; box-shadow: 0 1px 2px rgba(91, 33, 182, .15); }
.fund-buy b { font-weight: 700; font-size: 17px; letter-spacing: .1px; }
.fund-buy .fb-go { font-size: 21px; font-weight: 600; margin-left: 2px; }
.fv-page.has-buy { padding-bottom: 84px; }
:root[data-theme="dark"] .fund-buy { background: #2e1065; color: #ddd6fe; border-color: rgba(167, 139, 250, .5); box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
:root[data-theme="dark"] .fund-buy:hover { background: #3b1a7e; color: #ede9fe; }
:root[data-theme="dark"] .fund-buy .fb-ico { background: rgba(255, 255, 255, .12); }
@media (max-width: 600px) { .fund-buy { left: 16px; right: 16px; bottom: 16px; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .fund-buy, .fund-buy:hover { transition: none; transform: none; } }
/* Chỉ số tài chính – so sánh nhiều kỳ: tiêu đề 2 dòng (nhóm kỳ / mã), vạch chia giữa các nhóm cột */
.rt-cmpopt { display: inline-flex; align-items: center; gap: 6px; }
.rt-cmpopt.hidden { display: none; }
.fin-table.rt-table.rt-multi thead tr.rt-h2 th { top: var(--rt-h1, 33px); }
.fin-table.rt-table th.rt-gh { text-align: center; color: var(--text); font-weight: 700; border-bottom-color: var(--grid-line); }
.fin-table.rt-table .rt-g0 { border-left: 1px solid var(--border); }
.fin-table.rt-table.rt-multi td { min-width: 88px; }
/* Chú thích cho người mới (glossary.js): tên chỉ tiêu có giải thích gạch chân chấm, rê chuột hiện hộp giải thích */
.gl { text-decoration: underline dotted color-mix(in srgb, var(--muted) 70%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: help; }
.bctc-table a.nm.gl { cursor: pointer; }
.tbl th.sortable.gl { cursor: pointer; }
.fb-tip { position: fixed; z-index: 2000; max-width: min(360px, calc(100vw - 16px)); padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font-size: 13.5px; font-weight: 400; line-height: 1.5; text-align: left; white-space: normal; box-shadow: 0 10px 28px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .08); pointer-events: none; opacity: 0; visibility: hidden; transform: translateY(2px); transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s; }
.fb-tip.on { opacity: 1; visibility: visible; transform: none; transition: opacity .12s ease, transform .12s ease; }
.fb-tip-t { font-weight: 700; margin-bottom: 4px; }
.fb-tip-f, .fb-tip-x { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 12.5px; }
:root[data-theme="dark"] .fb-tip { box-shadow: 0 10px 28px rgba(0, 0, 0, .5); }
@media (prefers-reduced-motion: reduce) { .fb-tip, .fb-tip.on { transition: none; transform: none; } }

/* ---------- Trang chủ: Thống kê thị trường ---------- */
.mkt-stats { margin: 4px 0 8px; }
.mkt-stats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mkt-stats-head h2 { font-size: 22px; letter-spacing: -.02em; }
.mkt-more { font-size: 14px; font-weight: 500; color: var(--accent); }
.mkt-more:hover { text-decoration: underline; }
.index-cards.idx4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.idx-full { padding: 14px 16px 12px; }
.idx-full .idx-top { align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--text); font-size: 15px; }
.idx-full .idx-top .idx-val { margin-left: auto; font-size: 19px; }
.idx-full .idx-chg { flex-basis: 100%; text-align: right; font-size: 13px; font-weight: 600; margin-top: -2px; }
.idx-kv { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 8px; margin: 12px 0 10px; }
.idx-kv small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 1px; }
.idx-kv b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.idx-kv > div:last-child { text-align: right; }
.brd-bar { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; }
.brd-bar.sm { height: 5px; }
.brd-bar i { display: block; min-width: 0; }
.brd-bar .dn { background: var(--down-fill); } .brd-bar .fl { background: var(--flat-fill); } .brd-bar .up { background: var(--up-fill); }
.idx-chips { display: flex; justify-content: space-between; margin-top: 9px; font-size: 12.5px; font-weight: 600; }
.idx-chips span { padding: 1px 8px; border-radius: 999px; }
.chip-dn { background: var(--down-bg); color: var(--down); } .chip-fl { background: var(--flat-bg); color: var(--flat); } .chip-up { background: var(--up-bg); color: var(--up); }
.brd-kpis { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.brd-kpis > div { min-width: 0; padding: 0 14px; border-left: 1px solid var(--grid-line); }
.brd-kpis > div:first-child { padding-left: 0; border-left: 0; }
.brd-kpis > div:last-child { padding-right: 0; }
.brd-kpis small { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.brd-kpis > div > b { display: block; margin: 3px 0 1px; font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.brd-kpis em { display: block; font-style: normal; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.brd-kpis em b { font-weight: 600; }
.brd-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.brd-dot.dn { background: var(--down-fill); } .brd-dot.fl { background: var(--flat-fill); } .brd-dot.up { background: var(--up-fill); }
@media (max-width: 1180px) { .index-cards.idx4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .index-cards.idx4 { grid-template-columns: 1fr; } }
/* Độ rộng thị trường cao bằng thẻ Thanh khoản bên cạnh (lưới mặc định stretch): biểu đồ trong phiên giãn lấp phần còn lại.
   canvas đặt absolute để chiều cao của nó không đẩy ngược khung (Chart.js responsive đo theo khung) */
#hm-breadth { display: flex; flex-direction: column; }
#hm-breadth > .card-body { flex: 1; display: flex; flex-direction: column; }
.brd-intra { flex: 1; display: flex; flex-direction: column; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--grid-line); }
.brd-intra-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.brd-intra-head b { font-weight: 600; }
.brd-chart { flex: 1; min-height: 150px; }
.brd-chart canvas { position: absolute; inset: 0; }
@media (max-width: 480px) {
  .brd-kpis > div { padding: 0 9px; }
  .brd-kpis small { gap: 5px; white-space: nowrap; }
  .brd-kpis > div > b { font-size: 21px; }
  .brd-kpis em { white-space: normal; }
}

/* ---------- Trang chủ: Thống kê thị trường › tab Tổng quan / Định giá (valuation.js) ---------- */
.mkt-tabs { margin: -2px 0 14px; }
.mkt-tabs .seg-btn { padding: 6px 16px; font-size: 14px; }
.vl-head { align-items: flex-start; }
.vl-head h3 { line-height: 1.3; }
.vl-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.vl-ctrls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.vl-cheap { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.vl-cheap i { width: 46px; height: 5px; border-radius: 999px; background: linear-gradient(90deg, var(--up), var(--flat), var(--down)); }
.vl-foot { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.vl-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.vl-kpi { margin: 0; padding: 14px 18px; }
.vl-kpi small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.vl-kpi > b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin: 2px 0; }
.vl-unit { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.vl-kpi-sub { font-size: 13px; color: var(--text-2); }
.vl-kpi-note { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.vl-kpi-note span { font-weight: 600; }
.vl-ex-row { align-items: start; }
.vl-capline { margin-bottom: 8px; font-size: 14px; }
.vl-capline b { font-size: 19px; font-weight: 700; }
.vl-capbar { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.vl-capbar i { display: block; min-width: 2px; }
table.vl-ex { width: 100%; border-collapse: collapse; font-size: 14px; }
.vl-ex th { text-align: right; font-weight: 600; padding: 4px 0 8px 8px; border-bottom: 1px solid var(--grid-line); white-space: nowrap; }
.vl-ex th small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.vl-ex td { padding: 8px 0 8px 8px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.vl-ex td:first-child { text-align: left; padding-left: 0; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.vl-ex tr.vl-sep td { border-top: 1px solid var(--grid-line); }
.vl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
/* bảng ngành: tên + nút mở nhánh, vốn hóa có thanh tỷ trọng, P/E – P/B có thanh khoảng lịch sử */
.vl-sec-wrap { max-height: 620px; }
.tbl.vl-sec { font-size: 14px; }
.tbl.vl-sec th { background: var(--card-2); padding: 10px 12px; }
.tbl.vl-sec td { padding: 9px 12px; vertical-align: middle; }
.vl-sec tr.has-kids { cursor: pointer; }
.vl-name { min-width: 240px; white-space: normal; }
.vl-nm { display: flex; align-items: center; gap: 6px; }
.vl-l2 .vl-name { font-weight: 600; }
.vl-l2.open .vl-name { color: var(--accent); }
.vl-tog { flex: none; width: 20px; height: 20px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; padding: 0; transition: transform .15s, background-color .15s; }
.vl-tog:hover { background: var(--track); color: var(--text); }
.vl-l2.open .vl-tog { transform: rotate(90deg); color: var(--accent); }
.vl-tog-sp { flex: none; width: 20px; }
.vl-l3 td { background: var(--card-2); color: var(--text-2); }
.vl-l3 .vl-nm { padding-left: 34px; position: relative; }
.vl-l3 .vl-nm::before { content: ""; position: absolute; left: 9px; top: -10px; bottom: -10px; border-left: 1px solid var(--border); }
.vl-l3.last .vl-nm::before { bottom: 50%; }
.vl-l3 .vl-nm::after { content: ""; position: absolute; left: 9px; top: 50%; width: 14px; border-top: 1px solid var(--border); }
.vl-capc { min-width: 190px; text-align: right; }
.vl-capc b, .vl-valc b { font-weight: 600; font-variant-numeric: tabular-nums; }
.vl-l3 .vl-capc b, .vl-l3 .vl-valc b { font-weight: 500; }
.vl-capt { display: block; height: 4px; margin-top: 5px; border-radius: 999px; background: var(--track); overflow: hidden; }
.vl-capt i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.vl-valc { min-width: 200px; white-space: nowrap; }
.vl-valc b { display: inline-block; min-width: 48px; text-align: right; margin-right: 12px; }
.vl-rng { position: relative; display: inline-block; width: 120px; height: 14px; vertical-align: middle; }
.vl-rng::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; border-radius: 2px; background: var(--track); }
.vl-rng-na::before { opacity: .5; }
.vl-band { position: absolute; top: 4px; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 42%, transparent); }
.vl-med { position: absolute; top: 1px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px; background: var(--text); }
.vl-cur { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); }
.vl-cur.lo { background: var(--up); } .vl-cur.hi { background: var(--down); }
.vl-l3 .vl-cur { box-shadow: 0 0 0 2px var(--card-2); }
/* chú giải dùng chung cho bảng và biểu đồ so sánh ngành */
.vl-legend-sm, .vl-cmp-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.vl-legend-sm i, .vl-cmp-legend i { position: relative; display: inline-block; vertical-align: middle; margin-right: 5px; }
.vl-legend-sm .vl-cur, .vl-cmp-legend .vl-cur { position: relative; top: 0; margin-left: 0; width: 9px; height: 9px; box-shadow: none; }
.vl-lg-band { width: 14px; height: 8px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 42%, transparent); }
.vl-lg-med { width: 12px; height: 2.5px; background: var(--text); border-radius: 1px; }
.vl-lg-mkt { width: 16px; height: 0; border-top: 1.5px dashed var(--muted); }
.vl-cmp-legend { display: flex; justify-content: center; margin-top: 10px; }
.vl-cmp-legend b { color: var(--text); margin-left: 3px; }
.vl-method { margin: 4px 2px 0; line-height: 1.6; }
@media (max-width: 1100px) { .vl-ex-row { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .vl-kpis { grid-template-columns: 1fr; gap: 10px; }
  .vl-head { flex-wrap: wrap; }
  .vl-ctrls { justify-content: flex-start; }
  .vl-rng { width: 84px; }
  .vl-name { min-width: 180px; }
  .vl-l3 .vl-nm { padding-left: 28px; }
  .vl-legend-sm { display: none; }
}
/* Thanh khoản thị trường: chọn sàn + so với 1 phiên / TB 5 / TB 10 phiên; dòng tóm tắt so với cùng giờ */
.liq-ctrls { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.liq-vs { display: inline-flex; align-items: center; gap: 8px; }
.caption.liq-cap { color: var(--text-2); }
/* trang chủ: mua/bán ròng theo nhóm nhà đầu tư / nhóm lệnh (pages.js groupFlowWidget) */
.grp-head { align-items: flex-start; }
.grp-head h3 { margin-bottom: 2px; }
.grp-info { color: var(--muted); cursor: help; font-size: 16px; line-height: 1; }
.grp-ctrls { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.grp-ctrls .seg { flex-wrap: wrap; }
.grp-note { margin-top: 6px; line-height: 1.5; }
.liq-cap b { color: var(--text); font-weight: 600; }
@media (max-width: 480px) {
  .mirror-row { gap: 6px; }
  .mirror { --m-fix: 92px; }
  .m-side { gap: 4px; }
  .m-sym { width: 42px; }
  .m-val { width: 42px; }
}
/* Biểu đồ P/E lịch sử theo sàn: nút bật đường trung bình ± 1σ / ± 2σ */
.vl-sds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.vl-sd { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--card); color: var(--muted); border-radius: 999px; padding: 3px 11px 3px 9px; font-size: 13px; font-weight: 600; transition: border-color .15s, color .15s, background-color .15s; }
.vl-sd i { width: 14px; height: 3px; border-radius: 2px; opacity: .45; }
.vl-sd:hover { border-color: var(--border-strong); color: var(--text); }
.vl-sd[aria-pressed="true"] { color: var(--text); border-color: var(--border-strong); background: var(--track); }
.vl-sd[aria-pressed="true"] i { opacity: 1; }
