/* ==========================================================================
   ECOSYSTEM PRO v3.6 — LỚP GIAO DIỆN "CORBEL"  (nạp SAU style.css, theme-pro.css và theme-corbel-tokens.css)
   Token thật của theme (4 bảng màu × sáng/tối) nằm ở theme-corbel-tokens.css; file này:
     1. nối tên biến cũ của style.css (--card, --border, --text-2…) vào token Corbel;
     2. dựng khung (mesh, header, viên thuốc mực, dock, tiêu đề trang), thẻ kính rim, nút, ô nhập, bảng, modal, finder, toast;
     3. chừa chỗ cho chuyển động (cb-motion.js) và biểu đồ (cb-viz.css / cb-viz.js).
   - Không đổi id/onclick/logic của app.js: chỉ token + component.
   - Quay lại giao diện v3.4: bỏ các <link>/<script> theme-corbel* / cb-* / corbel.js trong index.html.
   - Màu "tín hiệu" giữ ngữ nghĩa giao dịch: xanh = lời/LONG, đỏ = lỗ/SHORT, PAPER xanh / LIVE đỏ.
   ========================================================================== */

/* ---------- 1. CẦU NỐI TOKEN: tên biến cũ → token Corbel ---------- */
/* style.css đặt lại --bg, --surface, --text… ngay trên <body> (body.theme-light) nên phải "inherit" lại giá trị của <html>. */
html body.cb {
    --bg: inherit; --surface: inherit; --surface-2: inherit; --text: inherit; --muted: inherit; --primary: inherit;
    --up: inherit; --down: inherit; --warn: inherit; --up-soft: inherit; --down-soft: inherit; --panel: var(--glass);
}
html body.cb,
html body.cb :is(.tile--sky, .tile--mint, .tile--coral, .tile--lemon, .tile--ocean, .cb-kpis > :first-child, .risk-kpi-ribbon-grid > :first-child) {
    --cb-ink: var(--ink-btn); --cb-on-ink: var(--on-ink-btn);
    --cb-field: var(--glass-2);          /* nền ô nhập / chip */
    --cb-alt: var(--well);               /* nền nhóm nút, ô phụ */
    --cb-pill: var(--glass);             /* nền thanh điều hướng viên thuốc */
    --cb-pill-active: var(--pill); --cb-pill-active-text: var(--on-pill);
    --cb-dock: var(--dock); --cb-dock-ink: var(--on-dock);
    --cb-hatch: var(--hatch);
    --cb-th: var(--surface-2); --cb-row-hover: var(--surface-2);

    --card: var(--glass); --card-hover: var(--glass-2);
    --border: var(--line); --border-subtle: var(--line); --border-strong: var(--line-2); --control-border: var(--line-2);
    --text-2: var(--muted); --text-3: var(--faint); --text-muted: var(--faint);
    --accent: var(--primary); --accent-hover: var(--primary-ink); --accent-soft: var(--primary-soft);
    --info: var(--primary); --ceiling: var(--c4); --floor: var(--c3); --reference: var(--warn);
    --secondary: var(--text); --violet: var(--faint);

    --sidebar-bg: transparent; --sidebar-hover: var(--well); --sidebar-active: var(--well); --sidebar-border: transparent;
    --header-bg: transparent; --main-bg: transparent;
    --panel-bg: var(--glass); --panel-sub-bg: var(--glass-2); --panel-border: var(--line); --panel-hover: var(--well);
    --table-th-bg: var(--surface-2); --table-border: var(--line);
    --sidepanel-bg: var(--float); --sidepanel-header-bg: var(--float);

    --accent-primary: var(--cb-ink); --accent-primary-light: var(--primary-soft);
    --accent-purple: var(--muted); --accent-purple-light: var(--well); --accent-blue: var(--cb-ink);
    --accent-gradient: linear-gradient(var(--cb-ink), var(--cb-ink));
    --accent-up: var(--up); --accent-up-light: var(--up-soft); --accent-down: var(--down); --accent-down-light: var(--down-soft);
    --accent-neutral: var(--warn); --accent-neutral-light: var(--warn-soft);
    --primitive-sky-500: var(--muted); --primitive-sky-400: var(--muted); --primitive-purple-500: var(--muted);
    --color-ring: var(--line-2);

    --radius-card: var(--r); --radius-btn: 999px; --radius-input: 14px; --radius-sm: 8px; --radius-md: 14px; --radius-lg: var(--r);
    --shadow-md: none; --shadow-lg: var(--shadow-pop);

    --font-sans: var(--font); --font-ui: var(--font); --font-display: var(--font); --font-data: var(--font);
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;      /* chỉ dành cho mã/công thức */
}
html body.cb {
    --header-h: 76px; --rail-w: 72px;
    --dock-gutter: calc(var(--dock-x) + var(--dock-w) + var(--gut));
    --cb-max: var(--app-max);
    --cb-padx: max(var(--dock-gutter), calc((100vw - var(--cb-max)) / 2 + var(--dock-gutter)));
}
/* màu ô nhấn theo từng workspace (Corbel: [data-view] { --tile }) */
[data-view="cockpit"] { --tile: var(--sky); } [data-view="symbol-workspace"] { --tile: var(--mint); } [data-view="rd-lab"] { --tile: var(--lemon); }
[data-view="portfolio"] { --tile: var(--mint); } [data-view="settings"] { --tile: var(--coral); } [data-view="guide"] { --tile: var(--lemon); }
:root[data-palette="mono"] [data-view] { --tile: var(--sky); }
html body.cb .cb-kpis > :first-child, html body.cb .risk-kpi-ribbon-grid > :first-child {
    background: var(--tile, var(--sky)); box-shadow: none; border: 0; color: var(--text);
    --text: #14202a; --muted: #14202ac2; --faint: #14202ab3; --well: #14202a14; --line: #14202a1f; --line-2: #14202a33; --surface-2: #fff6;
    --up: #1b5e4a; --up-soft: #ffffff8c; --down: #8f3220; --down-soft: #ffffff8c; --primary: #14202a; --primary-ink: #14202a; --c1: #14202a; --c2: #14202a52; --c3: #14202a; --rim: #fff6;
}
:root[data-palette="mono"]:not([data-theme="dark"]) body.cb :is(.cb-kpis, .risk-kpi-ribbon-grid) > :first-child {
    background: var(--ocean); box-shadow: none;
    --text: #f3f7f8; --muted: #f3f7f8c7; --faint: #f3f7f8b3; --well: #ffffff1f; --line: #ffffff24; --line-2: #ffffff3d; --surface-2: #ffffff14;
    --up: #8fe3c4; --up-soft: #8fe3c429; --down: #ffb3a1; --down-soft: #ffb3a129; --primary: #f3f7f8; --primary-ink: #f3f7f8; --c1: var(--oc-1); --c2: var(--oc-2); --c4: var(--oc-3); --rim: #ffffff1a;
}

/* ---------- 2. NỀN TẢNG ---------- */
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
html body.cb { background: transparent; color: var(--text); font: 500 var(--fs-base)/1.45 var(--font); font-size: 13.5px; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
html body.cb .app-layout, html body.cb .app-main { background: transparent; }
body.cb ::selection, html body ::selection, ::selection {
    background: #2563EB !important;
    color: #FFFFFF !important;
    text-shadow: none !important;
}
body.cb :focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
body.cb .num, body.cb .radar-symbol { font-variant-numeric: tabular-nums; }
.cb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* nền mesh 3 đốm màu trôi chậm (cb-motion.js điều khiển bằng GSAP) */
.mesh { z-index: -1; pointer-events: none; position: fixed; inset: 0; overflow: hidden; }
.mesh i { filter: blur(60px); opacity: .95; will-change: transform; border-radius: 50%; position: absolute; }
.mesh__a { background: radial-gradient(closest-side, var(--mesh-a), transparent); width: 62vmax; height: 62vmax; top: -24vmax; left: -18vmax; }
.mesh__b { background: radial-gradient(closest-side, var(--mesh-b), transparent); width: 70vmax; height: 70vmax; bottom: -30vmax; right: -24vmax; }
.mesh__c { background: radial-gradient(closest-side, var(--mesh-c), transparent); width: 46vmax; height: 46vmax; top: -16vmax; right: 8vmax; }
kbd { font: 600 var(--fs-2xs) var(--font); background: var(--glass-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 7px; padding: 2px 7px; border: 0; }

/* ---------- 3. HEADER: thương hiệu · thanh viên thuốc mực · cụm công cụ ---------- */
html body.cb .top-header {
    height: auto; min-height: var(--header-h); background: transparent; border-bottom: 0; box-shadow: none; backdrop-filter: none;
    padding: 18px var(--cb-padx) 4px; gap: 16px; justify-content: flex-start; align-items: center;
}
.cb-brand { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex: 0 0 auto; min-width: 0; border-radius: 14px; }
.cb-logo { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--pill); color: var(--on-pill); flex: 0 0 auto; }
.cb-logo svg { width: 20px; height: 20px; }
.cb-brand-text { display: grid; gap: 1px; min-width: 0; line-height: 1.2; }
.cb-brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-brand-sub { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); white-space: nowrap; }

/* thanh điều hướng: nền kính + viên mực trượt (clip-path) */
.cb-pillnav {
    flex: 0 0 auto; min-width: max-content; max-width: 100%; margin-left: 10px; scrollbar-width: none; overflow-x: auto;
    background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim); border-radius: 999px;
}
.cb-pillnav::-webkit-scrollbar { display: none; }
.cb-pillnav__track { display: flex; gap: 2px; width: max-content; padding: 4px; position: relative; }
.top-header .cb-pillnav .menu-item, .cb-pillnav__pill > span {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 38px; min-height: 38px; padding: 0 14px; margin: 0; width: auto;
    border: 0; border-radius: 999px; background: transparent; color: var(--text); font: 600 var(--fs-md)/1 var(--font); letter-spacing: 0; white-space: nowrap; box-shadow: none;
}
.top-header .cb-pillnav .menu-item { position: relative; z-index: 1; transition: background-color .2s; cursor: pointer; }
.top-header .cb-pillnav .menu-item i { display: none; }
.top-header .cb-pillnav .menu-item:hover { background: var(--well); color: var(--text); }
.top-header .cb-pillnav .menu-item.active, .top-header .cb-pillnav .menu-item.active:hover { background: transparent; color: var(--text); font-weight: 600; }
.top-header .cb-pillnav .menu-item.active::before { display: none; }
.cb-pillnav__pill { z-index: 2; background: var(--pill); color: var(--on-pill); pointer-events: none; opacity: 0; display: flex; gap: 2px; padding: 4px; position: absolute; inset: 0; }
.cb-pillnav__pill > span { color: var(--on-pill); }
.cb-pillnav__pill i { display: none; }
.cb-pillnav .badge-count, .cb-pillnav__pill .badge-count {
    margin: 0; padding: 1px 6px; height: auto; min-width: 20px; display: inline-block; text-align: center; border-radius: 999px; border: 0;
    font: 700 var(--fs-2xs)/16px var(--font); background: var(--well); color: inherit; letter-spacing: 0;
}
.cb-pillnav__pill .badge-count { background: #ffffff2e; }
:root[data-theme="dark"] .cb-pillnav__pill .badge-count { background: #0000001f; }

.top-header .header-financial { margin-left: auto; gap: 8px; flex: 0 0 auto; }
.top-header .header-system { gap: 8px; flex: 0 0 auto; display: flex; align-items: center; }
.top-header .btn-sidebar-expand-header, .top-header .kpi-block, .top-header .kpi-divider, #dropdown-portfolio,
#btn-header-ai-chat, #btn-header-theme-toggle, #btn-header-mcp-status, #status-market-badge { display: none !important; }

/* Nút & chip trong header: viên kính */
.compact-drop-btn, .btn-header-tool, .top-header button:not(.btn-sidebar-expand-header):not(.menu-item) {
    height: 40px; min-height: 40px; border-radius: 999px; padding: 0 14px;
    background: var(--glass-2); border: 0; box-shadow: inset 0 0 0 1px var(--rim); color: var(--text);
    font: 600 var(--fs-md)/1 var(--font);
}
.compact-drop-btn:hover, .btn-header-tool:hover, .top-header button:not(.menu-item):hover { background: var(--glass-3); color: var(--text); }
.top-header .drop-caret { display: none; }
#dropdown-tools .drop-btn-title { display: none; }
#dropdown-tools .compact-drop-btn { width: 40px; padding: 0; display: inline-grid; place-items: center; }
#dropdown-tools .compact-drop-btn i.text-yellow { color: var(--text); }
.top-header .pulse-dot { background: var(--up); }
.top-header #status-btn-summary { gap: 8px; }
#btn-header-auth-status { width: auto; padding: 0 14px; gap: 8px; display: inline-flex; align-items: center; }
#btn-header-auth-status .tool-label { display: inline; }
.top-header #btn-header-kill { width: auto; padding: 0 14px; background: var(--down-soft); box-shadow: none; color: var(--down); font-weight: 700; gap: 7px; display: inline-flex; align-items: center; }
.top-header #btn-header-kill .tool-label { display: inline; }
.top-header #btn-header-kill:hover { background: var(--down); color: var(--surface); }
/* Popover / dropdown: nền đặc "float" + bóng nổi */
.dropdown-popover, .popover { border: 0; border-radius: var(--r); background: var(--float); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line); color: var(--text); }
/* PAPER/LIVE: luôn hiện; giữ màu ngữ nghĩa */
.top-header #trading-mode-capsule .trading-mode-badge { padding: 0 14px; height: 40px; border-radius: 999px; font-family: var(--font); letter-spacing: .04em; font-weight: 700; }

/* chuông thông báo (popover Corbel: danh sách cảnh báo thật của phiên) */
.cb-bell { position: relative; }
.cb-bell__dot { background: var(--down); width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--bg); border-radius: 50%; position: absolute; top: 9px; right: 11px; }
.cb-bell__dot[hidden] { display: none; }
.cb-pop {
    z-index: 60; border-radius: var(--r); background: var(--float); width: min(360px, 100vw - 24px);
    box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line); position: fixed; overflow: hidden; color: var(--text);
}
.cb-pop[hidden] { display: none; }
.cb-pop__head { border-bottom: 1px solid var(--line); justify-content: space-between; align-items: center; padding: 14px 16px; display: flex; }
.cb-pop__head b { font-weight: 700; font-size: var(--fs-base); }
.cb-pop__list { max-height: 380px; overflow-y: auto; }
.cb-pop__list li { border-bottom: 1px solid var(--line); gap: 11px; padding: 12px 16px; display: flex; }
.cb-pop__list li:last-child { border-bottom: 0; }
.cb-pop__list li.is-unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.cb-pop__list .n-ico { background: var(--well); width: 32px; height: 32px; color: var(--primary); border-radius: 50%; flex: none; place-items: center; display: grid; font-size: 13px; }
.cb-pop__list p { font-size: var(--fs-md); margin: 0; }
.cb-pop__list small { color: var(--faint); font-size: var(--fs-xs); }
.cb-pop__empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: var(--fs-md); }
.cb-link { color: var(--primary-ink); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; background: none; border: 0; padding: 0; box-shadow: none; height: auto; }
.cb-link:hover { text-decoration: underline; }

/* ---------- 4. DOCK CÔNG CỤ bên trái (nổi) ---------- */
#app-sidebar.cb-dock {
    position: fixed !important; z-index: 30; left: max(var(--dock-x), calc((100vw - var(--app-max)) / 2 + var(--dock-x))); right: auto; bottom: 0; top: 0; transform: none; margin: auto 0;
    width: 60px !important; min-width: 60px !important; max-width: 60px !important; height: fit-content !important; max-height: calc(100vh - 40px);
    padding: 8px !important; gap: 4px; border: 0 !important; border-radius: 999px !important; background: var(--dock) !important; color: var(--on-dock);
    display: flex !important; flex-direction: column; align-items: center; overflow: visible !important; box-shadow: 0 20px 40px -18px #0a141e80 !important; visibility: visible !important;
}
:root[data-theme="dark"] #app-sidebar.cb-dock { -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: inset 0 0 0 1px var(--line), 0 20px 40px -18px #0009 !important; }
#app-sidebar.cb-dock .cb-dock-btn {
    position: relative; width: 44px !important; height: 44px !important; min-height: 44px !important; padding: 0 !important; margin: 0 !important;
    display: inline-grid; place-items: center; border: 0 !important; border-radius: 50% !important;
    background: transparent !important; color: var(--on-dock) !important; cursor: pointer; font-size: 15px; opacity: .74; flex: 0 0 auto; box-shadow: none !important;
    transition: opacity .2s, background-color .2s;
}
#app-sidebar.cb-dock .cb-dock-btn i { width: auto !important; font-size: 15px; color: inherit !important; margin: 0 !important; display: inline-block !important; visibility: visible !important; }
#app-sidebar.cb-dock .cb-dock-btn:hover, #app-sidebar.cb-dock .cb-dock-btn:focus-visible, #app-sidebar.cb-dock .menu-item.cb-dock-btn.active { opacity: 1; background: #ffffff21 !important; }
#app-sidebar.cb-dock .cb-dock-btn:focus-visible { outline-color: var(--on-dock); }
#app-sidebar.cb-dock .menu-item.cb-dock-btn.active::before { display: none; }
#app-sidebar.cb-dock .menu-item.cb-dock-btn.active::after { content: ""; background: var(--mint); border-radius: 50%; width: 5px; height: 5px; margin-top: -2.5px; position: absolute; top: 50%; right: 3px; }
#app-sidebar.cb-dock .cb-sr { visibility: visible !important; }
#app-sidebar.cb-dock .cb-dock-sep { width: auto; align-self: stretch; height: 1px; background: #ffffff24; margin: 4px 10px; flex: 0 0 auto; }
#app-sidebar.cb-dock .cb-dock-btn[data-tip]::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 0; bottom: 0; margin: auto 0; height: fit-content; transform: none;
    padding: 6px 10px; border-radius: 10px; background: var(--float); color: var(--text); white-space: nowrap; border: 0; box-shadow: var(--shadow-pop);
    font: 600 var(--fs-sm)/1.3 var(--font); opacity: 0; pointer-events: none; transition: opacity .18s var(--ease); z-index: 5;
}
#app-sidebar.cb-dock .menu-item.cb-dock-btn.active[data-tip]::after { content: attr(data-tip); background: var(--float); width: auto; height: fit-content; border-radius: 10px; top: 0; right: auto; margin: auto 0; }
#app-sidebar.cb-dock .cb-dock-btn:hover::after, #app-sidebar.cb-dock .cb-dock-btn:focus-visible::after { opacity: 1; }
#app-sidebar.cb-dock #cb-dock-ai .fa-wand-magic-sparkles { font-size: 14px; }
#app-sidebar.cb-dock #cb-dock-ai i { color: var(--lemon) !important; }
#btn-sidebar-expand-header { display: none !important; }
#app-sidebar.cb-dock .tool-label, #app-sidebar.cb-dock .cb-dock-btn > span:not(.cb-sr) { display: none !important; }

/* ---------- 5. KHUNG NỘI DUNG & HÀNG TIÊU ĐỀ TRANG ---------- */
html body.cb .workspace-body { padding: 8px var(--cb-padx) 40px; }
.cb-page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px clamp(20px, 2.4vw, 36px); min-height: 48px; margin: 6px 0 20px; }
.cb-ph-row1 { display: contents; }
.cb-page-head h1 { margin: 0; font: 600 clamp(28px, 2.6vw, 38px)/1.04 var(--display); letter-spacing: -.025em; color: var(--text); white-space: nowrap; outline: none; }
.cb-page-head h1 .word { vertical-align: top; margin-bottom: -.08em; padding-bottom: .08em; display: inline-block; overflow: hidden; }
.cb-page-head h1 .ch { display: inline-block; }
.cb-ph-meta { color: var(--muted); font-size: var(--fs-sm); display: none; align-items: center; gap: 7px; }
.cb-ph-row2 { display: contents; }
.cb-ph-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
body[data-cb-page="symbol-workspace"] .cb-ph-row2, body[data-cb-page="rd-lab"] .cb-ph-row2, body[data-cb-page="settings"] .cb-ph-row2, body[data-cb-page="guide"] .cb-ph-row2 { display: none; }
/* viên "LIVE" (Corbel .live): số mã theo dõi chạy kiểu odometer */
.cb-live { background: var(--mint); height: 34px; color: var(--on-tile, #14202a); font-size: var(--fs-md); border-radius: 999px; align-items: center; gap: 7px; padding: 0 13px 0 12px; font-weight: 600; display: inline-flex; --text: #14202a; }
:root[data-palette="mono"]:not([data-theme="dark"]) .cb-live { background: var(--ocean); color: #f3f7f8; }
.cb-live__dot { background: currentColor; border-radius: 50%; width: 7px; height: 7px; position: relative; }
.cb-live__dot:after { content: ""; opacity: 0; border: 1.5px solid; border-radius: 50%; animation: 2.2s cubic-bezier(.2, .6, .3, 1) infinite cb-ping; position: absolute; inset: -4px; }
@keyframes cb-ping { 0% { opacity: .9; transform: scale(.4); } 80%, to { opacity: 0; transform: scale(1.5); } }
.cb-live__n { height: 1.3em; line-height: 1.3; display: inline-flex; overflow: hidden; }
.cb-odo { text-align: center; width: .6em; height: 1.3em; display: inline-block; overflow: hidden; }
.cb-odo__strip { flex-direction: column; display: flex; }
.cb-odo__strip span { height: 1.3em; }
.cb-live__label { font-weight: 500; }

/* thanh phân đoạn (seg) có viên trượt */
.cb-seg, body .workspace-subnav-bar, body .quant-subnav-bar, body .ws-subnav, body .mode-switch {
    background: var(--well); border-radius: 999px; display: inline-flex; align-items: center; gap: 0; padding: 3px; position: relative; top: auto; z-index: auto; border: 0; max-width: 100%; margin-bottom: 0;
}
.cb-seg__pill { background: var(--glass-3); pointer-events: none; border-radius: 999px; position: absolute; top: 3px; bottom: 3px; left: 3px; box-shadow: 0 2px 8px #1428381a; opacity: 0; z-index: 0; }
:root[data-theme="dark"] .cb-seg__pill { background: #ffffff24; }
.cb-seg button, .top-header .cb-seg button, body .mode-switch button {
    position: relative; z-index: 1; height: 32px; min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
    font: 600 var(--fs-sm)/1 var(--font); white-space: nowrap; cursor: pointer; transition: color .2s; box-shadow: none; letter-spacing: 0; text-transform: none;
}
.cb-seg button:hover, body .mode-switch button:hover { color: var(--text); background: transparent; }
.cb-seg button.active, .cb-seg button[aria-pressed="true"], body .mode-switch button.active { color: var(--text); background: transparent; box-shadow: none; }
html body.cb:not(.cb-fx) .cb-seg button.active, html body.cb:not(.cb-fx) .mode-switch button.active { background: var(--glass-3); box-shadow: 0 2px 8px #1428381a; }   /* chưa có JS: vẫn thấy mục đang chọn */
:root[data-theme="dark"] body.cb:not(.cb-fx) .cb-seg button.active, :root[data-theme="dark"] body.cb:not(.cb-fx) .mode-switch button.active { background: #ffffff24; }
body[data-cb-page="portfolio"] #cb-scope { display: none; }
.cb-btn, body .btn-secondary, body .btn-terminal-pill { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 999px; border: 0;
    font: 600 var(--fs-md)/1 var(--font); cursor: pointer; white-space: nowrap; transition: background-color .2s, color .2s, box-shadow .2s; }
.cb-btn-ghost { background: var(--glass-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.cb-btn-ghost:hover { background: var(--glass-3); }
.cb-btn-ink { background: var(--pill); color: var(--on-pill); box-shadow: none; }
.cb-btn-ink:hover { background: color-mix(in srgb, var(--pill) 84%, var(--primary)); }
.cb-btn kbd { margin-left: 2px; }

/* ---------- 6. THẺ KPI COCKPIT (statbar Corbel) ---------- */
.cb-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; box-shadow: none; background: none; padding: 0; }
.cb-kpi {
    position: relative; min-height: 138px; padding: 18px 20px 14px; border-radius: var(--r); overflow: hidden; min-width: 0;
    background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); color: var(--text);
    display: grid; grid-template-rows: auto auto auto 1fr; align-content: start; gap: 6px; border: 0;
}
.cb-kpi-hero, .cb-kpi-alt { }
.cb-kpi-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.cb-kpi-label i { font-size: 11px; opacity: .8; cursor: help; }
.cb-kpi-val { font: 600 var(--fs-4xl)/1.1 var(--display); letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 72px; }
.cb-kpi-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 21px; padding-right: 72px; }
.cb-kpi-sub { font-size: var(--fs-sm); color: var(--faint); }
.cb-chip { display: inline-flex; align-items: center; gap: 2px; height: 20px; padding: 0 7px; border-radius: 999px; font: 700 var(--fs-2xs)/1 var(--font); background: var(--well); color: var(--muted); white-space: nowrap; }
.cb-chip-up { background: var(--up-soft); color: var(--up); }
.cb-chip-down { background: var(--down-soft); color: var(--down); }
.cb-chip-warn { background: var(--warn-soft); color: var(--warn); }
.cb-kpi-link { align-self: end; justify-self: stretch; display: block; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--hatch); font-size: var(--fs-sm); font-weight: 600; color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.cb-kpi-link:hover { color: var(--primary-ink); text-decoration-color: currentColor; }
.cb-kpi-link i { display: none; }

.cb-kpi-viz { position: absolute; right: 20px; top: 42px; width: 60px; height: 52px; display: flex; align-items: flex-end; justify-content: flex-end; gap: 5px; }
.cb-viz-bars i, .cb-viz-pair i { display: block; width: 11px; border-radius: 6px; background: var(--hatch); min-height: 8px; transform-origin: 50% 100%; }
.cb-viz-bars i { background: var(--c2); }
.cb-viz-bars i:last-child { background: var(--c1); }
.cb-viz-pair i { width: 14px; background: repeating-linear-gradient(135deg, var(--hatch) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--hatch); }
.cb-viz-pair i.up { background: var(--up); box-shadow: none; } .cb-viz-pair i.down { background: var(--down); box-shadow: none; }
.cb-viz-ring { width: 54px; height: 54px; align-items: center; justify-content: center; }
.cb-viz-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cb-viz-ring span { position: relative; font: 700 var(--fs-xs)/1 var(--font); color: var(--text); }
.cb-ring-bg { fill: none; stroke: var(--well); stroke-width: 5; }
.cb-ring-fg { fill: none; stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.cb-ring-fg.warn { stroke: var(--warn); } .cb-ring-fg.down { stroke: var(--down); }
.cb-viz-seg { width: 72px; height: 44px; gap: 2px; }
.cb-viz-seg i { display: block; width: 2.5px; border-radius: 2px; background: var(--hatch); transform-origin: 50% 100%; }
.cb-viz-seg i.on { background: var(--text); } .cb-viz-seg i.on.down { background: var(--down); }

/* ---------- 7. THẺ / PANEL / TIÊU ĐỀ (rim kép "kính") ---------- */
body .panel-card, body .card, body .glass-panel, body .settings-card, body .telegram-card, body .admin-tile, body .perf-kpi-card, body .guide-card,
body .qlib-item, body .risk-kpi-tile, body .var-card, body .stat-card, body .detail-section-card, body .bento-card, body .workspace-card {
    background: var(--glass); border: 0; border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); backdrop-filter: none; color: var(--text);
}
body .panel-card:hover { border-color: transparent; }
body .panel-header { padding: 20px 20px 12px; border: 0; background: transparent; }
body .panel-title { font: 600 var(--fs-lg)/1.25 var(--display); letter-spacing: -.005em; text-transform: none; color: var(--text); }
body .panel-title i, body .panel-title .fa-solid { color: var(--faint); }
body .panel-subtitle, body .panel-sub { font-size: var(--fs-sm); letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 500; }
/* màu nhấn nhiều sắc của bản cũ → đơn sắc theo bảng màu (chỉ giữ xanh/đỏ/hổ phách cho tín hiệu thật) */
body .text-blue, body .text-primary, body .text-accent, body .text-cyan, body .text-sky, body .text-info, body .text-purple, body .text-indigo, body .text-emerald:not(.text-up) { color: var(--muted); }
body i.text-yellow, body .fa-solid.text-yellow { color: var(--muted); }
body .text-muted, body .muted { color: var(--faint); }
body .badge-pill { background: var(--well); color: var(--muted); border: 0; border-radius: 999px; font-weight: 700; }
body .badge-pill.badge-up, body .badge-up { background: var(--up-soft); color: var(--up); }
body .badge-pill.badge-down, body .badge-down { background: var(--down-soft); color: var(--down); }

/* ---------- 8. NÚT ---------- */
body .btn-secondary, body .btn-terminal-pill, body .btn-radar-detail, body .btn-radar-inspect-minimal, body .btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px;
    background: var(--glass-2); color: var(--text); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); font: 600 var(--fs-sm)/1 var(--font); cursor: pointer;
    transition: background-color .2s, color .2s, box-shadow .2s;
}
body .btn-secondary:hover, body .btn-terminal-pill:hover, body .btn-radar-detail:hover, body .btn-radar-inspect-minimal:hover { background: var(--glass-3); color: var(--text); }
body .btn-primary, body .btn-primary-neon, body .btn-primary:not([style*="background"]) {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; border: 0;
    background: var(--pill); color: var(--on-pill); font: 600 var(--fs-md)/1 var(--font); cursor: pointer; box-shadow: none; text-shadow: none;
    transition: background-color .2s, color .2s;
}
body .btn-primary:hover, body .btn-primary-neon:hover { background: color-mix(in srgb, var(--pill) 84%, var(--primary)); color: var(--on-pill); }
body .btn-primary i, body .btn-primary-neon i { color: inherit; }
body .btn-radar-detail, body .btn-radar-inspect-minimal { height: 30px; padding: 0 12px; font-size: var(--fs-xs); color: var(--text); }
body .btn-radar-detail i, body .btn-radar-inspect-minimal i { color: var(--faint); }
body .btn-danger, body .btn-kill { background: var(--down-soft); color: var(--down); border: 0; border-radius: 999px; box-shadow: none; }

/* ---------- 9. Ô NHẬP / CHỌN ---------- */
body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), body select, body textarea,
body .admin-input, body .form-select, body .rbac-input {
    background: var(--glass-2); color: var(--text); border: 0; border-radius: 14px; font: 500 var(--fs-md)/1.3 var(--font); box-shadow: inset 0 0 0 1px var(--line-2);
    transition: box-shadow .2s;
}
body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):focus, body select:focus, body textarea:focus {
    outline: none; box-shadow: inset 0 0 0 1.5px var(--text); background: var(--glass-2);
}
body input::placeholder, body textarea::placeholder { color: var(--faint); }
body input[type="checkbox"], body input[type="radio"], body input[type="range"] { accent-color: var(--ink-btn); }
body select { padding-right: 28px; }
/* công tắc Corbel (.switch) — dùng cho các ô bật/tắt cài đặt */
.cb-switch { flex: none; width: 40px; height: 24px; display: inline-flex; position: relative; }
.cb-switch input { opacity: 0; cursor: pointer; z-index: 1; margin: 0; position: absolute; inset: 0; width: 100%; height: 100%; }
.cb-switch__track { background: var(--line-2); border-radius: 99px; width: 100%; height: 100%; transition: background-color .25s; }
.cb-switch__knob { background: #fff; border-radius: 50%; width: 18px; height: 18px; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); position: absolute; top: 3px; left: 3px; box-shadow: 0 1px 3px #00000040; }
.cb-switch input:checked ~ .cb-switch__track { background: var(--c3); }
.cb-switch input:checked ~ .cb-switch__knob { transform: translate(16px); }
.cb-switch input:focus-visible ~ .cb-switch__track { outline: 2px solid var(--text); outline-offset: 2px; }

/* ---------- 10. THANH TAB CON, BỘ LỌC ---------- */
body .workspace-subnav-bar, body .quant-subnav-bar, body .ws-subnav { margin-bottom: 14px; padding: 0; background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3); overflow-x: auto; scrollbar-width: none; border-bottom-width: 0; }
body .workspace-subnav-bar::-webkit-scrollbar, body .quant-subnav-bar::-webkit-scrollbar { display: none; }
.cb-subtrack { gap: 2px; width: max-content; padding: 4px; display: flex; position: relative; }
.cb-subpill { z-index: 0; opacity: 0; pointer-events: none; background: var(--glass-3); position: absolute; inset: 0; }
:root[data-theme="dark"] .cb-subpill { background: #ffffff24; }
body .ws-subnav-btn, body .quant-subnav-bar button, body .workspace-subnav-bar button {
    position: relative; z-index: 1; height: 36px; padding: 0 15px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 600 var(--fs-md)/1 var(--font);
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; box-shadow: none; cursor: pointer; transition: color .2s; letter-spacing: 0; text-transform: none;
}
body .ws-subnav-btn i { color: var(--faint); transition: color .2s; }
body .ws-subnav-btn:hover, body .quant-subnav-bar button:hover, body .workspace-subnav-bar button:hover { background: transparent; color: var(--text); }
body .ws-subnav-btn.active, body .quant-subnav-bar button.active, body .workspace-subnav-bar button.active { background: transparent; color: var(--text); font-weight: 600; box-shadow: none; border: 0; }
html body.cb:not(.cb-fx) .ws-subnav-btn.active, html body.cb:not(.cb-fx) .workspace-subnav-bar button.active { background: var(--glass-3); }
body .ws-subnav-btn.active i { color: var(--text); }
body .ws-subnav-btn::after, body .ws-subnav-btn.active::after { display: none; }
/* chip Corbel */
body .radar-cat-pill, body .radar-sub-pill, body .btn-filter, body .asset-pill-btn {
    height: 32px; padding: 0 13px; border-radius: 999px; background: var(--glass-2); border: 0; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font: 600 var(--fs-sm)/1 var(--font);
    transition: background-color .2s, color .2s, box-shadow .2s;
}
body .radar-cat-pill:hover, body .radar-sub-pill:hover { background: var(--glass-2); color: var(--text); }
body .radar-cat-pill.active, body .radar-sub-pill.active, body .btn-filter.active, body .asset-pill-btn.active { background: var(--pill); color: var(--on-pill); box-shadow: none; font-weight: 600; }
.settings-nav-item { border-radius: 14px; position: relative; z-index: 1; font-weight: 600; color: var(--muted); }
.settings-nav-item:hover { color: var(--text); background: var(--well); }
.settings-nav-item.active { background: var(--glass-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--rim); }
:root[data-theme="dark"] .settings-nav-item.active { background: #ffffff24; }

/* ---------- 11. BẢNG ---------- */
body .table-wrap, body .table-responsive { border-radius: 0 0 var(--r) var(--r); }
body .data-table { border-collapse: collapse; width: 100%; font-size: var(--fs-md); }
body .data-table th {
    background: var(--surface-2); color: var(--muted); font: 600 var(--fs-xs)/1.2 var(--font); letter-spacing: 0; text-transform: none; text-align: left;
    padding: 10px 14px; border: 0; border-block: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
body .data-table th:first-child, body .data-table td:first-child { padding-left: 20px; }
body .data-table th:last-child, body .data-table td:last-child { padding-right: 20px; }
body .data-table td { border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; color: var(--text); font-variant-numeric: tabular-nums; font-family: var(--font); vertical-align: middle; }
body .data-table tbody tr { transition: background-color .15s; }
body .data-table tbody tr:hover td { background: var(--surface-2); }
body .data-table tbody tr.row-selected td, body .data-table tbody tr.radar-clickable-row.row-selected td { background: color-mix(in srgb, var(--primary-soft) 70%, transparent); }
body .data-table tbody tr:last-child td { border-bottom: 0; }
body .data-table .font-mono, body .data-table .num, body .num, body .font-mono, body .radar-price, body .radar-score { font-family: var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.005em; }
body .radar-symbol { font-family: var(--font); font-weight: 600; }
/* nhãn tài sản & tín hiệu: viên thuốc trung tính / ngữ nghĩa */
body .radar-sector-tag, body .radar-sector-tag.tag-crypto, body .radar-sector-tag.tag-cme, body .radar-sector-tag.tag-us, body .radar-sector-tag.tag-bank {
    background: var(--well); color: var(--muted); border: 0; border-radius: 999px; padding: 2px 8px; font: 700 10px/1.4 var(--font); letter-spacing: .04em;
}
body .sig-badge { border-radius: 999px; padding: 3px 10px; font: 700 var(--fs-xs)/1.3 var(--font); letter-spacing: .02em; border: 0; }
body .sig-badge-long { background: var(--up-soft); color: var(--up); }
body .sig-badge-short { background: var(--down-soft); color: var(--down); }
body .sig-badge-standby, body .sig-badge-blocked { background: var(--well); color: var(--faint); }

/* ---------- 12. MODAL · NGĂN TRƯỢT · POPUP ---------- */
body .modal-backdrop, body .modal-overlay { background: #0e182047; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
:root[data-theme="dark"] body .modal-backdrop, :root[data-theme="dark"] body .modal-overlay { background: #00000094; }
body .modal-box, body .modal-dialog, body .modal-content {
    background: var(--float); color: var(--text); border: 0; border-radius: 26px; box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line);
}
body .modal-top, body .modal-header { border-bottom: 1px solid var(--line); background: transparent; }
body .modal-bottom, body .modal-footer { border-top: 1px solid var(--line); background: transparent; }
body .modal-heading, body .modal-title { font: 700 var(--fs-2xl)/1.2 var(--display); letter-spacing: -.015em; text-transform: none; color: var(--text); }
body .modal-close { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: transparent; color: var(--muted); border: 0; transition: background-color .2s, color .2s; }
body .modal-close:hover { background: var(--well); color: var(--text); }

/* ---------- 13. CHUYỂN TRANG & ĐỔI THEME ---------- */
.tab-view.cb-leaving { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; z-index: 1; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

/* ---------- 14. SỬA CHI TIẾT ---------- */
body .font-mono, body .tabular-nums, body .radar-price-cell, body .data-table td:nth-child(n) { font-family: var(--font); font-variant-numeric: tabular-nums; }
body code, body pre, body .docked-code, body #docked-formula-code, body .qlib-item-formula, body .qlib-item-code { font-family: var(--font-mono); }
body .ws-subnav-btn, body .ws-subnav-btn span { text-transform: none; letter-spacing: 0; }
body[data-cb-page="portfolio"] .cb-ph-row2 { display: contents; }
body[data-cb-page="portfolio"] #cb-btn-detail, body:not([data-cb-page="cockpit"]) #cb-live { display: none; }
/* chế độ giao dịch: PAPER xanh ở cả hai chế độ giao diện (LIVE đỏ) — thắng luật !important cũ của style.css */
html body.cb .top-header #trading-mode-capsule .trading-mode-badge.mode-paper { background: var(--up-soft) !important; color: var(--up) !important; border: 1px solid transparent !important; }
html body.cb .top-header #trading-mode-capsule .trading-mode-badge.mode-live { background: var(--down-soft) !important; color: var(--down) !important; border: 1px solid transparent !important; animation: livePulse 2s infinite; }

/* Danh mục: dải KPI (thẻ đầu = ô nhấn) + VaR */
body .risk-kpi-ribbon-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
body .risk-kpi-tile { border-radius: var(--r); padding: 16px 18px; min-height: 112px; }
body .risk-kpi-tile:first-child { color: var(--text); }
body .risk-kpi-tile:first-child .risk-kpi-tile-header, body .risk-kpi-tile:first-child .risk-kpi-subtext, body .risk-kpi-tile:first-child .risk-kpi-subtext * { color: var(--muted); }
body .risk-kpi-tile:first-child .risk-kpi-hero-val, body .risk-kpi-tile:first-child strong { color: var(--text); }
body .risk-kpi-tile-header { font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
body .risk-kpi-hero-val { font: 600 24px/1.1 var(--display); letter-spacing: -.025em; color: var(--text); }
body .var-cards-grid { gap: 12px; }
body .var-metric-card { background: var(--glass); border: 0; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--rim); padding: 14px 16px; }
body .var-metric-header, body .var-metric-header span { font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
body .var-metric-val { font: 600 22px/1.15 var(--display); letter-spacing: -.02em; color: var(--text); }
body .var-metric-val.text-down { color: var(--down); }
@media (max-width: 1500px) { body .risk-kpi-ribbon-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Inspector Cockpit */
body .cockpit-docked-inspector { border-radius: var(--r); background: var(--glass); border: 0; box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); }
body .ci-section-title, body .ci-pillar-label, body .ci-label { letter-spacing: .06em; text-transform: uppercase; font-size: var(--fs-2xs); color: var(--muted); font-weight: 700; }
body .ci-pillar { border-radius: var(--r-sm); background: var(--well); border: 0; }
body .ci-pillar-val { font-family: var(--display); font-weight: 600; letter-spacing: -.02em; color: var(--text); }
body #btn-ci-buy, body #btn-ci-sell { height: 42px; border-radius: 999px; border: 0; font: 700 var(--fs-md)/1 var(--font); letter-spacing: 0; box-shadow: none; }
body #btn-ci-buy { background: var(--up); color: var(--surface); }
body #btn-ci-sell { background: var(--down); color: var(--surface); }
body .btn-ci-ticket, body .btn-ci-workspace { border-radius: 999px; background: var(--glass-2); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); }

/* Nút trợ lý AI nổi: viên mực */
#floating-ai-copilot-btn { background: var(--pill) !important; box-shadow: var(--shadow-pop) !important; border: 0 !important; }
#floating-ai-copilot-btn i { color: var(--on-pill) !important; filter: none !important; }

/* ---------- 15. TÌM NHANH (Finder — Ctrl K hoặc "/") ---------- */
.cb-palette { position: fixed; inset: 0; z-index: 12000; display: grid; justify-items: center; align-items: start; padding-top: 12vh; }
.cb-palette[hidden] { display: none; }
.cb-pal-scrim { position: absolute; inset: 0; background: #0e182047; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
:root[data-theme="dark"] .cb-pal-scrim { background: #00000094; }
.cb-pal-card { position: relative; width: min(620px, calc(100vw - 24px)); max-height: 70vh; display: flex; flex-direction: column; border-radius: 24px; overflow: hidden;
    background: var(--float); color: var(--text); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line); }
.cb-pal-head { display: flex; align-items: center; gap: 10px; padding: 0 18px; height: 58px; border-bottom: 1px solid var(--line); color: var(--faint); }
.cb-pal-head > i { font-size: 15px; }
.cb-pal-head input { flex: 1; min-width: 0; background: transparent !important; border: 0 !important; outline: 0; box-shadow: none !important; font: 500 var(--fs-xl)/1.3 var(--font) !important; color: var(--text) !important; padding: 0 !important; height: auto !important; }
.cb-pal-head input::placeholder { color: var(--faint); }
.cb-pal-list { overflow-y: auto; padding: 8px; min-height: 120px; max-height: 50vh; }
.cb-pal-group { padding: 10px 10px 4px; font: 700 var(--fs-2xs)/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cb-pal-row { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 14px; cursor: pointer; }
.cb-pal-row.active { background: var(--well); }
.cb-pal-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--well); color: var(--muted); flex: 0 0 auto; font-size: 13px; }
.cb-pal-t { flex: 0 1 auto; min-width: 0; font: 600 var(--fs-base)/1.25 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-pal-h { margin-left: auto; font-size: var(--fs-xs); color: var(--faint); white-space: nowrap; }
.cb-pal-empty { padding: 36px 12px; text-align: center; color: var(--muted); font-size: var(--fs-md); display: grid; gap: 4px; }
.cb-pal-empty b { color: var(--text); font-weight: 600; }
.cb-pal-foot { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--faint); }
html.cb-pal-open { overflow: hidden; }
@media (max-width: 767px) { .cb-palette { padding-top: 6vh; } .cb-pal-foot { display: none; } .cb-pal-h { display: none; } }

/* ---------- 16. THÔNG BÁO NỔI (toast Corbel: viên mực + chấm mint) ---------- */
.cb-toasts { z-index: 9000; right: 18px; bottom: calc(var(--tabbar-h, 0px) + 18px); pointer-events: none; justify-items: end; gap: 8px; display: grid; position: fixed; }
.cb-toast { background: var(--pill); max-width: min(400px, 100vw - 36px); color: var(--on-pill); box-shadow: var(--shadow-pop); font-size: var(--fs-md); pointer-events: auto; border-radius: 999px; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; font-weight: 600; display: flex; }
.cb-toast__ico { background: var(--mint); width: 26px; height: 26px; color: #14202a; border-radius: 50%; flex: none; place-items: center; display: grid; font-size: 11px; }
:root[data-palette="mono"]:not([data-theme="dark"]) .cb-toast__ico { background: #fff; }
.cb-toast__ico.is-warn { background: var(--lemon); } .cb-toast__ico.is-err { background: var(--coral); }
.cb-toast button { color: inherit; margin-left: 6px; font-weight: 700; text-decoration: underline; background: none; border: 0; padding: 0; height: auto; box-shadow: none; cursor: pointer; font-family: inherit; }
.cb-float-up { z-index: 9100; pointer-events: none; font-weight: 700; font-size: var(--fs-md); color: var(--up); position: fixed; }
.cb-float-up.down { color: var(--down); }
@media (max-width: 560px) { .cb-toasts { justify-items: stretch; left: 12px; right: 12px; } .cb-toast { border-radius: 18px; } }

/* ---------- 17. MODAL / NÚT CÓ STYLE NỘI TUYẾN, MIỄN TRỪ, CHÂN TRANG ---------- */
body .modal-box[style], body .modal-dialog[style] { background: var(--float) !important; border: 0 !important; box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line) !important; color: var(--text) !important; }
body .modal-box .modal-top[style], body .modal-box .modal-bottom[style] { border-color: var(--line) !important; }
body .modal-heading[style] { color: var(--text) !important; font-family: var(--display) !important; font-size: var(--fs-2xl) !important; letter-spacing: -.015em !important; font-weight: 700 !important; }
#legal-disclaimer-modal .modal-heading { text-transform: none; }
body .disclaimer-body-scroll { background: var(--well) !important; border: 0 !important; border-radius: 16px !important; color: var(--muted) !important; }
body .disclaimer-section h4 { color: var(--warn) !important; font: 700 var(--fs-sm)/1.3 var(--font) !important; letter-spacing: .02em; }
body .disclaimer-section p, body .disclaimer-section li, body .disclaimer-section strong { color: var(--muted) !important; }
body .disclaimer-section strong { color: var(--text) !important; }
body #legal-disclaimer-modal label[style], body .disclaimer-check-row { background: var(--well) !important; border: 0 !important; border-radius: 14px !important; color: var(--text) !important; }
body #legal-disclaimer-modal label[style] span, body #legal-disclaimer-modal label[style] strong { color: var(--text) !important; }
body #btn-accept-disclaimer, body #legal-disclaimer-modal .btn-primary, body #legal-disclaimer-modal button[onclick*="acceptDisclaimer"] { background: var(--pill) !important; color: var(--on-pill) !important; border-radius: 999px !important; border: 0 !important; opacity: 1; }
body #btn-accept-disclaimer:disabled, body #legal-disclaimer-modal button[disabled] { opacity: .35 !important; }

body .app-terminal-footer { background: transparent; border-top: 1px solid var(--line); color: var(--faint); padding-left: var(--cb-padx); padding-right: var(--cb-padx); font-size: var(--fs-xs); }
body .app-terminal-footer * { color: inherit; }
body .app-terminal-footer .text-up, body .app-terminal-footer .dot-green, body .app-terminal-footer .fa-circle { color: var(--up); }

/* Splash / màn chào */
body .quant-startup-card { border-radius: 28px; background: var(--float); border: 0; box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line); }
body .quant-startup-brand { font-family: var(--font); letter-spacing: .16em; }
body .quant-startup-badge { background: var(--well); color: var(--muted); border-radius: 999px; border: 0; }
body .quant-startup-btn, body #btn-skip-startup, body .quant-startup-card button { border-radius: 999px; background: var(--pill); color: var(--on-pill); border: 0; font-weight: 600; }

/* ---------- 18. CHI TIẾT BỔ SUNG ---------- */
body .var-metric-val.text-blue, body .var-metric-val.text-yellow, body .var-metric-val.text-purple { color: var(--text); }
body .corr-table th { background: var(--surface-2); color: var(--muted); font: 600 var(--fs-xs)/1.2 var(--font); border: 0; }
body .corr-table td { border-color: var(--line); }
body .corr-sym-col { color: var(--muted); font-weight: 600; }
body .rd-legend-is, body .legend-dot-is { background: var(--secondary); }
html body .var-metric-val.text-blue, html body .var-metric-val.text-yellow, html body .var-metric-val.text-purple, html body .var-metric-val.text-accent { color: var(--text) !important; }
html body .var-metric-val.text-down { color: var(--down) !important; }
/* ================= FLOATING AI ASSISTANT & MCP COPILOT CHAT WIDGET (TINH CHỈNH THEO YÊU CẦU) ================= */
html body #mcp-chat-box {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: 410px !important;
    max-width: calc(100vw - 28px) !important;
    height: min(520px, calc(100vh - 140px)) !important;
    max-height: calc(100vh - 140px) !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 20px !important;
    z-index: 10005 !important;
    transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1), opacity .2s ease !important;
}

/* Light Theme: Kính mờ phong cách Corbel sang trọng */
html:not([data-theme="dark"]) body #mcp-chat-box {
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(168, 85, 247, 0.28) !important;
    box-shadow: 0 20px 48px -12px rgba(15, 23, 42, 0.18), 0 0 24px rgba(168, 85, 247, 0.12) !important;
    backdrop-filter: blur(28px) saturate(1.8) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.8) !important;
    color: #0F172A !important;
}
html:not([data-theme="dark"]) body #mcp-chat-box .chat-widget-header {
    background: rgba(248, 250, 252, 0.92) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}
html:not([data-theme="dark"]) body #mcp-chat-box .chat-widget-header h3 {
    color: #0F172A !important;
}
html:not([data-theme="dark"]) body #mcp-chat-box .chat-quick-prompts {
    background: rgba(241, 245, 249, 0.9) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}
html:not([data-theme="dark"]) body #mcp-chat-box #chat-messages {
    background: rgba(255, 255, 255, 0.7) !important;
    color: #1E293B !important;
}
html:not([data-theme="dark"]) body #mcp-chat-box .chat-widget-footer {
    background: rgba(248, 250, 252, 0.94) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
}
html:not([data-theme="dark"]) body #mcp-chat-box #mcp-chat-input {
    background: #FFFFFF !important;
    color: #0F172A !important;
    border: 1px solid rgba(0, 0, 0, 0.14) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

/* Dark Theme: Kính sẫm cao cấp */
html[data-theme="dark"] body #mcp-chat-box {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(168, 85, 247, 0.35) !important;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.75), 0 0 30px rgba(168, 85, 247, 0.18) !important;
    backdrop-filter: blur(28px) saturate(1.5) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.5) !important;
}
html[data-theme="dark"] body #mcp-chat-box .chat-widget-header {
    background: rgba(30, 41, 59, 0.8) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html[data-theme="dark"] body #mcp-chat-box #chat-messages {
    background: rgba(11, 17, 30, 0.92) !important;
}
html[data-theme="dark"] body #mcp-chat-box .chat-widget-footer {
    background: rgba(15, 23, 42, 0.94) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html[data-theme="dark"] body #mcp-chat-box #mcp-chat-input {
    background: rgba(30, 41, 59, 0.85) !important;
    color: #F8FAFC !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html body #mcp-chat-box[style*="display: none"],
html body:not(.ai-chat-open) #mcp-chat-box:not([style*="display: flex"]) {
    display: none !important;
}
html body #mcp-chat-box[style*="display: flex"],
html body.ai-chat-open #mcp-chat-box {
    display: flex !important;
}
html body #mcp-chat-input, html body #mcp-chat-input:focus { border: 0 !important; outline: 0; box-shadow: inset 0 0 0 1px var(--line-2) !important; border-radius: 999px !important; background: var(--glass-2) !important; color: var(--text) !important; }

/* Ẩn tiêu đề Cockpit khi chưa đăng nhập (Lỗi 1) */
html body.cb.is-guest #cb-page-title,
html body.cb:not(.is-authenticated) #cb-page-title {
    display: none !important;
}

/* ================= TRẠNG THÁI LOGO & BRANDING KHI CHƯA / ĐÃ ĐĂNG NHẬP ================= */
/* 1. KHI CHƯA ĐĂNG NHẬP: Logo 44px + Tên HELM SYSTEM phong cách Quant nổi bật bên cạnh */
html body.cb.is-guest .cb-brand,
html body.cb:not(.is-authenticated) .cb-brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 4px 10px 4px 4px !important;
    border-radius: 16px !important;
}
html body.cb.is-guest .cb-logo,
html body.cb:not(.is-authenticated) .cb-logo {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15), inset 0 0 0 1px var(--rim) !important;
}
html body.cb.is-guest .cb-brand-text,
html body.cb:not(.is-authenticated) .cb-brand-text {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
}
html body.cb.is-guest .cb-brand-name,
html body.cb:not(.is-authenticated) .cb-brand-name {
    display: block !important;
    font-size: 19px !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    color: var(--text) !important;
    line-height: 1.1 !important;
}
html body.cb.is-guest .cb-brand-sub,
html body.cb:not(.is-authenticated) .cb-brand-sub {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.1em !important;
    color: var(--muted) !important;
    text-transform: uppercase !important;
}
html body.cb.is-guest .cb-brand-sub::after,
html body.cb:not(.is-authenticated) .cb-brand-sub::after {
    content: "V3.6 PRO";
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* 2. KHI ĐÃ ĐĂNG NHẬP: Giữ kích thước chuẩn của Logo & Thương hiệu HELM SYSTEM và hiển thị trọn vẹn 5 tab Cockpit */
html body.cb.is-authenticated .cb-brand {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 4px 6px 4px 4px !important;
    margin-right: 4px !important;
    flex-shrink: 0 !important;
}
html body.cb.is-authenticated .cb-logo {
    width: 40px !important;
    height: 40px !important;
    border-radius: 13px !important;
}
html body.cb.is-authenticated .cb-logo svg {
    width: 20px !important;
    height: 20px !important;
}
html body.cb.is-authenticated .cb-brand-text {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
    line-height: 1.15 !important;
}
html body.cb.is-authenticated .cb-brand-name {
    display: block !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    color: var(--text) !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
}
html body.cb.is-authenticated .cb-brand-sub {
    display: inline-flex !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    color: var(--muted) !important;
}
html body.cb.is-authenticated .cb-pillnav {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    min-width: max-content !important;
    margin-left: 8px !important;
}
html body.cb.is-authenticated #safety-badge {
    display: none !important;
}
html body.cb.is-guest .cb-pillnav,
html body.cb:not(.is-authenticated) .cb-pillnav,
html body.cb.is-guest #dropdown-tools,
html body.cb:not(.is-authenticated) #dropdown-tools,
html body.cb.is-guest #cb-btn-detail,
html body.cb:not(.is-authenticated) #cb-btn-detail,
html body.cb.is-guest #cb-page-actions button[onclick*="exportExcelReport"],
html body.cb:not(.is-authenticated) #cb-page-actions button[onclick*="exportExcelReport"],
html body.cb.is-guest .cb-kpi-link,
html body.cb:not(.is-authenticated) .cb-kpi-link {
    display: none !important;
}
html body #mcp-chat-box .chat-widget-header {
    flex: 0 0 auto !important;
    background: rgba(30, 41, 59, 0.7) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 12px 16px !important;
}
html body #mcp-chat-box .chat-quick-prompts {
    flex: 0 0 auto !important;
    background: rgba(15, 23, 42, 0.85) !important;
}
html body #mcp-chat-box #chat-pinned-disclaimer {
    flex: 0 0 auto !important;
}
html body #mcp-chat-box #chat-messages {
    flex: 1 1 0px !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: rgba(11, 17, 30, 0.96) !important;
}
html body #mcp-chat-box #chat-typing-indicator {
    flex: 0 0 auto !important;
}
html body #mcp-chat-box #chat-image-preview-bar {
    flex: 0 0 auto !important;
}
html body #mcp-chat-box .chat-widget-footer {
    flex: 0 0 auto !important;
    margin-top: auto !important;
    background: rgba(15, 23, 42, 0.98) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 10px 12px !important;
}

/* Wide screen docking when Cockpit Inspector is active (>= 1440px) */
@media (min-width: 1440px) {
    html body.inspector-active #mcp-chat-box:not(.ai-chat-expanded),
    html body:has(#cockpit-docked-inspector:not(.hidden-inspector):not(.minimized-by-chat)) #mcp-chat-box:not(.ai-chat-expanded) {
        right: calc(var(--inspector-w, 400px) + 36px) !important;
        left: auto !important;
    }
}

/* Expanded Fullscreen Studio mode */
html body #mcp-chat-box.ai-chat-expanded {
    top: 25px !important;
    bottom: 25px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: min(1320px, 94vw) !important;
    max-width: 94vw !important;
    height: calc(100vh - 50px) !important;
    max-height: calc(100vh - 50px) !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.9), 0 0 50px rgba(168, 85, 247, 0.35) !important;
    z-index: 10006 !important;
}

/* Mobile responsive mode (<= 767px) for AI Chat */
@media (max-width: 767px) {
    html body #mcp-chat-box:not(.ai-chat-expanded) {
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        z-index: 10020 !important;
    }
    html body #mcp-chat-box .chat-widget-footer {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ---------- COCKPIT VIEW SWITCH: RADAR VS TỔNG QUAN (KHẮC PHỤC CHỒNG CHÉO & BỊ ĐẨY XUỐNG DƯỚI) ---------- */
html body.cb[data-cb-cockpit-view="overview"] #cockpit-split-layout,
html body.cb[data-cb-cockpit-view="overview"] .cockpit-split-layout,
html body.cb .cockpit-split-layout.is-hidden-view,
html body.cb .cockpit-split-layout[hidden],
html body.cb #cockpit-split-layout[hidden] {
    display: none !important;
}

html body.cb[data-cb-cockpit-view="overview"] #cb-overview:not([hidden]),
html body.cb #cb-overview:not([hidden]):not(.is-hidden-view) {
    display: grid !important;
}

html body.cb[data-cb-cockpit-view="radar"] #cb-overview,
html body.cb #cb-overview[hidden],
html body.cb #cb-overview.is-hidden-view {
    display: none !important;
}

@media (min-width: 1024px) {
    html body.cb:not([data-cb-cockpit-view="overview"]) .cockpit-split-layout:not(.is-hidden-view):not([hidden]) {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 16px !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    html body.cb .cockpit-main-col {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    html body.cb .cockpit-docked-inspector:not(.hidden-inspector) {
        position: sticky !important;
        top: calc(var(--header-h, 60px) + 12px) !important;
        right: auto !important;
        bottom: auto !important;
        width: min(390px, 34vw) !important;
        flex: 0 0 min(390px, 34vw) !important;
        max-height: calc(100vh - var(--header-h, 60px) - 24px) !important;
        overflow: hidden !important;
        z-index: 20 !important;
        box-shadow: inset 0 0 0 1px var(--rim), var(--shadow) !important;
    }
    html body.cb .cockpit-docked-inspector.hidden-inspector,
    html body.cb .cockpit-docked-inspector[hidden] {
        display: none !important;
        width: 0 !important;
        flex: 0 0 0% !important;
    }
}

/* ---------- HIỆU SUẤT P&L & EQUITY CURVE: CHỐNG CHỒNG CHÉO VỚI DOCKED INSPECTOR ---------- */
html body.cb .performance-dashboard-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
}

html body.cb .perf-grid-two-col {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 16px !important;
    min-width: 0 !important;
    width: 100% !important;
}

html body.cb .perf-panel-card {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

html body.cb .equity-chart-viewport {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

html body.cb #sub-equity-canvas,
html body.cb #equity-canvas {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

/* Khi Inspector đang mở hoặc màn hình <= 1400px: xếp dọc Lịch Heatmap & Đường Vốn để không bị ép tràn sang Inspector */
@media (max-width: 1400px) {
    html body.cb .perf-grid-two-col {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

html body.cb.inspector-active .perf-grid-two-col,
html body.cb:has(#cockpit-docked-inspector:not(.hidden-inspector)) .perf-grid-two-col {
    grid-template-columns: minmax(0, 1fr) !important;
}
html body .cc-btn-danger, html body #subpane-settings-capital button { border-radius: 999px; }
html body [style*="background: var(--accent)"], html body [style*="background:var(--accent)"] { background: var(--pill) !important; color: var(--on-pill) !important; }
html body .modal-box[style], html body .modal-dialog[style], html body .modal-box, html body .modal-dialog { border-radius: 26px !important; }
html body .modal-backdrop[style*="rgba(0"], html body .modal-backdrop[style*="rgba(0,"] { background: #0e182047 !important; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
:root[data-theme="dark"] html body .modal-backdrop[style*="rgba(0"], html:root[data-theme="dark"] body .modal-backdrop[style*="rgba(0"] { background: #00000094 !important; }
html body .modal-box h3[style] i[style*="#A855F7"], html body .modal-box h3[style] i[style*="#a855f7"] { color: var(--muted) !important; }
html body #modal-settings .modal-box, html body #modal-ai-tier-ladder .modal-box { padding: 24px !important; }   /* style.css đặt .modal-box{padding:0 !important} làm mất padding nội tuyến của 2 modal này */
html body .mode-switch button, html body .mode-switch button.active { color: var(--muted) !important; }
html body .mode-switch button.active { color: var(--text) !important; }
body button[onclick*="triggerKillSwitch"]:not(.btn-header-kill) { border-radius: 999px; }
body .rd-docked-inspector { top: calc(var(--header-h) + 10px); border-radius: var(--r); }
body .cockpit-docked-inspector { top: calc(var(--header-h) + 10px); }
/* R&D: thẻ insight + chú giải telemetry (IS nét liền / OOS nét đứt, đơn sắc) */
body .rd-insight-card { background: var(--glass); border: 0; box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); border-radius: var(--r); padding: 16px 18px; }
body .rd-insight-title { font: 600 var(--fs-lg)/1.2 var(--display); letter-spacing: -.005em; text-transform: none; color: var(--text); }
body .rd-insight-sub { font-size: var(--fs-sm); color: var(--muted); }
body .rd-telemetry-legend .lg { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--text); vertical-align: middle; margin-right: 6px; background: transparent; border-radius: 0; }
body .rd-telemetry-legend .lg-violet { border-top: 2px dashed var(--faint); }
body .rd-guard-row .rd-insight-title { font: 700 var(--fs-2xs)/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
body .rd-signal { border-radius: var(--r-sm); background: var(--well); border: 0; }
body .rd-decision-log li { border-bottom: 1px solid var(--line); }
/* nút tài khoản: auth.js ghi đè className + nhãn là <span> trần */
html body .top-header #btn-header-auth-status, html body .top-header .auth-capsule-admin, html body .top-header .auth-capsule-trader, html body .top-header .auth-capsule-member, html body .top-header .auth-capsule-guest {
    background: var(--glass-2) !important; border: 0 !important; box-shadow: inset 0 0 0 1px var(--rim) !important; color: var(--text) !important; height: 40px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; width: auto;
}
html body .top-header #btn-header-auth-status i { color: var(--muted) !important; }
html body .top-header #btn-header-auth-status i.text-up { color: var(--up) !important; }
/* chip trạng thái "Live • N vị thế": luật cũ ẩn ở ≤1400px; giữ lại (gọn dần) vì còn mở popover thị trường */
@media (max-width: 1400px) { html body .header-system #dropdown-status { display: block !important; } }
@media (max-width: 767px) { html body .header-system #dropdown-status { display: none !important; } }

/* ---------- 19. RESPONSIVE ---------- */
#cb-hdr-search { display: none; }
@media (max-width: 1500px) {
    .top-header #btn-header-kill { width: 40px; padding: 0; justify-content: center; }
    .top-header #btn-header-kill .tool-label { display: none; }
}
@media (max-width: 1600px) {
    .top-header .cb-pillnav .menu-item, .cb-pillnav__pill > span { padding: 0 13px; }
    html body.cb .top-header { gap: 12px; }
    .top-header #status-btn-summary .drop-btn-badge, .top-header #btn-header-auth-status .tool-label { display: none; }
}
@media (max-width: 1720px) { .cb-pillnav .badge-count { display: none; } }
@media (max-width: 1500px) {
    .top-header .cb-pillnav .menu-item, .cb-pillnav__pill > span { padding: 0 14px; }
}
@media (max-width: 1280px) {
    .top-header #btn-header-auth-status .auth-display-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cb-kpis { gap: 12px; }
    .cb-kpi { padding: 16px 16px 12px; }
    .cb-kpi-val { font-size: 22px; padding-right: 60px; }
    .cb-kpi-meta { padding-right: 60px; }
    .cb-kpi-viz { right: 14px; transform: scale(.88); transform-origin: right center; }
}
@media (max-width: 1100px) {
    html body.cb { --dock-x: 0px; --dock-w: 0px; --dock-gutter: var(--gut); --cb-padx: var(--gut); --tabbar-h: 0px; }
    #app-sidebar.cb-dock { display: none !important; }
    html body.cb .top-header { padding: 14px var(--gut) 4px; gap: 10px; flex-wrap: wrap; }
    #cb-hdr-search { display: inline-grid; }
    #btn-header-theme-toggle { display: inline-grid !important; }
    #btn-header-theme-toggle .tool-label { display: none; }
    .top-header #status-summary-text { display: none; }
    .top-header #status-btn-summary { padding: 0 13px; }
    .cb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cb-kpi-val { font-size: 24px; padding-right: 72px; }
    .cb-kpi-meta { padding-right: 72px; }
    .cb-kpi-viz { transform: none; right: 18px; }
    html body.cb .workspace-body { padding-left: var(--gut); padding-right: var(--gut); }
    .cb-pillnav { order: 5; flex: 1 1 100%; margin-left: 0; }
    .cb-pillnav { max-width: 100%; }
    .top-header .header-financial { margin-left: auto; }
}
@media (max-width: 900px) { .top-header #dropdown-tools { display: none; } }
@media (max-width: 767px) {
    html body.cb { --header-h: 58px; --m-nav-h: 74px; --gut: 14px; --tabbar-h: calc(74px + env(safe-area-inset-bottom, 0px)); }
    html body.cb .top-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        padding: 10px 14px 4px !important;
        gap: 8px !important;
        overflow: hidden !important;
    }
    .cb-brand {
        flex: 0 0 auto !important;
        margin-right: auto !important;
        min-width: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    .cb-logo {
        width: 36px !important;
        height: 36px !important;
        border-radius: 11px !important;
        flex: 0 0 36px !important;
    }
    .cb-logo svg {
        width: 20px !important;
        height: 20px !important;
    }
    .cb-brand-text { display: none !important; }
    .cb-pillnav { display: none !important; }
    .top-header .header-financial { display: none !important; }
    .top-header #btn-header-ai-chat,
    .top-header #btn-header-mcp-status,
    .top-header #btn-header-theme-toggle,
    .top-header #btn-header-kill,
    .top-header #safety-badge,
    .top-header #cb-hdr-search { display: none !important; }
    .top-header .header-system {
        margin-left: auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }
    .top-header #btn-header-auth-status {
        height: 36px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }
    .top-header #btn-header-auth-status .auth-display-name {
        max-width: 85px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    .top-header #btn-header-logout {
        height: 36px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }
    .top-header #btn-header-logout .tool-label {
        display: none !important;
    }
    #dropdown-status, #dropdown-tools { display: none !important; }
    html body.cb .workspace-body { padding: 6px 14px 28px !important; }
    .cb-page-head { margin: 4px 0 14px; gap: 10px; }
    .cb-page-head h1 { font-size: 28px; }
    .cb-ph-row2 { display: contents; }
    .cb-seg { flex: 0 0 auto; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .cb-ph-right { display: none; }
    .cb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .cb-kpi { min-height: 120px; padding: 14px 14px 10px; }
    .cb-kpi-val { font-size: 20px; padding-right: 0; }
    .cb-kpi-meta { padding-right: 0; }
    .cb-kpi-sub { display: none; }
    .cb-kpi-viz { display: none; }
    .cb-kpi-link { font-size: var(--fs-xs); }
    /* thanh điều hướng dưới: viên thuốc nổi giống dock */
    .m-bottomnav {
        left: 0 !important; right: 0 !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important; height: auto !important; width: fit-content; max-width: calc(100vw - 24px); margin: 0 auto; padding: 6px !important; border: 0 !important;
        border-radius: 999px !important; background: var(--dock) !important; box-shadow: 0 20px 40px -18px #0a141e80; gap: 0 !important;
    }
    :root[data-theme="dark"] .m-bottomnav { -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: inset 0 0 0 1px var(--line), 0 20px 40px -18px #0009; }
    .m-bottomnav button { color: var(--on-dock) !important; opacity: .74; border-radius: 999px; font-family: var(--font); font-size: 10px !important; font-weight: 600; letter-spacing: 0 !important; text-transform: none !important; gap: 3px !important; min-width: 58px; padding: 7px 8px !important; position: relative; transition: opacity .2s, background-color .2s; }
    .m-bottomnav button[aria-current="page"] { opacity: 1; background: #ffffff21; color: var(--on-dock) !important; }
    .m-bottomnav button[aria-current="page"]::before { display: none !important; }
    .app-main { padding-bottom: calc(var(--m-nav-h) + env(safe-area-inset-bottom, 0px) + 16px) !important; }
    #floating-ai-copilot-btn { bottom: calc(var(--m-nav-h) + 26px + env(safe-area-inset-bottom, 0px)) !important; }
    body .modal-box, body .modal-box-lg, body .modal-box-xl, body .modal-box-xxl { border-radius: 26px 26px 0 0 !important; }
    body .workspace-subnav-bar, body .quant-subnav-bar { max-width: 100%; }
    body .risk-kpi-ribbon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    body .risk-kpi-tile { min-height: 104px; padding: 12px 13px; border-radius: 18px; }
    body .risk-kpi-hero-val { font-size: 19px; }
    body .risk-kpi-tile-header { font-size: var(--fs-xs); gap: 6px; }
    body .var-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    body .var-metric-val { font-size: 18px; }
    body .panel-header { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; padding: 14px 14px 8px; }
    body .panel-header > div:last-child:not(.panel-title-wrap) { width: 100%; flex-wrap: wrap; }
    body .panel-title { font-size: var(--fs-lg); }
    body .rd-insights { gap: 10px; }
    html body .modal-box, html body .modal-dialog { border-radius: 26px 26px 0 0 !important; }
}
@media (max-width: 420px) {
    .cb-kpi-val { font-size: 18px; }
    body .risk-kpi-hero-val { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
    .mesh i { will-change: auto; }
    .cb-live__dot:after { animation: none; }
    .cb-switch__knob { transition: none; }
}
@media (hover: none) {
    .top-header .cb-pillnav .menu-item:hover, body .data-table tbody tr:hover td { background: transparent; }
    #app-sidebar.cb-dock .cb-dock-btn:hover:not(.active) { opacity: .74; background: transparent !important; }
    #app-sidebar.cb-dock .cb-dock-btn:hover::after { opacity: 0; }
}

/* ---------- 20. GHI ĐÈ "VÁ CHẾ ĐỘ SÁNG" CŨ (style.css có ~290 luật body.theme-light … !important dùng màu cố định) ---------- */
html body.cb .top-header, html body.cb.theme-light .top-header, html body.cb.theme-light .app-header { background: transparent !important; border-bottom: 0 !important; box-shadow: none !important; }
html body.cb.theme-light .app-main, html body.cb.theme-light .workspace-body, html body.cb .app-main, html body.cb .workspace-body { background: transparent !important; }
html body.cb.theme-light .btn-header-tool, html body.cb.theme-light .compact-drop-btn { background: var(--glass-2) !important; border: 0 !important; box-shadow: inset 0 0 0 1px var(--rim) !important; color: var(--text) !important; }
html body.cb.theme-light .btn-header-tool:hover, html body.cb.theme-light .compact-drop-btn:hover { background: var(--glass-3) !important; }
html body.cb.theme-light .dropdown-popover, html body.cb.theme-light .popover { background: var(--float) !important; border: 0 !important; box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line) !important; }
html body.cb.theme-light .modal-box, html body.cb.theme-light .modal-dialog, html body.cb.theme-light .modal-content { background: var(--float) !important; border: 0 !important; box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line) !important; color: var(--text) !important; }
/* ô nhấn của thẻ KPI: đặc hiệu cao hơn .cb-kpi để thắng nền kính */
html body.cb .cb-kpi.tile--sky { background: var(--sky); } html body.cb .cb-kpi.tile--mint { background: var(--mint); }
html body.cb .cb-kpi.tile--lemon { background: var(--lemon); } html body.cb .cb-kpi.tile--coral { background: var(--coral); }
:root[data-palette="mono"]:not([data-theme="dark"]) body.cb .cb-kpi.tile--sky { background: var(--ocean); }
html body.cb .cb-kpi[class*="tile--"] { box-shadow: none; }
/* thanh tab con dính mép trên khi cuộn trang dài (R&D, Danh mục) */
/* thanh tab con dính mép dưới top header khi cuộn trang dài (Lỗi 4) */
html body.cb .quant-subnav-bar, html body.cb .workspace-subnav-bar {
    position: sticky;
    top: calc(var(--header-h, 60px) + 8px);
    z-index: 15;
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

/* Nút Đăng xuất Header (Lỗi 2) */
.top-header #btn-header-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--glass-2) !important;
    border: 0 !important;
    box-shadow: inset 0 0 0 1px var(--rim) !important;
    color: var(--text) !important;
    cursor: pointer;
    font: 600 var(--fs-md)/1 var(--font);
    transition: all .2s ease;
}
.top-header #btn-header-logout:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    color: var(--coral, #ef4444) !important;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.35) !important;
}

/* ---------- 21. CÔNG TẮC (switch) kiểu Corbel cho các ô bật/tắt cũ ---------- */
html body.cb .switch, html body.cb .switch-toggle { width: 40px; height: 24px; flex-shrink: 0; }
html body.cb .slider, html body.cb .slider.round { background-color: var(--line-2) !important; border: 0 !important; box-shadow: none !important; border-radius: 99px; transition: background-color .25s; }
html body.cb .slider:before, html body.cb .slider.round:before { width: 18px; height: 18px; left: 3px; top: 3px; bottom: auto; background-color: #fff !important; box-shadow: 0 1px 3px #00000040; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }
html body.cb .switch input:checked + .slider, html body.cb .switch-toggle input:checked + .slider { background-color: var(--c3) !important; border: 0 !important; box-shadow: none !important; }
html body.cb .switch input:checked + .slider:before, html body.cb .switch-toggle input:checked + .slider:before { transform: translateX(16px); background-color: #fff !important; }
html body.cb .switch input:focus-visible + .slider, html body.cb .switch-toggle input:focus-visible + .slider { outline: 2px solid var(--text); outline-offset: 2px; }

/* ---------- 22. THANH TAB CẤP 2 (R&D · Sổ tay) → cùng kiểu thanh tab con kính ---------- */
html body.cb .rd-subtabs-bar, html body.cb .guide-nav-tabs, html body.cb .workspace-pill-nav { display: inline-flex; align-items: center; gap: 0; background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); border: 0 !important; border-radius: 999px; padding: 0; margin: 0 0 14px; max-width: 100%; overflow-x: auto; scrollbar-width: none; position: relative; }
html body.cb .rd-subtabs-bar::-webkit-scrollbar, html body.cb .guide-nav-tabs::-webkit-scrollbar, html body.cb .workspace-pill-nav::-webkit-scrollbar { display: none; }
html body.cb .rd-subtabs-bar button, html body.cb .guide-tab-btn, html body.cb .workspace-pill-btn { position: relative; z-index: 1; height: 34px; padding: 0 14px; border: 0 !important; border-radius: 999px; background: transparent !important; color: var(--muted) !important; font: 600 var(--fs-sm)/1 var(--font); letter-spacing: 0; text-transform: none; box-shadow: none !important; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; transition: color .2s; }
html body.cb .rd-subtabs-bar button:hover, html body.cb .guide-tab-btn:hover, html body.cb .workspace-pill-btn:hover { color: var(--text) !important; }
html body.cb .rd-subtabs-bar button.active, html body.cb .guide-tab-btn.active, html body.cb .workspace-pill-btn.active { color: var(--text) !important; }
html body.cb:not(.cb-fx) .rd-subtabs-bar button.active, html body.cb:not(.cb-fx) .guide-tab-btn.active, html body.cb:not(.cb-fx) .workspace-pill-btn.active { background: var(--glass-3) !important; }
html body.cb .rd-subtabs-bar button.active::after, html body.cb .guide-tab-btn.active::after, html body.cb .workspace-pill-btn.active::after, html body.cb .workspace-pill-btn::before { display: none; }
.cb-set-row > span { white-space: nowrap; }
@media (max-width: 560px) { .db-col:nth-of-type(2n) .db-col__x { visibility: hidden; } .db-col:last-of-type .db-col__x { visibility: visible; } }

/* ---------- 23. PHÂN TÍCH MÃ + HỒ SƠ BCTC (module cũ dùng nền tối cố định) → kính Corbel ---------- */
html body.cb .symbol-workspace-view { background: transparent !important; }
html body.cb :is(.workspace-hero-card, .workspace-chart-panel, .workspace-detail-panel, .detail-section-card) { background: var(--glass) !important; box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); border: 0 !important; border-radius: var(--r); color: var(--text); }
html body.cb .detail-section-card { border-radius: var(--r-sm); background: var(--glass-2) !important; }
html body.cb .symbol-dossier-wrapper { background: transparent; color: var(--text); font-family: var(--font); padding: 0; }
html body.cb .symbol-dossier-wrapper .dossier-header-bar, html body.cb .symbol-dossier-wrapper .dossier-card-panel { background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim), var(--shadow); border: 0; border-radius: var(--r); color: var(--text); }
html body.cb .symbol-dossier-wrapper .dossier-ticker-heading { color: var(--text); font-family: var(--font); letter-spacing: -.02em; font-weight: 700; }
html body.cb .symbol-dossier-wrapper .dossier-table { font-family: var(--font); font-size: var(--fs-sm); }
html body.cb .symbol-dossier-wrapper .dossier-table th { background: var(--surface-2); color: var(--muted); border-bottom: 1px solid var(--line); }
html body.cb .symbol-dossier-wrapper .dossier-table td { color: var(--text); border-bottom: 1px solid var(--line); }
html body.cb .symbol-dossier-wrapper .dossier-cell-newest { background: var(--primary-soft); color: var(--primary-ink) !important; }
html body.cb .symbol-dossier-wrapper [style*="color:#F8FAFC"], html body.cb .symbol-dossier-wrapper [style*="color: #F8FAFC"], html body.cb .symbol-dossier-wrapper [style*="color:#FFFFFF"], html body.cb .symbol-dossier-wrapper [style*="color: #fff"] { color: var(--text) !important; }
html body.cb .symbol-dossier-wrapper [style*="#94A3B8"], html body.cb .symbol-dossier-wrapper [style*="#94a3b8"] { color: var(--muted) !important; }

/* liên kết "bỏ qua điều hướng" cho bàn phím / trình đọc màn hình */
.skip { z-index: 100000; background: var(--pill); color: var(--on-pill); border-radius: 999px; padding: 10px 16px; font-weight: 600; position: fixed; top: -60px; left: 12px; }
.skip:focus { top: 12px; }
#cb-main:focus { outline: none; }
/* dự phòng khi không có GSAP: mục đang chọn tô thẳng bằng nền mực (thay cho viên mực trượt) */
html body.cb:not(.cb-fx) .top-header .cb-pillnav .menu-item.active, html body.cb:not(.cb-fx) .top-header .cb-pillnav .menu-item.active:hover { background: var(--pill); color: var(--on-pill); }
html body.cb:not(.cb-fx) .settings-nav-item.active { background: var(--glass-3); }

/* ---------- 24. CẢM ỨNG: vùng bấm ≥ 44px, ô nhập 16px (tránh iOS tự phóng to khi chạm) ---------- */
@media (pointer: coarse) {
    html body.cb .cb-btn, html body.cb .btn-primary, html body.cb .btn-secondary, html body.cb .btn-header-tool, html body.cb .compact-drop-btn { min-height: 44px; }
    html body.cb .top-header .cb-pillnav .menu-item, html body.cb .cb-pillnav__pill > span { height: 44px; }
    .cb-seg button { min-height: 40px; } .cb-seg--sm button { min-height: 34px; }
    html body.cb .ws-subnav-btn, html body.cb .rd-subtabs-bar button, html body.cb .guide-tab-btn, html body.cb .workspace-pill-btn { min-height: 40px; }
    .db-legend button { min-height: 38px; } .pal__opt { min-height: 48px; }
    .cb-switch input { inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); }
}
@media (pointer: coarse), (max-width: 720px) {
    html body.cb input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), html body.cb select, html body.cb textarea { font-size: 16px !important; }
}