/* ==========================================================================
   TPS iTrade × AI Copilot — "Không gian tài khoản" (Obsidian Dark)
   --------------------------------------------------------------------------
   Canvas obsidian #03080A · card kính mờ rgba(10,15,20,.86) · chữ #FCFCFE ·
   nhấn orchid #A86BD1. Lớp không gian 3D (#ws-atmos) nằm dưới #view-root nên
   sao/tinh vân chỉ lộ nhẹ qua khe bố cục và bề mặt bán trong suốt.
   Màu chứng khoán VN giữ ngữ nghĩa: tăng #25D38A · giảm #FF6B6B ·
   tham chiếu #F2C94C · trần #D982FF · sàn #38D9E8.
   Token --tps-* là hợp đồng với các module màn hình và khung chat:
   đổi giá trị là đổi theme, không cần sửa module.
   Sở hữu: shell / danh mục. Không chứa CSS nội bộ của chat.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* ---- Bề mặt: obsidian black; surface trong mờ để lớp 3D lộ nhẹ ---- */
  --tps-bg: #03080A;
  --tps-bg-2: #070C10;
  --tps-surface: rgba(10, 15, 20, 0.86);
  --tps-surface-2: rgba(15, 22, 29, 0.90);
  --tps-surface-3: rgba(21, 30, 40, 0.92);

  --tps-border: rgba(252, 252, 254, 0.09);
  --tps-border-soft: rgba(252, 252, 254, 0.055);

  --tps-text: #FCFCFE;
  --tps-text-2: #CFD5DE;
  --tps-muted: #8E95A2;

  /* ---- Giá / trạng thái thị trường (tương phản ≥ 4.5:1 trên #070C10) ---- */
  --tps-up: #25D38A;
  --tps-down: #FF6B6B;
  --tps-ref: #F2C94C;
  --tps-ceiling: #D982FF;
  --tps-floor: #38D9E8;

  /* ---- Trạng thái nghiệp vụ ---- */
  --tps-ok: #25D38A;
  --tps-warn: #F2C94C;
  --tps-info: #58B4FF;

  /* ---- Nhấn orchid (nhận diện TPS, tách hẳn khỏi xanh/tăng giá) ---- */
  --tps-accent: #A86BD1;
  --tps-accent-deep: #7B3FA3;
  --tps-accent-soft: rgba(168, 107, 209, 0.14);
  --tps-accent-line: rgba(168, 107, 209, 0.36);
  --tps-orange: #A86BD1;
  --tps-orange-line: rgba(168, 107, 209, .4);
  --tps-orange-soft: rgba(168, 107, 209, .12);
  --tps-violet: #BC8AE0;
  --tps-violet-soft: rgba(188, 138, 224, .14);
  --tps-purple-deep: #7B3FA3;

  --tps-radius: 10px;
  --tps-radius-sm: 8px;
  --tps-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 22px 48px rgba(0, 0, 0, .45);
  --tps-shadow-soft: 0 1px 2px rgba(0, 0, 0, .40), 0 10px 26px rgba(0, 0, 0, .32);
  --tps-blur: blur(8px);

  --tps-font: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tps-font-num: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", "Segoe UI Mono", monospace;

  --it-copilot-w: 384px;
  --it-head-h: 62px;
}

/* ==========================================================================
   0. NỀN TẢNG
   ========================================================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--tps-bg);
  color: var(--tps-text);
  font-family: var(--tps-font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.it-app, body.tps-app {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

::selection { background: rgba(168, 107, 209, .26); color: var(--tps-text); }

:focus-visible {
  outline: 2px solid rgba(168, 107, 209, .65);
  outline-offset: 2px;
}

html { scrollbar-width: thin; scrollbar-color: rgba(207, 213, 222, .22) transparent; }

a { color: var(--tps-accent); }
button, input, select, textarea { font-family: inherit; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ==========================================================================
   1. HEADER — brand · nav ngang · tiểu khoản · tài khoản
   ========================================================================== */
.app-head {
  position: relative;
  z-index: 60;
  flex: 0 0 auto;
  background: rgba(3, 8, 10, .82);
  border-bottom: 1px solid var(--tps-border);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

.app-head__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--it-head-h);
  padding: 0 24px;
  max-width: 1680px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--tps-text);
}

.brand__mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(142deg, #B87FE0 0%, #A86BD1 46%, #7B3FA3 100%);
  color: #FCFCFE;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.3px;
  box-shadow: 0 6px 18px rgba(123, 63, 163, .38);
}

.brand__name { display: flex; flex-direction: column; line-height: 1.08; }
.brand__name b { font-size: 14.5px; font-weight: 750; letter-spacing: .1px; }
.brand__name i {
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--tps-muted);
}

/* ---- Nav ngang ---- */
.mainnav { display: flex; align-items: center; gap: 2px; min-width: 0; }

.mainnav > a,
.mainnav__group > button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--tps-text-2);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.mainnav > a:hover,
.mainnav__group > button:hover {
  background: rgba(252, 252, 254, .06);
  color: var(--tps-text);
}

.mainnav > a.is-active,
.mainnav__group.is-active > button,
.mainnav__group.is-open > button {
  background: rgba(168, 107, 209, .12);
  color: var(--tps-text);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 0 var(--tps-accent);
}

.mainnav__caret {
  width: 0; height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid currentColor;
  opacity: .65;
  transition: transform .15s;
}
.mainnav__group.is-open .mainnav__caret { transform: rotate(180deg); }

.mainnav__group { position: relative; }

.mainnav__menu {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  min-width: 228px;
  padding: 6px;
  background: #080C11;
  border: 1px solid var(--tps-border);
  border-radius: 10px;
  box-shadow: 0 24px 52px rgba(0, 0, 0, .66);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}

.mainnav__group.is-open .mainnav__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mainnav__menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--tps-text-2);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
}
.mainnav__menu a:hover { background: var(--tps-surface-2); color: var(--tps-text); }
.mainnav__menu a.is-active { background: var(--tps-accent-soft); color: var(--tps-accent); font-weight: 650; }
.mainnav__menu small { color: var(--tps-muted); font-size: 10.5px; }

/* ---- Bên phải header ---- */
.app-head__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.it-search {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 178px;
  height: 34px;
  padding: 0 11px;
  background: rgba(252, 252, 254, .05);
  border: 1px solid var(--tps-border-soft);
  border-radius: 8px;
  color: var(--tps-muted);
  transition: border-color .15s, background .15s;
}
.it-search:focus-within {
  background: rgba(252, 252, 254, .07);
  border-color: var(--tps-accent-line);
  box-shadow: 0 0 0 3px rgba(168, 107, 209, .18);
}
.it-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--tps-text);
  font-size: 12.5px;
}
.it-search input::placeholder { color: rgba(207, 213, 222, .42); }

.it-subacc { display: flex; align-items: center; gap: 7px; min-width: 0; }
.it-subacc label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--tps-muted);
  white-space: nowrap;
}
.it-select {
  appearance: none;
  height: 34px;
  max-width: 206px;
  padding: 0 28px 0 11px;
  border: 1px solid var(--tps-border);
  border-radius: 9px;
  background: var(--tps-surface)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='6'><path d='M0 0l4.5 6 4.5-6z' fill='%238E95A2'/></svg>")
    no-repeat right 10px center;
  color: var(--tps-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.it-select:focus { border-color: var(--tps-accent-line); box-shadow: 0 0 0 3px rgba(168, 107, 209, .16); }

/* ---- Nút tài khoản + popover ---- */
.accountbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 3px 9px 3px 3px;
  border: 1px solid var(--tps-border);
  border-radius: 999px;
  background: rgba(252, 252, 254, .045);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-width: 0;
  overflow: hidden;
}
.accountbtn:hover { border-color: rgba(168, 107, 209, .36); background: var(--tps-surface-2); }

.accountbtn__avatar {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(142deg, #B87FE0 0%, #7B3FA3 100%);
  color: #FCFCFE;
  font-size: 11.5px;
  font-weight: 800;
}
.accountbtn__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  padding-right: 5px;
}
.accountbtn__name {
  display: block;
  max-width: 136px;
  padding-right: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1px;
}
.accountbtn__id {
  font-family: var(--tps-font-num);
  font-size: 9.5px;
  color: var(--tps-muted);
  letter-spacing: .2px;
}
.accountbtn__caret { flex: 0 0 auto; color: var(--tps-muted); font-size: 10px; line-height: 1; margin-right: 2px; }

.acct-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 24px;
  z-index: 80;
  width: 380px;
  max-width: calc(100vw - 24px);
  padding: 8px;
  background: #080C11;
  border: 1px solid var(--tps-border);
  border-radius: 12px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, .68);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity .16s, transform .16s, visibility .16s;
}
.acct-pop.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

.acct-pop__head { display: flex; align-items: center; gap: 11px; padding: 12px 12px 13px; }
.acct-pop__avatar {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(142deg, #B87FE0 0%, #7B3FA3 100%);
  color: #FCFCFE;
  font-weight: 800;
  font-size: 14px;
}
.acct-pop__id { min-width: 0; }
.acct-pop__id b { display: block; font-size: 13.5px; letter-spacing: .1px; }
.acct-pop__id span {
  display: block;
  margin-top: 1px;
  font-family: var(--tps-font-num);
  font-size: 11px;
  color: var(--tps-muted);
}
.acct-pop__state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 650;
  color: var(--tps-ok);
  white-space: nowrap;
}
.acct-pop__state::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.acct-pop__rows {
  margin: 0 8px;
  padding: 10px 4px;
  border-top: 1px solid var(--tps-border-soft);
  border-bottom: 1px solid var(--tps-border-soft);
  display: grid;
  gap: 8px;
}
.acct-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
  color: var(--tps-muted);
}
.acct-row b {
  color: var(--tps-text);
  font-family: var(--tps-font-num);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}
.acct-row b.is-warn { color: var(--tps-warn); }

.acct-pop__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
}
.acct-pop__links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--tps-text-2);
  font-size: 12px;
  text-decoration: none;
}
.acct-pop__links a:hover { background: var(--tps-surface-2); color: var(--tps-text); }
.acct-pop__links a span { color: var(--tps-muted); font-size: 11px; }

.acct-pop__tools {
  margin: 0 8px 4px;
  padding: 9px 10px 6px;
  border-radius: 10px;
  background: var(--tps-surface-2);
}
.acct-pop__tools-label {
  display: block;
  margin-bottom: 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--tps-muted);
}
.acct-pop .it-toolbar__right { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.it-iconbtn {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  color: var(--tps-text-2);
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  border-radius: 9px;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .15s, color .15s, border-color .15s;
}
.it-iconbtn:hover { background: var(--tps-surface-2); color: var(--tps-text); }
.it-iconbtn.is-on { color: var(--tps-accent); border-color: var(--tps-accent-line); background: var(--tps-accent-soft); }

#btn-ai-rail {
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--tps-accent-line);
  border-radius: 999px;
  background: var(--tps-accent-soft);
  color: var(--tps-accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
#btn-ai-rail:hover { background: rgba(168, 107, 209, .26); }

#btn-mainnav {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--tps-border);
  border-radius: 10px;
  background: var(--tps-surface);
  color: var(--tps-text);
  cursor: pointer;
}

/* ==========================================================================
   2. WORKSPACE
   ========================================================================== */
.it-workspace, .tps-main {
  position: relative;
  isolation: isolate;
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
  background: #03080A;
}

/* Lớp không gian 3D: phủ kín workspace, nằm dưới nội dung, không nhận chuột */
.ws-atmos {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
}
.ws-atmos > canvas,
.ws-atmos > svg {
  display: block;
  width: 100%;
  height: 100%;
}
/* Fallback CSS (khi WebGL chưa dựng): tinh vân orchid rất nhẹ để nền không phẳng */
.ws-atmos::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(46% 40% at 12% 6%, rgba(168, 107, 209, .16), transparent 72%),
    radial-gradient(42% 36% at 90% 14%, rgba(88, 180, 255, .10), transparent 74%),
    radial-gradient(64% 52% at 46% 112%, rgba(123, 63, 163, .16), transparent 72%);
}
.ws-atmos::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image:
    radial-gradient(1.1px 1.1px at 14% 24%, rgba(252, 252, 254, .55), transparent 60%),
    radial-gradient(1px 1px at 32% 62%, rgba(217, 188, 236, .45), transparent 60%),
    radial-gradient(1.3px 1.3px at 58% 34%, rgba(252, 252, 254, .40), transparent 60%),
    radial-gradient(1px 1px at 72% 74%, rgba(140, 203, 255, .40), transparent 60%),
    radial-gradient(1.2px 1.2px at 88% 46%, rgba(252, 252, 254, .35), transparent 60%),
    radial-gradient(1px 1px at 46% 86%, rgba(217, 188, 236, .30), transparent 60%);
}

.it-viewport, .tps-viewport {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  padding: 26px 30px 64px;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(207, 213, 222, .22) transparent;
}
.it-viewport::-webkit-scrollbar, .tps-viewport::-webkit-scrollbar { width: 10px; height: 10px; }
.it-viewport::-webkit-scrollbar-thumb, .tps-viewport::-webkit-scrollbar-thumb {
  background: rgba(207, 213, 222, .22);
  border-radius: 6px;
  border: 2px solid var(--tps-bg);
}
.it-viewport::-webkit-scrollbar-track { background: transparent; }

#view-root > * {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Copilot dock desktop ---- */
.it-copilot, .tps-copilot {
  position: relative;
  z-index: 1;
  flex: 0 0 var(--it-copilot-w);
  width: var(--it-copilot-w);
  min-width: 340px;
  border-left: 1px solid var(--tps-border);
  background: rgba(4, 9, 12, .78);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  backdrop-filter: blur(12px) saturate(130%);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: -18px 0 40px rgba(0, 0, 0, .35);
  transition: width .2s ease, flex-basis .2s ease;
}
.it-copilot.is-collapsed { display: none; }

/* ---- Cột chat mở rộng (desktop): 384px ↔ 540px, có lưu trạng thái ---- */
.it-workspace.is-chat-wide,
.tps-main.is-chat-wide { --it-copilot-w: 540px; }
/* Trần mềm: trên laptop 1280px cột chat không nuốt quá 46% bề ngang, giữ cho
   vùng danh mục còn >= 700px để bảng mã không phải cuộn ngang. */
.it-workspace.is-chat-wide .it-copilot,
.tps-main.is-chat-wide .tps-copilot { max-width: 46vw; }

/* Nút mở/thu cột chat (thân nút do module chat tô; ở đây chỉ lo ẩn/hiện). */
@media (max-width: 1024px) {
  #ai-copilot-panel .cp-head__expand { display: none !important; }
}

/* Laptop 1181–1360px: cột chat rộng 540px sẽ ăn quá nửa màn hình, hạ còn 480px
   để vùng danh mục vẫn >= 700px. Từ 1361px trở lên giữ đúng 540px. */
@media (min-width: 1025px) and (max-width: 1360px) {
  .it-workspace.is-chat-wide,
  .tps-main.is-chat-wide { --it-copilot-w: 480px; }
}

/* Chat overlay và nút đóng do module chat tự dựng (hợp đồng .is-open/.is-collapsed). */

.it-workspace.is-split .it-copilot { flex: 1 1 50%; width: auto; min-width: 0; }
.it-workspace.is-split .it-viewport { flex: 1 1 50%; }
.tps-main.is-split .tps-copilot { flex: 1 1 50%; width: auto; min-width: 0; }
.tps-main.is-split .tps-viewport { flex: 1 1 50%; }

/* ==========================================================================
   3. THÀNH PHẦN DÙNG CHUNG
   ========================================================================== */
.tps-page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}
.tps-page-head__title {
  margin: 0;
  font-size: 25px;
  line-height: 1.22;
  font-weight: 750;
  letter-spacing: -.5px;
}
.tps-page-head__sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--tps-muted);
  line-height: 1.5;
}
.tps-page-head__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tps-sub { color: var(--tps-muted); font-size: 12px; line-height: 1.55; }

/* ---- Thẻ ---- */
.tps-card {
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  border-radius: 10px;
  box-shadow: var(--tps-shadow-soft);
  overflow: hidden;
}
.tps-card + .tps-card { margin-top: 16px; }

.tps-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--tps-surface);
  border-bottom: 1px solid var(--tps-border-soft);
}
.tps-card__title { font-size: 13px; font-weight: 700; letter-spacing: 0; color: var(--tps-text); }
.tps-card__head-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.tps-card__body { padding: 16px 18px; }
.tps-card__body--flush { padding: 0; }

.tps-grid { display: grid; gap: 14px; }
.tps-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tps-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tps-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---- Khối số liệu ---- */
.tps-stat {
  padding: 14px 15px;
  border: 1px solid var(--tps-border-soft);
  border-radius: 10px;
  background: var(--tps-surface-2);
}
.tps-stat__label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--tps-muted);
  letter-spacing: .55px;
  text-transform: uppercase;
}
.tps-stat__value {
  margin-top: 4px;
  font-family: var(--tps-font-num);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
  line-height: 1.2;
}
.tps-stat__note { margin-top: 4px; font-size: 10.5px; color: var(--tps-muted); }
.tps-stat--accent { border-color: var(--tps-accent-line); background: var(--tps-accent-soft); }
.tps-stat--warn { border-color: rgba(255, 107, 107, .30); background: rgba(255, 107, 107, .10); }

/* ---- Bảng ---- */
.tps-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tps-table th, .tps-table thead th {
  text-align: left;
  padding: 9px 14px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .55px;
  text-transform: uppercase;
  color: var(--tps-muted);
  background: var(--tps-surface-2);
  border-bottom: 1px solid var(--tps-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.tps-table td, .tps-table tbody td {
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--tps-border-soft);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.tps-table tbody tr:last-child td { border-bottom: none; }
.tps-table tbody tr:hover { background: rgba(252, 252, 254, .035); }
.tps-table tbody tr.is-selected { background: var(--tps-accent-soft); }
.tps-table .num { text-align: right; font-family: var(--tps-font-num); white-space: nowrap; }
.tps-table .sym { font-weight: 750; letter-spacing: .2px; }

/* ---- Màu giá ---- */
.is-up, .tps-up { color: var(--tps-up); }
.is-down, .tps-down { color: var(--tps-down); }
.is-ref { color: var(--tps-ref); }
.is-ceil { color: var(--tps-ceiling); }
.is-floor { color: var(--tps-floor); }
.tps-warn-text { color: var(--tps-warn); }
.tps-muted { color: var(--tps-muted); }
.tps-num { font-variant-numeric: tabular-nums; }

/* ---- Badge ---- */
.tps-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15px;
  white-space: nowrap;
}
.tps-badge--ok { color: #4BE3A5; background: rgba(37, 211, 138, .13); border-color: rgba(37, 211, 138, .34); }
.tps-badge--warn { color: #F7D778; background: rgba(242, 201, 76, .13); border-color: rgba(242, 201, 76, .34); }
.tps-badge--danger { color: #FFA3A3; background: rgba(255, 107, 107, .13); border-color: rgba(255, 107, 107, .32); }
.tps-badge--info { color: #8CCBFF; background: rgba(88, 180, 255, .13); border-color: rgba(88, 180, 255, .32); }
.tps-badge--muted { color: var(--tps-text-2); background: var(--tps-surface-2); border-color: var(--tps-border); }
.tps-badge--violet { color: var(--tps-accent); background: var(--tps-accent-soft); border-color: rgba(168, 107, 209, .36); }

/* ---- Form ---- */
.tps-field { display: flex; flex-direction: column; gap: 6px; }
.tps-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .55px;
  color: var(--tps-muted);
  text-transform: uppercase;
}
.tps-input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--tps-border);
  border-radius: 8px;
  background: rgba(252, 252, 254, .04);
  color: var(--tps-text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.tps-input:focus { border-color: var(--tps-accent-line); box-shadow: 0 0 0 3px rgba(168, 107, 209, .16); }
.tps-input::placeholder { color: rgba(207, 213, 222, .40); }
.tps-input:disabled { opacity: .55; background: var(--tps-surface-2); }
select.tps-input {
  appearance: none;
  padding-right: 30px;
  background: var(--tps-surface)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='6'><path d='M0 0l4.5 6 4.5-6z' fill='%238E95A2'/></svg>")
    no-repeat right 11px center;
}

/* ---- Nút ---- */
.tps-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--tps-border);
  border-radius: 8px;
  background: rgba(252, 252, 254, .045);
  color: var(--tps-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, filter .15s;
}
.tps-btn:hover { background: var(--tps-surface-2); border-color: rgba(252, 252, 254, .18); }
.tps-btn:active { transform: translateY(1px); }
.tps-btn:disabled { opacity: .45; cursor: not-allowed; }
.tps-btn.is-active { border-color: var(--tps-accent-line); color: var(--tps-accent); background: var(--tps-accent-soft); }

.tps-btn--ghost { background: transparent; border-color: transparent; }
.tps-btn--ghost:hover { background: var(--tps-surface-2); border-color: transparent; }

.tps-btn--primary { background: var(--tps-accent); border-color: var(--tps-accent); color: #0A0710; font-weight: 700; }
.tps-btn--primary:hover { background: #BE86E3; border-color: #BE86E3; color: #0A0710; }

.tps-btn--accent { background: var(--tps-accent); border-color: var(--tps-accent); color: #0A0710; font-weight: 700; }
.tps-btn--accent:hover { filter: none; background: #BE86E3; border-color: #BE86E3; color: #0A0710; }

.tps-btn--danger { background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .34); color: #FFA3A3; }
.tps-btn--danger:hover { background: rgba(255, 107, 107, .18); border-color: rgba(255, 107, 107, .46); }

.tps-btn--sm { height: 28px; padding: 0 10px; font-size: 11px; }
.tps-btn--block { width: 100%; }

.tps-btn.is-buy { background: rgba(37, 211, 138, .14); border-color: rgba(37, 211, 138, .34); color: #4BE3A5; }
.tps-btn.is-buy:hover { background: rgba(37, 211, 138, .20); border-color: rgba(37, 211, 138, .46); }
.tps-btn.is-sell { background: rgba(255, 107, 107, .13); border-color: rgba(255, 107, 107, .34); color: #FFA3A3; }
.tps-btn.is-sell:hover { background: rgba(255, 107, 107, .18); border-color: rgba(255, 107, 107, .46); }

.tps-btnrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Meter Rtt ---- */
.tps-meter {
  position: relative;
  height: 7px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .30);
  overflow: hidden;
}
.tps-meter__fill { height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.3, .9, .3, 1); }
.tps-meter__fill--ok { background: var(--tps-ok); }
.tps-meter__fill--warn { background: #F2C94C; }
.tps-meter__fill--danger { background: var(--tps-down); }
.tps-meter__mark {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 1.5px;
  background: rgba(252, 252, 254, .45);
}

/* ---- Khác ---- */
.tps-empty { padding: 36px 16px; text-align: center; color: var(--tps-muted); font-size: 12.5px; }
.tps-module-missing {
  margin: 18px;
  padding: 26px;
  border: 1px dashed var(--tps-border);
  border-radius: 14px;
  background: var(--tps-surface);
  color: var(--tps-muted);
  font-size: 12.5px;
  text-align: center;
}
.tps-navitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--tps-text-2);
  text-decoration: none;
  cursor: pointer;
}
.tps-navitem:hover { background: var(--tps-surface-2); color: var(--tps-text); }

/* ==========================================================================
   4. DANH MỤC — đầu trang, hero tài sản, bảng nắm giữ, disclosure
   ========================================================================== */
.pf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pf-head__eyebrow {
  margin: 0 0 6px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--tps-muted);
}
.pf-head h1 { margin: 0; font-size: 27px; line-height: 1.2; font-weight: 750; letter-spacing: -.65px; }
.pf-head__sub { margin: 5px 0 0; font-size: 12.5px; color: var(--tps-muted); }
.pf-head__sub b { color: var(--tps-text-2); font-weight: 650; }
.pf-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-head__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--tps-accent);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.pf-head__link:hover { background: var(--tps-accent-soft); }

/* ---- Hero tài sản: nền mận đậm duy nhất ---- */
.pf-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 24px 26px 22px;
  border-radius: 16px;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(255, 255, 255, .1), transparent 58%),
    var(--tps-accent-deep);
  color: #FCFCFE;
  box-shadow: 0 24px 56px rgba(0, 0, 0, .48);
}
.pf-hero::before {
  content: "";
  position: absolute;
  right: -196px;
  top: -232px;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .1);
  pointer-events: none;
}
.pf-hero::after {
  content: "";
  position: absolute;
  right: -54px;
  top: -118px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .16);
  pointer-events: none;
}
.pf-hero__top, .pf-hero__metrics { position: relative; z-index: 1; }

.pf-hero__top { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; flex-wrap: wrap; }
.pf-hero__label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .62);
}
.pf-hero__value {
  display: block;
  margin-top: 6px;
  font-family: var(--tps-font-num);
  font-size: 38px;
  line-height: 1.05;
  font-weight: 750;
  letter-spacing: -1.1px;
  font-variant-numeric: tabular-nums;
}
.pf-hero__caption { display: block; margin-top: 7px; font-size: 11.5px; color: rgba(255, 255, 255, .7); }
.pf-hero__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pf-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 9px;
  background: transparent;
  color: #FCFCFE;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pf-hero__btn:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .5); }
.pf-hero__btn--solid { background: #FCFCFE; border-color: #FCFCFE; color: #14091C; }
.pf-hero__btn--solid:hover { background: #E9DCF3; border-color: #E9DCF3; color: #14091C; }

.pf-hero__metrics {
  display: grid;
  grid-template-columns: .9fr 1fr 1.45fr;
  gap: 0;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}
.pf-metric { padding-right: 22px; min-width: 0; }
.pf-metric + .pf-metric { padding-left: 22px; border-left: 1px solid rgba(255, 255, 255, .14); }

.pf-metric__label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .68);
}
.pf-metric__value {
  display: block;
  margin-top: 5px;
  font-family: var(--tps-font-num);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.2px;
  font-variant-numeric: tabular-nums;
}
.pf-metric__note { display: block; margin-top: 4px; font-size: 10.5px; color: rgba(255, 255, 255, .7); }

.pf-riskline { display: flex; align-items: center; gap: 9px; margin-top: 5px; flex-wrap: wrap; }
.pf-riskline .pf-metric__value { margin-top: 0; font-size: 21px; }

.pf-risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}
.pf-risk-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pf-risk-badge--ok { color: #25D38A; background: rgba(37, 211, 138, .14); border-color: rgba(37, 211, 138, .34); }
.pf-risk-badge--warn { color: #F2C94C; background: rgba(242, 201, 76, .14); border-color: rgba(242, 201, 76, .34); }
.pf-risk-badge--danger { color: #FF6B6B; background: rgba(255, 107, 107, .14); border-color: rgba(255, 107, 107, .34); }

.pf-riskbar {
  position: relative;
  height: 6px;
  margin: 13px 0 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .18);
}
.pf-riskbar__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.pf-riskbar__fill--ok { background: #25D38A; }
.pf-riskbar__fill--warn { background: #F2C94C; }
.pf-riskbar__fill--danger { background: #FF6B6B; }
/* Mốc ngưỡng trên thanh: 1px, tô màu theo vùng để khớp nhãn bên dưới */
.pf-riskbar__mark { position: absolute; top: -3px; bottom: -3px; width: 1px; background: rgba(255, 255, 255, .42); }
.pf-riskbar__mark--danger { background: #FF6B6B; }
.pf-riskbar__mark--warn { background: #F2C94C; }
.pf-riskbar__mark--ok { background: #25D38A; }
/* Thước Rtt 0–120%: ba mốc 71,5% / 76,9% / 100% xếp hai hàng so le —
   71,5% và 100% hàng trên canh phải vào mốc, 76,9% hàng dưới canh trái —
   nên nhãn không chồng chữ ở cả 1440px và 390px. Nghĩa đầy đủ (↔ % ký quỹ
   UBCK) nằm trong title từng mốc và popup (*) của nhãn "Tỷ lệ tài khoản". */
.pf-riskbar__scale { position: relative; height: 25px; margin: 6px 0 3px; }
.pf-riskbar__tick {
  position: absolute;
  font-family: var(--tps-font-num);
  font-size: 8.5px;
  font-style: normal;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pf-riskbar__tick--r0 { top: 0; }
.pf-riskbar__tick--r1 { top: 13px; }
.pf-riskbar__tick--right { transform: translateX(-100%); padding-right: 3px; }
.pf-riskbar__tick--left { padding-left: 3px; }
.pf-riskbar__tick--danger { color: #FF6B6B; }
.pf-riskbar__tick--warn { color: #F2C94C; }
.pf-riskbar__tick--ok { color: #25D38A; }

/* ---- Bảng nắm giữ ---- */
.pf-card {
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  border-radius: 12px;
  box-shadow: var(--tps-shadow-soft);
  overflow: hidden;
}
.pf-card__head { display: flex; align-items: baseline; gap: 12px; padding: 16px 18px 13px; }
.pf-card__title { margin: 0; font-size: 15px; font-weight: 750; letter-spacing: -.2px; }
.pf-card__sub { font-size: 11.5px; color: var(--tps-muted); }
.pf-card__head-right { margin-left: auto; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pf-card__value { font-family: var(--tps-font-num); font-size: 13px; font-weight: 700; }

.pf-table-wrap { overflow-x: auto; }
.pf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pf-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .55px;
  text-transform: uppercase;
  color: var(--tps-muted);
  background: var(--tps-surface-2);
  border-top: 1px solid var(--tps-border-soft);
  border-bottom: 1px solid var(--tps-border);
  white-space: nowrap;
}
.pf-table td {
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--tps-border-soft);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.pf-table tbody tr:last-child td { border-bottom: none; }
.pf-table .num { text-align: right; font-family: var(--tps-font-num); white-space: nowrap; }

.pf-holding { cursor: pointer; transition: background .12s; }
.pf-holding:hover { background: rgba(252, 252, 254, .035); }
.pf-holding.is-open { background: rgba(168, 107, 209, .10); }
.pf-sym { display: flex; align-items: center; gap: 9px; min-width: 132px; }
.pf-sym__code { font-weight: 750; letter-spacing: .25px; font-size: 13px; }
.pf-sym__open { cursor: pointer; border-bottom: 1px dotted transparent; }
.pf-sym__open:hover { color: var(--tps-accent); border-bottom-color: var(--tps-accent-line); }
.pf-sym__name {
  max-width: 156px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  color: var(--tps-muted);
}
.pf-pl { font-size: 11.5px; }
.pf-pl small { display: block; font-size: 10px; opacity: .78; }

.pf-expand {
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--tps-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .18s, color .15s;
}
.pf-holding:hover .pf-expand { border-color: var(--tps-border); background: rgba(252, 252, 254, .08); color: var(--tps-text-2); }
.pf-holding.is-open .pf-expand { transform: rotate(90deg); color: var(--tps-accent); border-color: var(--tps-accent-line); background: var(--tps-accent-soft); }

.pf-detail > td {
  padding: 0 !important;
  height: auto;
  background: rgba(3, 8, 10, .45);
  border-bottom: 1px solid var(--tps-border-soft);
}
.pf-detail__inner {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: center;
  padding: 15px 18px 16px 42px;
}
.pf-detail__field span {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .55px;
  text-transform: uppercase;
  color: var(--tps-muted);
}
.pf-detail__field b {
  display: block;
  margin-top: 3px;
  font-family: var(--tps-font-num);
  font-size: 12.5px;
  font-weight: 650;
}
.pf-detail__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.pf-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 18px;
  border-top: 1px solid var(--tps-border);
  background: var(--tps-surface-2);
  font-size: 11px;
  color: var(--tps-muted);
}
.pf-foot b { color: var(--tps-text-2); font-family: var(--tps-font-num); font-weight: 650; }
.pf-foot__sep { color: rgba(207, 213, 222, .3); margin: 0 6px; }

/* ---- Disclosure ---- */
.tps-disclosure {
  margin-top: 16px;
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  border-radius: 10px;
  box-shadow: var(--tps-shadow-soft);
  overflow: hidden;
}
.pf-allocation-card { margin-bottom: 16px; }
.pf-allocation-card .tps-card__body { padding-top: 6px; padding-bottom: 14px; }
.pf-allocation-card + .pf-card { margin-top: 0; }
.tps-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.tps-disclosure > summary::-webkit-details-marker { display: none; }
.tps-disclosure > summary:hover { background: var(--tps-surface-2); }
.tps-disclosure__title { font-size: 13px; font-weight: 700; }
.tps-disclosure__meta { font-size: 11.5px; color: var(--tps-muted); }
.tps-disclosure__chev {
  margin-left: auto;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 1px solid var(--tps-border);
  border-radius: 50%;
  color: var(--tps-muted);
  font-size: 12px;
  transition: transform .18s, background .15s, color .15s;
}
.tps-disclosure[open] .tps-disclosure__chev {
  transform: rotate(90deg);
  background: var(--tps-accent-soft);
  color: var(--tps-accent);
  border-color: var(--tps-accent-line);
}
.tps-disclosure__body { padding: 0 18px 18px; border-top: 1px solid var(--tps-border-soft); }
.tps-disclosure__body > .tps-card:first-child,
.tps-disclosure__body > .tps-grid:first-child { margin-top: 16px; }
.tps-disclosure__body > .tps-card { box-shadow: none; }

.pf-disc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.pf-disc-grid .tps-card + .tps-card { margin-top: 0; }

/* ==========================================================================
   5. BẢNG GIÁ — nhịp thị trường chỉ đặt ở trang bảng giá
   ========================================================================== */
.market-pulse {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 16px;
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  border-radius: 12px;
  box-shadow: var(--tps-shadow-soft);
  overflow: hidden;
}
.market-pulse__item { display: flex; align-items: baseline; gap: 9px; padding: 11px 15px; min-width: 0; }
.market-pulse__item + .market-pulse__item { border-left: 1px solid var(--tps-border-soft); }
.market-pulse__label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .55px;
  text-transform: uppercase;
  color: var(--tps-muted);
  white-space: nowrap;
}
.market-pulse__value {
  font-family: var(--tps-font-num);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.market-pulse__chg { font-family: var(--tps-font-num); font-size: 11px; font-weight: 600; white-space: nowrap; }
.market-pulse__note { margin-left: auto; font-size: 10.5px; color: var(--tps-muted); white-space: nowrap; }

/* ==========================================================================
   6. THÀNH PHẦN ROUTER / AI / TOAST / MODAL
   ========================================================================== */
.ai-navbanner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid rgba(168, 107, 209, .36);
  border-radius: 12px;
  background: var(--tps-accent-soft);
  color: var(--tps-accent);
  font-size: 12.5px;
}
.ai-navbanner__icon { color: var(--tps-accent); font-size: 14px; flex: 0 0 auto; }
.ai-navbanner__text { font-weight: 650; }
.ai-navbanner__msg { margin-left: 8px; font-size: 11.5px; color: var(--tps-muted); }
.ai-navbanner__close {
  margin-left: auto;
  padding: 4px 10px;
  border: 1px solid var(--tps-border);
  border-radius: 8px;
  background: var(--tps-surface);
  color: var(--tps-text-2);
  font-size: 11px;
  cursor: pointer;
}
.ai-navbanner__close:hover { border-color: var(--tps-accent-line); color: var(--tps-accent); }

@keyframes tpsSpot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 107, 209, 0); }
  50% { box-shadow: 0 0 0 9px rgba(168, 107, 209, .22); }
}
.ai-spotlight-pulse {
  outline: 2px solid rgba(168, 107, 209, .65);
  outline-offset: 3px;
  border-radius: 10px;
  animation: tpsSpot 1.1s ease-in-out 3;
}

.ai-prefill-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid rgba(168, 107, 209, .36);
  border-radius: 12px;
  background: var(--tps-accent-soft);
  color: var(--tps-text);
  font-size: 12px;
}
.ai-prefill-banner b { color: var(--tps-accent); }

/* ---- Toast ---- */
.tps-toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.tps-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 420px;
  padding: 11px 14px;
  border: 1px solid var(--tps-border);
  border-radius: 12px;
  background: var(--tps-surface);
  box-shadow: var(--tps-shadow);
  color: var(--tps-text);
  font-size: 12.2px;
  transition: opacity .35s, transform .35s;
}
.tps-toast.is-out { opacity: 0; transform: translateX(24px); }
.tps-toast__dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--tps-info); }
.tps-toast--ok .tps-toast__dot { background: var(--tps-ok); }
.tps-toast--warn .tps-toast__dot { background: var(--tps-warn); }
.tps-toast--err .tps-toast__dot { background: var(--tps-down); }
.tps-toast--info .tps-toast__dot { background: var(--tps-info); }
.tps-toast__msg { line-height: 1.45; }

/* ---- Modal ---- */
.tps-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 5, 7, .74);
  backdrop-filter: blur(3px);
}
.tps-modal {
  width: min(580px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(10, 15, 20, .96);
  border: 1px solid var(--tps-border);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 34px 84px rgba(0, 0, 0, .72);
}
.tps-modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--tps-border-soft);
  background: var(--tps-surface);
}
.tps-modal__title { font-size: 14px; font-weight: 750; }
.tps-modal__close {
  margin-left: auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tps-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.tps-modal__close:hover { background: var(--tps-surface-2); color: var(--tps-text); }
.tps-modal__body { padding: 17px 18px; overflow-y: auto; font-size: 12.5px; line-height: 1.65; }
.tps-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--tps-border-soft);
  background: var(--tps-surface-2);
}

/* ==========================================================================
   7. TƯƠNG THÍCH KHUNG CHAT — chỉ các điểm chat chưa dùng token
   (không sở hữu giao diện chat; module chat có CSS riêng)
   ========================================================================== */
.it-copilot .cp-thread { scrollbar-color: rgba(207, 213, 222, .22) transparent; }
.it-copilot #cp-send { color: #FCFCFE; }
.it-copilot .cp-head { border-bottom-color: var(--tps-border-soft); }
.it-copilot .cp-answer { box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }

/* ==========================================================================
   8. RESPONSIVE
   ========================================================================== */
@media (max-width: 1360px) {
  :root { --it-copilot-w: 356px; }
  .app-head__inner { gap: 14px; padding: 0 18px; }
  .mainnav > a, .mainnav__group > button { padding: 0 10px; font-size: 12.5px; }
  .it-search { width: 154px; }
  .it-select { max-width: 186px; }
  .accountbtn__name { max-width: 110px; }
  .pf-hero__value { font-size: 34px; }
}

@media (max-width: 1180px) {
  .it-search { display: none; }
  .accountbtn__meta { display: none; }
  .accountbtn { padding-right: 6px; }
  .it-subacc label { display: none; }
  #btn-ai-rail { display: inline-flex; }
}

@media (max-width: 960px) {
  :root { --it-head-h: 58px; }

  .app-head__inner { gap: 10px; padding: 0 14px; }
  .brand__name i { display: none; }
  .brand__mark { width: 32px; height: 32px; }
  #btn-mainnav { display: grid; place-items: center; order: 3; }

  .mainnav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 12px 12px;
    background: var(--tps-surface);
    border-bottom: 1px solid var(--tps-border);
    box-shadow: 0 16px 30px rgba(0, 0, 0, .36);
  }
  .app-head.nav-open .mainnav { display: flex; }
  .mainnav > a, .mainnav__group > button {
    justify-content: space-between;
    height: 42px;
    padding: 0 12px;
    font-size: 13.5px;
  }
  .mainnav__group { position: static; }
  .mainnav__menu {
    position: static;
    display: none;
    min-width: 0;
    padding: 2px 0 2px 12px;
    border: 0;
    border-left: 2px solid var(--tps-accent-soft);
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .mainnav__group.is-open .mainnav__menu { display: block; }
  .mainnav__menu a { padding: 9px 10px; font-size: 13px; }

  .it-subacc { margin-left: auto; }
  .it-select { max-width: 172px; height: 32px; font-size: 11.5px; }
  .accountbtn { order: 4; }
  #btn-ai-rail { order: 2; height: 32px; }
  .accountbtn__avatar { width: 28px; height: 28px; flex-basis: 28px; }

  .it-viewport, .tps-viewport { padding: 20px 16px 54px; }

  .pf-hero { padding: 20px 20px 18px; border-radius: 16px; }
  .pf-hero__value { font-size: 31px; }
  .pf-hero__metrics { grid-template-columns: 1fr 1fr; }
  .pf-metric { padding-right: 16px; }
  .pf-metric + .pf-metric { padding-left: 16px; }
  .pf-metric--risk {
    grid-column: 1 / -1;
    border-left: 0 !important;
    padding-left: 0 !important;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    margin-top: 14px;
  }

  .pf-detail__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 18px; }
  .pf-detail__actions { grid-column: 1 / -1; justify-content: flex-start; }
  .pf-disc-grid { grid-template-columns: 1fr; }
  .market-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-pulse__item:nth-child(3) { border-left: 0; border-top: 1px solid var(--tps-border-soft); }
  .market-pulse__item:nth-child(4) { border-top: 1px solid var(--tps-border-soft); }
}

@media (max-width: 720px) {
  .tps-page-head { gap: 10px; margin-bottom: 14px; }
  .tps-page-head__title { font-size: 22px; letter-spacing: -.4px; }
  .tps-page-head__actions { width: 100%; margin-left: 0; }

  .pf-head { gap: 10px; }
  .pf-head h1 { font-size: 23px; letter-spacing: -.5px; }
  .pf-head__actions { width: 100%; }

  .tps-grid--4, .tps-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tps-grid--2 { grid-template-columns: 1fr; }

  .pf-hero__top { align-items: flex-start; }
  .pf-hero__actions { width: 100%; }
  .pf-hero__btn { flex: 1 1 auto; }
  .pf-hero__metrics { grid-template-columns: 1fr 1fr; }
  .pf-metric { padding-right: 12px; }
  .pf-metric + .pf-metric { padding-left: 12px; }
  .pf-metric--risk {
    grid-column: 1 / -1;
    border-left: 0 !important;
    padding-left: 0 !important;
    padding-top: 13px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    margin-top: 13px;
  }

  .pf-card__head { align-items: flex-start; flex-wrap: wrap; padding: 14px 14px 12px; }
  .pf-card__head-right { width: 100%; margin-left: 0; }
  .pf-table { min-width: 0; }
  .pf-table th, .pf-table td { padding-left: 8px; padding-right: 8px; }
  .pf-table th:nth-child(3), .pf-table td:nth-child(3),
  .pf-table th:nth-child(4), .pf-table td:nth-child(4) { display: none; }
  .pf-table td { height: 48px; }
  .pf-sym { min-width: 0; }
  .pf-sym__name { display: none; }
  .pf-foot { padding: 10px 14px; }
  .pf-detail__inner { gap: 12px; }

  .tps-card__body { padding: 14px; }
  .tps-card__head { padding: 13px 14px; }

  .tps-toast-wrap { right: 12px; left: 12px; bottom: 12px; }
  .tps-toast { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
  .app-head__inner { padding: 0 10px; gap: 6px; }
  .brand__name b { font-size: 13.5px; }
  .brand__mark { width: 30px; height: 30px; font-size: 12px; }
  .it-subacc { flex: 0 1 150px; min-width: 0; }
  .it-select { max-width: 150px; width: 100%; padding-left: 8px; }
  #btn-ai-rail { width: 34px; padding: 0; justify-content: center; }
  #btn-ai-rail span { display: none; }
  .accountbtn { padding: 2px; border: 0; }
  .accountbtn__caret { display: none; }
  .acct-pop { right: 8px; left: 8px; width: auto; }
  .it-viewport, .tps-viewport { padding: 16px 12px 48px; }
  .pf-hero { padding: 18px 16px 16px; }
  .pf-hero__value { font-size: 28px; letter-spacing: -.8px; }
  .pf-hero__caption { font-size: 10.5px; }
  .pf-metric__value { font-size: 15px; white-space: nowrap; }
  .pf-riskline .pf-metric__value { font-size: 19px; }
  .pf-table { font-size: 11.5px; }
  .pf-table th { font-size: 9px; letter-spacing: .3px; }
  .pf-table th, .pf-table td { padding-left: 6px; padding-right: 6px; }
  .pf-expand { width: 24px; height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   9. OBSIDIAN DARK REVISION — canvas obsidian, card kính mờ, nhấn orchid
   --------------------------------------------------------------------------
   Lớp điều chỉnh cuối file: giữ nguyên hợp đồng token --tps-* và toàn bộ bố
   cục. Bề mặt sương xám được thay bằng obsidian #03080A; card/biểu mẫu dùng
   kính mờ (backdrop blur 8px) để lớp không gian 3D (#ws-atmos) lộ nhẹ phía
   sau; viền hairline 1px thay cho bóng đổ dày. Không đổi route hay hành vi.
   ========================================================================== */

html, body { background: #03080A; }

body.it-app, body.tps-app { background: #03080A; }

/* ---- Chữ số tiền tệ: không bao giờ rớt "đ" xuống dòng thứ hai ---- */
.pf-metric__value,
.pf-eq__value,
.pf-hero__value {
  white-space: nowrap;
}

/* ---- Card / bảng / biểu mẫu: kính obsidian, viền hairline 1px ---- */
.tps-card, .pf-card, .tps-disclosure {
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  box-shadow: inset 0 1px 0 rgba(252, 252, 254, .04), 0 18px 40px rgba(0, 0, 0, .38);
  -webkit-backdrop-filter: blur(8px) saturate(118%);
  backdrop-filter: blur(8px) saturate(118%);
}
.tps-card__head {
  background: rgba(252, 252, 254, .022);
  border-bottom: 1px solid var(--tps-border-soft);
}
.pf-card__head { background: transparent; }
.tps-stat {
  background: var(--tps-surface-2);
  border: 1px solid var(--tps-border-soft);
  box-shadow: inset 0 1px 0 rgba(252, 252, 254, .035);
}
.tps-stat--warn {
  border-color: rgba(255, 107, 107, .30);
  background: rgba(255, 107, 107, .08);
}

/* ---- Bảng: hàng tối, hover orchid rất nhẹ, không mảng trắng ---- */
.tps-table th, .tps-table thead th {
  background: rgba(15, 22, 29, .96);
  color: var(--tps-muted);
  border-bottom: 1px solid var(--tps-border);
}
.tps-table td, .tps-table tbody td { border-bottom: 1px solid var(--tps-border-soft); }
.tps-table tbody tr:nth-child(even) { background: rgba(252, 252, 254, .014); }
.tps-table tbody tr:hover { background: rgba(168, 107, 209, .09); }
.tps-table tbody tr.is-selected { background: var(--tps-accent-soft); }
.pf-table th {
  background: rgba(15, 22, 29, .96);
  border-top: 1px solid var(--tps-border-soft);
  border-bottom: 1px solid var(--tps-border);
}
.pf-table td { border-bottom: 1px solid var(--tps-border-soft); }
.pf-holding:hover { background: rgba(168, 107, 209, .08); }
.pf-holding.is-open { background: rgba(168, 107, 209, .12); }
.pf-detail > td { background: rgba(3, 8, 10, .45); }
.pf-foot {
  background: rgba(252, 252, 254, .025);
  border-top: 1px solid var(--tps-border);
}
.pf-card__subsep { color: rgba(207, 213, 222, .3); }

/* ---- Form / nút: nền kính mờ, viền hairline, focus orchid ---- */
.tps-input, .tps-select, .it-select, .it-search input, .wt-subacc select {
  background: rgba(252, 252, 254, .04);
  border-color: var(--tps-border);
  color: var(--tps-text);
  color-scheme: dark;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, .25);
}
.tps-input::placeholder, .it-search input::placeholder { color: rgba(207, 213, 222, .42); }
.tps-input:focus, .tps-select:focus, .it-select:focus {
  background: rgba(252, 252, 254, .06);
  border-color: var(--tps-accent-line);
  box-shadow: 0 0 0 3px rgba(168, 107, 209, .18);
}
.tps-input:disabled { background: rgba(252, 252, 254, .02); }

.tps-btn:hover { background: rgba(252, 252, 254, .085); border-color: rgba(252, 252, 254, .18); }
.tps-btn--primary, .tps-btn--accent {
  background: var(--tps-accent);
  border-color: var(--tps-accent);
  color: #0A0710;
}
.tps-btn--primary:hover, .tps-btn--accent:hover {
  background: #BE86E3;
  border-color: #BE86E3;
  color: #0A0710;
  filter: none;
}
.tps-btn.is-active { background: var(--tps-accent-soft); border-color: var(--tps-accent-line); color: var(--tps-accent); }

/* ---- Hero tài sản: obsidian-plum, viền orchid hairline, nút tương phản cao ---- */
.pf-hero {
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(168, 107, 209, .22), transparent 58%),
    radial-gradient(90% 120% at 0% 100%, rgba(88, 180, 255, .08), transparent 62%),
    linear-gradient(158deg, rgba(43, 23, 58, .94) 0%, rgba(23, 14, 33, .95) 58%, rgba(8, 10, 16, .96) 100%);
  border: 1px solid var(--tps-accent-line);
  box-shadow: 0 28px 64px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(252, 252, 254, .06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.pf-hero::before { border-color: rgba(168, 107, 209, .14); }
.pf-hero::after { border-color: rgba(168, 107, 209, .22); }
.pf-hero__btn {
  border-color: rgba(252, 252, 254, .20);
  background: rgba(252, 252, 254, .04);
  color: var(--tps-text);
}
.pf-hero__btn:hover {
  background: rgba(252, 252, 254, .10);
  border-color: rgba(252, 252, 254, .34);
}
.pf-hero__btn--solid { background: #FCFCFE; border-color: #FCFCFE; color: #14091C; }
.pf-hero__btn--solid:hover { background: #E9DCF3; border-color: #E9DCF3; color: #14091C; }
.pf-riskbar { background: rgba(252, 252, 254, .16); }
.pf-eq__cell.is-total .pf-eq__label { color: #D9BCEC; }
.pf-eq__cell.is-total .pf-eq__value { color: #FCFCFE; }

/* Donut cơ cấu: đường ghép trùng nền card, không lộ viền sáng */
.tpa { --tpa-seam: #0A0F14; }
.pf-allocation-card .tpa { --tpa-seam: #0A0F14; }

/* ---- Toast / modal / banner: kính tối, viền hairline ---- */
.tps-toast {
  background: rgba(12, 18, 24, .94);
  border: 1px solid var(--tps-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, .62);
}
.tps-modal-backdrop {
  background: rgba(2, 5, 7, .74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.tps-modal {
  background: rgba(10, 15, 20, .96);
  border: 1px solid var(--tps-border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 34px 84px rgba(0, 0, 0, .72);
}
.tps-modal__head { background: rgba(252, 252, 254, .03); }
.tps-modal__foot { background: rgba(252, 252, 254, .02); }
.cp-modal { background: #12131F; }
.ai-navbanner, .ai-prefill-banner {
  border-color: var(--tps-accent-line);
  background: var(--tps-accent-soft);
  color: var(--tps-accent);
}
.ai-prefill-banner { color: var(--tps-text); }
.ai-navbanner__close { background: rgba(252, 252, 254, .05); border-color: var(--tps-border); }

/* ---- Trình nhập danh mục (portfolio editor) — scope .pe-overlay ---- */
.pe-overlay { background: rgba(2, 5, 7, .72); color: var(--tps-text); }
.pe-overlay .pe-panel {
  background: linear-gradient(180deg, rgba(16, 23, 30, .97) 0%, rgba(8, 12, 17, .98) 100%);
  border: 1px solid var(--tps-border);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .72);
}
.pe-overlay .pe-head { border-bottom-color: var(--tps-border); }
.pe-overlay .pe-title { color: var(--tps-text); }
.pe-overlay .pe-sub, .pe-overlay .pe-hint, .pe-overlay .pe-sec,
.pe-overlay .pe-status, .pe-overlay .pe-quick-label, .pe-overlay .pe-tag,
.pe-overlay .pe-side-sub, .pe-overlay .pe-side h3, .pe-overlay .pe-cash-unit,
.pe-overlay .pe-loans th, .pe-overlay .pe-table th, .pe-overlay .pe-pv-row span,
.pe-overlay .pe-chip i { color: var(--tps-muted); }
.pe-overlay .pe-x { color: var(--tps-muted); }
.pe-overlay .pe-x:hover { background: rgba(252, 252, 254, .08); color: var(--tps-text); }
.pe-overlay .pe-side { background: rgba(252, 252, 254, .03); border-left-color: var(--tps-border); }
.pe-overlay .pe-chip, .pe-overlay .pe-lock {
  background: rgba(252, 252, 254, .05); border-color: var(--tps-border); color: var(--tps-text);
}
.pe-overlay .pe-chipbtn { background: rgba(252, 252, 254, .05); border-color: var(--tps-border); color: var(--tps-text-2); }
.pe-overlay .pe-chipbtn:hover { background: var(--tps-accent-soft); border-color: var(--tps-accent-line); color: var(--tps-accent); }
.pe-overlay .pe-loans, .pe-overlay .pe-loans summary { color: var(--tps-text-2); }
.pe-overlay .pe-loans th, .pe-overlay .pe-loans td { border-bottom-color: var(--tps-border-soft); }
.pe-overlay .pe-table th { border-bottom-color: var(--tps-border); }
.pe-overlay .pe-table td { border-bottom-color: var(--tps-border-soft); }
.pe-overlay .pe-table tr.is-bad td { background: rgba(255, 107, 107, .09); }
.pe-overlay .pe-in {
  background: rgba(252, 252, 254, .04); border-color: var(--tps-border); color: var(--tps-text);
}
.pe-overlay .pe-in:focus {
  background: rgba(252, 252, 254, .07); border-color: var(--tps-accent-line);
  box-shadow: 0 0 0 3px rgba(168, 107, 209, .18);
}
.pe-overlay .pe-in[readonly] { background: rgba(252, 252, 254, .02); color: var(--tps-muted); }
.pe-overlay .pe-in.is-bad { border-color: rgba(255, 107, 107, .55); background: rgba(255, 107, 107, .10); }
.pe-overlay .pe-rm { color: var(--tps-muted); }
.pe-overlay .pe-rm:hover { background: rgba(255, 107, 107, .14); color: #FFA3A3; }
.pe-overlay .pe-cash { border-top-color: var(--tps-border); color: var(--tps-text-2); }
.pe-overlay .pe-pv { background: rgba(252, 252, 254, .04); border-color: var(--tps-border); }
.pe-overlay .pe-pv-row { border-bottom-color: var(--tps-border-soft); }
.pe-overlay .pe-pv-row.is-em { background: rgba(252, 252, 254, .04); }
.pe-overlay .pe-pv-row b small { color: var(--tps-muted); }
.pe-overlay .pe-foot { background: rgba(252, 252, 254, .03); border-top-color: var(--tps-border); }
.pe-overlay .pe-status b { color: var(--tps-text); }
.pe-overlay .pe-btn { background: rgba(252, 252, 254, .05); border-color: var(--tps-border); color: var(--tps-text-2); }
.pe-overlay .pe-btn:hover { background: rgba(252, 252, 254, .09); }
.pe-overlay .pe-btn--primary { background: var(--tps-accent); border-color: var(--tps-accent); color: #0A0710; }
.pe-overlay .pe-btn--primary:hover { background: #BE86E3; border-color: #BE86E3; }
.pe-overlay .pe-btn:disabled, .pe-overlay .pe-btn[disabled] {
  background: rgba(252, 252, 254, .03); border-color: var(--tps-border-soft); color: #6B7280;
}
.pe-overlay .pe-draft { background: rgba(88, 180, 255, .13); border-color: rgba(88, 180, 255, .32); color: #8CCBFF; }
.pe-overlay .pe-link { color: var(--tps-accent); }
.pe-overlay .pe-badge.ok { background: rgba(37, 211, 138, .13); color: #6FE9B4; }
.pe-overlay .pe-badge.warn { background: rgba(242, 201, 76, .13); color: #F7D778; }
.pe-overlay .pe-badge.danger { background: rgba(255, 107, 107, .13); color: #FFA3A3; }
.pe-overlay .pe-alert.err { background: rgba(255, 107, 107, .10); border-color: rgba(255, 107, 107, .34); color: #FFA3A3; }
.pe-overlay .pe-alert.warn { background: rgba(242, 201, 76, .10); border-color: rgba(242, 201, 76, .34); color: #F7D778; }
.pe-overlay .pe-alert.info { background: rgba(88, 180, 255, .10); border-color: rgba(88, 180, 255, .32); color: #8CCBFF; }
.pe-overlay .pe-delta.up { color: #4BE3A5; }
.pe-overlay .pe-delta.down { color: #FFA3A3; }
.pe-overlay .pe-delta.flat { color: var(--tps-muted); }


/* ==========================================================================
   10. DANH MỤC — ĐỐI CHIẾU TÀI SẢN / DƯ NỢ / TÀI SẢN RÒNG
   --------------------------------------------------------------------------
   Hero đọc theo một mạch: Tổng tài sản (lớn) → Tài sản ròng + Tổng dư nợ =
   Tổng tài sản → các khoản tài sản/dư nợ → sức mua và Rtt. Bảng mã tách rõ
   giá trị thị trường, giá vốn và giá trị quy đổi sau tỷ lệ vay (cơ sở Rtt).
   Bề mặt/bảng màu bám lớp Obsidian Dark ở trên, không thêm tông sáng mới.
   ========================================================================== */

/* ---- Đầu hero: nhãn + số tổng, không đổi nền mận ---- */
.pf-hero__headline { min-width: 0; }
.pf-hero__headline .pf-hero__value { overflow-wrap: normal; }

/* ---- Đối chiếu ròng + dư nợ = tổng ---- */
.pf-eq {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, .15);
}
.pf-eq__cell { min-width: 128px; max-width: 100%; }
.pf-eq__label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .7px;
  line-height: 1.2;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .66);
}
.pf-eq__value {
  display: block;
  margin-top: 3px;
  font-family: var(--tps-font-num);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.25px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf-eq__cell.is-total .pf-eq__label { color: #D9BCEC; }
.pf-eq__cell.is-total .pf-eq__value { color: #FCFCFE; }
.pf-eq__op {
  align-self: center;
  padding-top: 15px;
  font-family: var(--tps-font-num);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  color: rgba(255, 255, 255, .55);
}
.pf-eq__check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: center;
  margin-left: 2px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}
.pf-eq__check-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pf-eq__check.is-ok { color: #7FE9B8; background: rgba(46, 190, 120, .14); border-color: rgba(120, 224, 169, .3); }
.pf-eq__check.is-warn { color: #F7D778; background: rgba(255, 178, 58, .15); border-color: rgba(255, 196, 98, .34); }
.pf-eq__check.is-bad { color: #FFA3A3; background: rgba(255, 106, 92, .16); border-color: rgba(255, 145, 132, .34); }

/* Nhãn "Tạm tính" khi còn thành phần chưa có trường dữ liệu */
.pf-hero__flag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border: 1px solid rgba(255, 196, 98, .34);
  border-radius: 99px;
  background: rgba(255, 178, 58, .15);
  color: #F7D778;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---- Hai sổ khoản: tài sản | dư nợ ---- */
.pf-ledger-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .13);
}
.pf-ledger {
  min-width: 0;
  padding: 11px 13px 10px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
}
.pf-ledger__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.pf-ledger__title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .75px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .66);
}
.pf-ledger__total {
  font-family: var(--tps-font-num);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.1px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf-ledger__rows { margin: 0; padding: 0; }
.pf-ledger__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.pf-ledger__row:first-child { border-top: 0; }
.pf-ledger__row dt {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.35;
  color: rgba(255, 255, 255, .84);
}
.pf-ledger__row dd {
  margin: 0;
  font-family: var(--tps-font-num);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf-ledger__tag {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .8);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .35px;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}
.pf-ledger__tag.is-rtt { background: rgba(120, 224, 169, .15); color: #8FF0C4; }
.pf-ledger__tag.is-out { background: rgba(255, 196, 98, .15); color: #FFE0A8; }
.pf-ledger__tag.is-other { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .78); }

/* Dòng cấu thành (gốc/lãi trong nợ vay, tiền mặt/chờ về trong tiền tại CTCK) */
.pf-ledger__row--sub { padding-top: 3px; padding-bottom: 3px; border-top: 0; }
.pf-ledger__row--sub dt { padding-left: 10px; font-size: 10.5px; color: rgba(255, 255, 255, .68); }
.pf-ledger__row--sub dt::before {
  content: "";
  width: 3px; height: 3px;
  margin-right: 1px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .4);
}
.pf-ledger__row--sub dd { font-size: 11px; font-weight: 550; color: rgba(255, 255, 255, .78); }

.pf-hero .pf-metric__value { white-space: nowrap; }

.pf-hero--missing { padding-bottom: 22px; }
.pf-hero__missing {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, .86);
}

/* ---- Đầu card danh mục: "Tổng giá trị thị trường của n mã" ---- */
.pf-card__sub--stack {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 6px;
  min-width: 0;
}
.pf-card__sub--stack b { color: var(--tps-text-2); font-weight: 700; }
.pf-card__subsep { color: rgba(207, 213, 222, .3); }

/* ---- Bảng mã: cột giá / giá trị / cơ sở Rtt ---- */
.pf-table--recon th,
.pf-table--recon td { padding-left: 9px; padding-right: 9px; }
.pf-table--recon th.c-ratio-asset,
.pf-table--recon th.c-capped { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.pf-table--recon th.c-ratio-asset { min-width: 108px; }
.pf-table--recon th.c-capped { min-width: 104px; }
.pf-table--recon th.c-px { min-width: 92px; }
.pf-table--recon td.c-ratio-asset,
.pf-table--recon td.c-capped { font-weight: 650; }
.pf-table--recon td.c-capped { color: var(--tps-text); }
.pf-px { display: block; }
.pf-px__sub {
  display: block;
  margin-top: 1px;
  font-family: var(--tps-font);
  font-size: 8.5px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--tps-muted);
  white-space: nowrap;
}
.pf-sym__meta {
  display: none;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--tps-muted);
  font-family: var(--tps-font-num);
}

/* ---- Chân bảng: 5 tổng tách bạch giá trị / giá vốn / cơ sở Rtt ---- */
.pf-foot--recon {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: start;
  padding: 13px 18px 14px;
}
.pf-foot__cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-foot__cell-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--tps-muted);
}
.pf-foot__cell-value {
  font-family: var(--tps-font-num);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.1px;
  line-height: 1.3;
  color: var(--tps-text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf-foot__cell-note { font-size: 10px; line-height: 1.35; color: var(--tps-muted); }
.pf-foot__cell.is-up .pf-foot__cell-value { color: var(--tps-up); }
.pf-foot__cell.is-down .pf-foot__cell-value { color: var(--tps-down); }

/* ---- Chi tiết mã: lưới trường + hành động riêng một dòng ---- */
.pf-detail__inner { display: block; padding: 15px 18px 16px 42px; }
.pf-detail__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 18px;
}
.pf-detail__note {
  display: block;
  margin-top: 2px;
  font-family: var(--tps-font);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--tps-muted);
}
.pf-detail__actions { margin-top: 14px; }

/* ---- Tablet / laptop hẹp: bớt cột giá vốn, số liệu chính vẫn đủ ---- */
@media (max-width: 1599px) and (min-width: 721px) {
  .pf-table--recon th.c-avg,
  .pf-table--recon td.c-avg { display: none; }
  /* Cột mã gọn lại: tên công ty đã có ở bảng giá; giữ mã + KL/giá trong ô */
  .pf-table--recon .pf-sym__name { display: none; }
  .pf-table--recon th,
  .pf-table--recon td { padding-left: 7px; padding-right: 7px; }
  .pf-metric { padding-right: 15px; }
  .pf-metric + .pf-metric { padding-left: 15px; }
  .pf-metric__value { font-size: 15.5px; }
  .pf-ledger { padding: 10px 11px 9px; }
  .pf-ledger__row dt { font-size: 11px; }
  .pf-ledger__row dd { font-size: 11.5px; }
  /* Nhãn Rtt đã có ở dòng ghi chú ngay dưới sổ — bỏ tag để hàng không xuống 3 dòng */
  .pf-ledger__tag { display: none; }
}
@media (max-width: 1100px) and (min-width: 721px) {
  .pf-detail__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Tablet: bỏ cột giá chi tiết (vẫn mở được trong dòng chi tiết),
     giữ đủ giá trị thị trường / tài sản tính tỷ lệ / tỷ lệ vay / sau tỷ lệ. */
  .pf-table--recon th.c-px,
  .pf-table--recon td.c-px { display: none; }
}

/* ---- Tablet 721–900: bảng mã chuyển sang khối đọc dọc như mobile ---- */
@media (min-width: 721px) and (max-width: 900px) {
  .pf-card__head { align-items: flex-start; flex-wrap: wrap; }
  .pf-card__head-right { width: 100%; margin-left: 0; }

  .pf-table--recon { display: block; width: 100%; font-size: 12px; }
  .pf-table--recon thead { display: none; }
  .pf-table--recon tbody { display: block; }
  .pf-table--recon tr.pf-holding {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: start;
    gap: 3px 18px;
    padding: 10px 16px 9px;
    border-bottom: 1px solid var(--tps-border-soft);
  }
  .pf-table--recon tr.pf-holding.is-open { border-bottom-color: transparent; }
  .pf-table--recon td {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
    white-space: normal;
  }
  .pf-table--recon .c-sym { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .pf-table--recon .c-mv { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; font-weight: 700; }
  .pf-table--recon .c-capped { grid-column: 3; grid-row: 1; text-align: right; font-size: 11.5px; }
  .pf-table--recon .c-pl { grid-column: 2; grid-row: 2; justify-self: end; text-align: right; }
  .pf-table--recon .c-exp { grid-column: 3; grid-row: 2; justify-self: end; align-self: center; }
  .pf-table--recon .c-qty,
  .pf-table--recon .c-avg,
  .pf-table--recon .c-px,
  .pf-table--recon .c-ratio-asset,
  .pf-table--recon .c-ratio { display: none; }
  .pf-table--recon .c-mv::before,
  .pf-table--recon .c-capped::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 1px;
    font-family: var(--tps-font);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .45px;
    line-height: 1.25;
    text-transform: uppercase;
    color: var(--tps-muted);
    white-space: normal;
  }
  .pf-table--recon .pf-detail { display: block; }
  .pf-table--recon .pf-detail[hidden] { display: none; }
  .pf-table--recon .pf-detail > td { display: block; padding: 0 !important; }
  .pf-sym__name { display: none; }
  .pf-sym__meta { display: block; }

  .pf-detail__inner { padding: 12px 16px 14px; }
  .pf-detail__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
  .pf-detail__actions { justify-content: flex-start; }

  .pf-foot--recon { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; padding: 12px 16px 13px; }
  .pf-foot__cell-value { font-size: 12px; white-space: normal; }
  .pf-foot__cell-note { font-size: 9.5px; }
}

/* ---- Mobile: mỗi mã thành một khối đọc dọc, bảng không bị bóp cột ---- */
@media (max-width: 720px) {
  .pf-eq { gap: 8px 10px; margin-top: 15px; padding-top: 13px; }
  .pf-eq__cell { flex: 1 1 104px; min-width: 0; }
  .pf-eq__value { font-size: 14.5px; white-space: nowrap; }
  .pf-eq__op { padding-top: 10px; font-size: 15px; }
  .pf-eq__check { margin-left: 0; }

  .pf-ledger-wrap { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .pf-ledger { padding: 10px 12px 9px; }
  .pf-ledger__row dt { font-size: 11px; }
  .pf-ledger__row dd { font-size: 11.5px; }

  .pf-card__sub--stack { display: block; }
  .pf-card__subsep { margin: 0 4px; }

  .pf-table--recon { display: block; width: 100%; font-size: 12px; }
  .pf-table--recon thead { display: none; }
  .pf-table--recon tbody { display: block; }
  .pf-table--recon tr.pf-holding {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 2px 12px;
    padding: 11px 14px 10px;
    border-bottom: 1px solid var(--tps-border-soft);
  }
  .pf-table--recon tr.pf-holding.is-open { border-bottom-color: transparent; }
  .pf-table--recon td {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
    white-space: normal;
  }
  .pf-table--recon .c-sym { grid-column: 1; grid-row: 1; }
  .pf-table--recon .c-mv { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; font-weight: 700; }
  .pf-table--recon .c-capped { grid-column: 2; grid-row: 2; text-align: right; font-size: 11.5px; }
  .pf-table--recon .c-pl { grid-column: 1; grid-row: 3; margin-top: 3px; }
  .pf-table--recon .c-exp { grid-column: 2; grid-row: 3; justify-self: end; }
  .pf-table--recon .c-qty,
  .pf-table--recon .c-avg,
  .pf-table--recon .c-px,
  .pf-table--recon .c-ratio-asset,
  .pf-table--recon .c-ratio { display: none; }
  .pf-table--recon .c-mv::before,
  .pf-table--recon .c-capped::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 1px;
    font-family: var(--tps-font);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .45px;
    line-height: 1.25;
    text-transform: uppercase;
    color: var(--tps-muted);
    white-space: normal;
  }
  .pf-table--recon .pf-detail { display: block; }
  .pf-table--recon .pf-detail[hidden] { display: none; }
  .pf-table--recon .pf-detail > td { display: block; padding: 0 !important; }
  .pf-sym__name { display: none; }
  .pf-sym__meta { display: block; }

  .pf-detail__inner { padding: 12px 14px 14px; }
  .pf-detail__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
  .pf-detail__actions { justify-content: flex-start; }

  .pf-foot--recon { grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 12px 14px 13px; }
  .pf-foot__cell-value { font-size: 12px; white-space: normal; }
  .pf-foot__cell-note { font-size: 9.5px; }
}

/* Rất hẹp: mỗi vế một dòng nhãn | số, dấu + / = đứng trước số */
@media (max-width: 560px) {
  .pf-eq { display: block; }
  .pf-eq__cell {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 5px 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
  }
  .pf-eq__cell:first-child { border-top: 0; padding-top: 0; }
  .pf-eq__label { font-size: 9px; }
  .pf-eq__value { margin-top: 0; font-size: 15.5px; white-space: nowrap; text-align: right; }
  .pf-eq__op { display: none; }
  .pf-eq__value[data-op]::before {
    content: attr(data-op) " ";
    color: rgba(255, 255, 255, .5);
  }
  .pf-eq__check { margin-top: 6px; }
}
@media (max-width: 420px) {
  .pf-foot--recon { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   8b. DANH MỤC — (*) trợ giúp công thức (Obsidian Dark) + tín hiệu dòng
   --------------------------------------------------------------------------
   Diễn giải/công thức dài không còn chiếm chỗ thường trực: nằm trong popup
   của nút (*). Popup do JS gắn vào #pf-info-layer (con của <body>) với
   position: fixed nên .pf-hero, .pf-card, .pf-table-wrap không cắt được;
   toạ độ được kẹp trong viewport mỗi lần mở.
   ========================================================================== */

.pf-info-layer {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 80;
  pointer-events: none;
}

.pf-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
}

.pf-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 15px;
  margin: 0;
  padding: 0 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: rgba(169, 179, 194, .72);
  font-family: var(--tps-font-num);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .1px;
  cursor: help;
  -webkit-appearance: none;
  appearance: none;
  transition: color .15s, background .15s;
}
.pf-info-btn:hover,
.pf-info-btn:focus-visible,
.pf-info-wrap.is-open .pf-info-btn {
  color: #C996EE;
  background: rgba(168, 107, 209, .14);
  outline: none;
}
.pf-info-btn:focus-visible { box-shadow: 0 0 0 2px rgba(168, 107, 209, .3); }

/* Hero nền mận: (*) sáng hơn để đọc được, hover vẫn về orchid */
.pf-hero .pf-info-btn { color: rgba(216, 196, 236, .62); }
.pf-hero .pf-info-btn:hover,
.pf-hero .pf-info-btn:focus-visible,
.pf-hero .pf-info-wrap.is-open .pf-info-btn {
  color: #DDB6F7;
  background: rgba(252, 252, 254, .12);
}

.pf-info-pop {
  position: fixed;
  left: 0;
  top: 0;
  display: block;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid rgba(168, 107, 209, .34);
  border-radius: 10px;
  background: #0D141C;
  color: #E2E7F0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .65);
  font-family: var(--tps-font);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
  z-index: 80;
}
.pf-info-pop.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}
.pf-info-pop::before {
  content: "";
  position: absolute;
  top: -5px;
  left: var(--pf-tip-arrow, 20px);
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: #0D141C;
  border-left: 1px solid rgba(168, 107, 209, .34);
  border-top: 1px solid rgba(168, 107, 209, .34);
  transform: rotate(45deg);
}
.pf-info-pop--up::before {
  top: auto;
  bottom: -5px;
  transform: rotate(225deg);
}
/* Popup bị kẹp vào cạnh viewport (nút ngoài khung nhìn): ẩn mũi tên cho gọn */
.pf-info-pop--edge::before { display: none; }
.pf-info-pop__title {
  display: block;
  margin-bottom: 3px;
  color: #E4C9F6;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2px;
}
.pf-info-pop__line { display: block; color: #C3CBD9; }
.pf-info-pop__line + .pf-info-pop__line { margin-top: 3px; }

/* Nhãn có (*) — flex để dấu (*) luôn đứng sát nhãn, không rớt dòng lạc chỗ */
.pf-metric__label,
.pf-eq__label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.pf-foot__cell-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.pf-th { display: inline-flex; align-items: center; gap: 4px; }
.pf-table th .pf-info-btn { min-width: 15px; height: 13px; font-size: 8.5px; }
.pf-hero__label .pf-info-btn { height: 16px; }

/* ---- Kịch bản nhanh Rtt (tiểu khoản ký quỹ) ---- */
.pf-scn {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  align-self: center;
}
.pf-scn__pill {
  height: 25px;
  padding: 0 10px;
  border: 1px solid var(--tps-border);
  border-radius: 99px;
  background: rgba(252, 252, 254, .035);
  color: var(--tps-muted);
  font-family: var(--tps-font);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .1px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.pf-scn__pill:hover {
  color: var(--tps-text-2);
  border-color: rgba(168, 107, 209, .42);
  background: rgba(168, 107, 209, .1);
}
.pf-scn__pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(168, 107, 209, .32);
}
.pf-scn__pill.is-active.pf-scn__pill--danger {
  color: #FF6B6B;
  border-color: rgba(255, 107, 107, .5);
  background: rgba(255, 107, 107, .14);
}
.pf-scn__pill.is-active.pf-scn__pill--warn {
  color: #F2C94C;
  border-color: rgba(242, 201, 76, .5);
  background: rgba(242, 201, 76, .14);
}
.pf-scn__pill.is-active.pf-scn__pill--ok {
  color: #25D38A;
  border-color: rgba(37, 211, 138, .5);
  background: rgba(37, 211, 138, .13);
}

/* ---- Tỷ lệ tài khoản: số + badge + thanh đổi màu theo vùng Rtt ---- */
.pf-metric__value--ok { color: #25D38A; }
.pf-metric__value--warn { color: #F2C94C; }
.pf-metric__value--danger { color: #FF6B6B; }
.pf-riskbar { margin-bottom: 0; }

/* ---- Tín hiệu trong bảng mã: chặn giá / không vay ---- */
.pf-px {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.pf-px__val { display: inline-block; }
.pf-cap-tag {
  display: inline-flex;
  align-items: center;
  height: 14px;
  padding: 0 5px;
  border: 1px solid rgba(255, 196, 98, .38);
  border-radius: 99px;
  background: rgba(255, 178, 58, .16);
  color: #FFD98A;
  font-family: var(--tps-font);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .25px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.pf-ratio-tag {
  display: inline-flex;
  align-items: center;
  height: 14px;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid rgba(207, 213, 222, .16);
  border-radius: 99px;
  background: rgba(252, 252, 254, .05);
  color: rgba(207, 213, 222, .74);
  font-family: var(--tps-font);
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.pf-holding.is-capped td.c-px .pf-px__val { color: #FFD98A; }

@media (max-width: 900px) {
  .pf-scn { width: 100%; }
  .pf-scn__pill { height: 24px; font-size: 10px; padding: 0 9px; }
  .pf-info-pop { font-size: 11.5px; }
  .pf-detail__field .pf-info-btn { height: 14px; }
}

/* Đầu card danh mục: tiêu đề một dòng, cụm kịch bản + nút tự xuống dòng gọn */
.pf-card__head { flex-wrap: wrap; row-gap: 6px; }
.pf-card__title { white-space: nowrap; }
.pf-card__head-right { row-gap: 6px; }

/* Thước Rtt trên máy hẹp: giữ 3 mốc 71,5% / 76,9% / 100% rời nhau, không đè chữ */
@media (max-width: 480px) {
  .pf-riskbar__scale { height: 23px; }
  .pf-riskbar__tick { font-size: 8px; }
  .pf-riskbar__tick--r1 { top: 12px; }
}

/* ==========================================================================
   QUYỀN ĐỌC TÀI KHOẢN CỦA TFOX AI — banner/badge, thẻ trạng thái, popup Smart OTP
   --------------------------------------------------------------------------
   Obsidian Dark + orchid #A86BD1. Cùng ngôn ngữ với khung chat: card kính mờ,
   viền 1px rgba(252,252,254,.09), chữ #FCFCFE / #CFD5DE / #8E95A2.
   Bốn trạng thái của thanh quyền đọc: public · reading · ready · error.
   Popup dùng lớp .cp-consent-* để không đụng CSS nội bộ của chat.
   ========================================================================== */

/* ------------------------------ Thanh quyền đọc ------------------------- */
.cp-access-host { flex: 0 0 auto; padding: 0 12px 8px; }

.cp-access {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--tps-border);
  border-radius: var(--tps-radius-sm);
  background: linear-gradient(180deg, rgba(21, 30, 40, .72), rgba(10, 15, 20, .72));
  backdrop-filter: var(--tps-blur);
  -webkit-backdrop-filter: var(--tps-blur);
  font-size: 11.5px;
  line-height: 1.35;
  flex-wrap: wrap;
}

.cp-access__dot {
  width: 7px; height: 7px; flex: 0 0 auto;
  border-radius: 50%;
  background: var(--tps-muted);
  box-shadow: 0 0 0 3px rgba(142, 149, 162, .14);
}
.cp-access.is-public .cp-access__dot { background: var(--tps-muted); }
.cp-access.is-reading .cp-access__dot { background: var(--tps-accent); box-shadow: 0 0 0 3px var(--tps-accent-soft); animation: cp-access-pulse 1.2s ease-in-out infinite; }
.cp-access.is-ready .cp-access__dot { background: var(--tps-ok); box-shadow: 0 0 0 3px rgba(37, 211, 138, .16); }
.cp-access.is-error .cp-access__dot { background: var(--tps-down); box-shadow: 0 0 0 3px rgba(255, 107, 107, .16); }

@keyframes cp-access-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.78); }
}

.cp-access__txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 100%; }
.cp-access__title { color: var(--tps-text); font-weight: 600; letter-spacing: .1px; }
.cp-access__sub { color: var(--tps-muted); font-size: 11px; }
.cp-access.is-ready .cp-access__title { color: #DCC6EE; }
.cp-access.is-error .cp-access__title { color: #FFB4B4; }

.cp-access__spin {
  width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%;
  border: 1.6px solid var(--tps-accent-line);
  border-top-color: var(--tps-accent);
  animation: cp-access-rotate .8s linear infinite;
}
@keyframes cp-access-rotate { to { transform: rotate(360deg); } }

.cp-access__acts { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; justify-content: flex-end; }
.cp-access__btn {
  appearance: none;
  border: 1px solid var(--tps-accent-line);
  background: var(--tps-accent-soft);
  color: #E9D9F5;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.cp-access__btn:hover { background: rgba(168, 107, 209, .24); border-color: var(--tps-accent); }
.cp-access__btn:disabled { opacity: .45; cursor: not-allowed; border-color: var(--tps-border); background: rgba(252, 252, 254, .04); color: var(--tps-muted); }
.cp-access__btn--consent { background: linear-gradient(135deg, var(--tps-accent-deep), var(--tps-accent)); border-color: transparent; color: #fff; }
.cp-access__btn--consent:hover { background: linear-gradient(135deg, #8A47B5, #B77BDD); }
.cp-access__btn--revoke { border-color: rgba(255, 107, 107, .34); background: rgba(255, 107, 107, .10); color: #FFC9C9; }
.cp-access__btn--revoke:hover { background: rgba(255, 107, 107, .18); border-color: rgba(255, 107, 107, .6); }
.cp-access__btn--resume { border-color: rgba(37, 211, 138, .34); background: rgba(37, 211, 138, .10); color: #B7F2D6; }
.cp-access__btn--resume:hover:not(:disabled) { background: rgba(37, 211, 138, .18); border-color: rgba(37, 211, 138, .6); }

/* --------------------------- Thẻ trạng thái trong chat ------------------- */
.cp-read-card {
  margin: 8px 0 10px 32px;
  padding: 10px 12px;
  border-radius: var(--tps-radius-sm);
  border: 1px solid var(--tps-border);
  background: rgba(15, 22, 29, .82);
  font-size: 12px;
}
.cp-read-card.is-ready { border-color: rgba(37, 211, 138, .28); background: rgba(14, 32, 26, .5); }
.cp-read-card.is-error { border-color: rgba(255, 107, 107, .28); background: rgba(34, 16, 18, .5); }
.cp-read-card.is-reading { border-color: var(--tps-accent-line); background: rgba(24, 16, 32, .5); }

.cp-read-card__head { display: flex; align-items: center; gap: 7px; }
.cp-read-card__title { color: var(--tps-text); font-weight: 600; }
.cp-read-card__ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex: 0 0 auto; border-radius: 50%;
  font-size: 10px; font-weight: 700;
}
.cp-read-card__ico.is-ok { background: rgba(37, 211, 138, .18); color: var(--tps-ok); }
.cp-read-card__ico.is-bad { background: rgba(255, 107, 107, .18); color: var(--tps-down); }
.cp-read-card__spin {
  width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%;
  border: 1.6px solid var(--tps-accent-line); border-top-color: var(--tps-accent);
  animation: cp-access-rotate .8s linear infinite;
}
.cp-read-card__meta { margin-top: 4px; color: var(--tps-muted); font-size: 11.5px; line-height: 1.45; }
.cp-read-card__acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cp-read-card__btn {
  appearance: none; cursor: pointer;
  border-radius: 999px; padding: 4px 11px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--tps-accent-line);
  background: var(--tps-accent-soft);
  color: #E9D9F5;
  transition: background .16s ease, border-color .16s ease;
}
.cp-read-card__btn:hover:not(:disabled) { background: rgba(168, 107, 209, .26); border-color: var(--tps-accent); }
.cp-read-card__btn--resume { border-color: rgba(37, 211, 138, .36); background: rgba(37, 211, 138, .12); color: #B7F2D6; }
.cp-read-card__btn--revoke { border-color: rgba(255, 107, 107, .32); background: rgba(255, 107, 107, .10); color: #FFC9C9; }
.cp-read-card__btn:disabled { opacity: .45; cursor: not-allowed; }

/* Ghi chú hệ thống (tắt quyền, đổi chế độ) */
.cp-note-sys {
  margin: 8px 0 10px;
  padding: 7px 10px;
  border-left: 2px solid var(--tps-accent-line);
  background: rgba(168, 107, 209, .07);
  border-radius: 0 var(--tps-radius-sm) var(--tps-radius-sm) 0;
  color: var(--tps-text-2);
  font-size: 11.5px;
  line-height: 1.45;
}

/* CTA ở màn chào (chế độ chung) */
.cp-empty__cta {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 8px 14px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--tps-accent-deep), var(--tps-accent));
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .1px;
  box-shadow: 0 6px 18px rgba(123, 63, 163, .34);
  transition: transform .14s ease, box-shadow .14s ease;
}
.cp-empty__cta:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(123, 63, 163, .42); }

/* ==========================================================================
   POPUP CẤP QUYỀN — Smart OTP mô phỏng
   ========================================================================== */
body.cp-consent-open { overflow: hidden; }

.cp-consent-overlay {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(2, 5, 8, .72);
  backdrop-filter: blur(10px) saturate(112%);
  -webkit-backdrop-filter: blur(10px) saturate(112%);
  animation: cp-consent-fade .16s ease-out;
}
@keyframes cp-consent-fade { from { opacity: 0; } to { opacity: 1; } }

.cp-consent {
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  display: flex; flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--tps-border);
  background:
    radial-gradient(120% 90% at 0% -10%, rgba(168, 107, 209, .16), transparent 60%),
    linear-gradient(180deg, rgba(17, 24, 32, .98), rgba(8, 12, 17, .99));
  box-shadow: 0 30px 70px rgba(0, 0, 0, .62), 0 0 0 1px rgba(168, 107, 209, .08) inset;
  color: var(--tps-text);
  animation: cp-consent-rise .2s cubic-bezier(.22, .9, .3, 1);
  overflow: hidden;
}
@keyframes cp-consent-rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

.cp-consent.has-error { border-color: rgba(255, 107, 107, .38); }

.cp-consent__head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--tps-border-soft);
  background: linear-gradient(180deg, rgba(168, 107, 209, .10), transparent);
}
.cp-consent__mark {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--tps-accent-deep), var(--tps-accent));
  color: #fff; font-size: 15px;
  box-shadow: 0 6px 16px rgba(123, 63, 163, .38);
}
.cp-consent__headtxt { min-width: 0; flex: 1 1 auto; }
.cp-consent__brand {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--tps-accent); font-weight: 700;
}
.cp-consent__title { margin: 2px 0 0; font-size: 15.5px; line-height: 1.3; font-weight: 700; }
.cp-consent__x {
  appearance: none; border: 1px solid var(--tps-border); background: rgba(252, 252, 254, .04);
  color: var(--tps-text-2); width: 28px; height: 28px; border-radius: 8px;
  font-size: 17px; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.cp-consent__x:hover { background: rgba(255, 107, 107, .14); border-color: rgba(255, 107, 107, .4); color: #FFC9C9; }

.cp-consent__body {
  padding: 14px 16px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(207, 213, 222, .2) transparent;
}

.cp-consent__scope {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--tps-radius-sm);
  border: 1px solid var(--tps-accent-line);
  background: var(--tps-accent-soft);
  color: #F1E6F8;
  font-size: 12.5px;
  line-height: 1.55;
}

.cp-consent__label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--tps-muted); font-weight: 700; margin-bottom: 6px;
}

.cp-consent__sublist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cp-consent__subrow {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--tps-border);
  border-radius: var(--tps-radius-sm);
  background: rgba(252, 252, 254, .03);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.cp-consent__subrow:hover { border-color: var(--tps-accent-line); background: rgba(168, 107, 209, .08); }
.cp-consent__subrow:has(input:checked) { border-color: var(--tps-accent); background: rgba(168, 107, 209, .12); }
.cp-consent__cb {
  appearance: none; width: 17px; height: 17px; flex: 0 0 auto;
  border: 1.5px solid rgba(252, 252, 254, .28); border-radius: 5px;
  background: transparent; cursor: pointer; position: relative;
}
.cp-consent__cb:checked { background: var(--tps-accent); border-color: var(--tps-accent); }
.cp-consent__cb:checked::after {
  content: ''; position: absolute; left: 5px; top: 1.5px;
  width: 4px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}
.cp-consent__subid { font-family: var(--tps-font-num); font-size: 12.5px; font-weight: 600; letter-spacing: .3px; }
.cp-consent__subkind {
  margin-left: auto; font-size: 10.5px; font-weight: 600;
  color: var(--tps-text-2); padding: 2px 8px; border-radius: 999px;
  background: rgba(252, 252, 254, .06); border: 1px solid var(--tps-border-soft);
}

.cp-consent__gchips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.cp-consent__gchip {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  color: var(--tps-text-2);
  border: 1px solid var(--tps-border);
  background: rgba(252, 252, 254, .035);
}

.cp-consent__notes {
  margin: 0 0 14px; padding-left: 16px;
  color: var(--tps-muted); font-size: 11.5px; line-height: 1.5;
}
.cp-consent__notes li { margin-bottom: 3px; }

/* --- khối Smart OTP --- */
.cp-consent__otp {
  border: 1px solid var(--tps-border);
  border-radius: var(--tps-radius);
  background: linear-gradient(180deg, rgba(24, 33, 43, .7), rgba(12, 18, 24, .7));
  padding: 12px;
}
.cp-consent__otphead { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 10px; }
.cp-consent__otpico {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(168, 107, 209, .16); color: #DCC6EE; font-size: 14px;
}
.cp-consent__otplabel { font-size: 12.5px; font-weight: 700; color: #F1E6F8; }
.cp-consent__otphint { font-size: 11px; color: var(--tps-muted); line-height: 1.45; margin-top: 2px; }

.cp-consent__field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cp-consent__input {
  flex: 1 1 170px;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--tps-radius-sm);
  border: 1px solid rgba(252, 252, 254, .16);
  background: rgba(3, 8, 10, .72);
  color: var(--tps-text);
  font-family: var(--tps-font-num);
  font-size: 19px;
  letter-spacing: 8px;
  text-align: center;
}
.cp-consent__input::placeholder { font-size: 12px; letter-spacing: 0; color: var(--tps-muted); font-family: var(--tps-font); }
.cp-consent__input:focus { outline: none; border-color: var(--tps-accent); box-shadow: 0 0 0 3px var(--tps-accent-soft); }

.cp-consent__expiry { font-size: 11px; color: var(--tps-muted); font-variant-numeric: tabular-nums; }
.cp-consent__expiry.is-out { color: var(--tps-warn); }

.cp-consent__err {
  display: none;
  margin-top: 9px;
  padding: 7px 10px;
  border-radius: var(--tps-radius-sm);
  border: 1px solid rgba(255, 107, 107, .34);
  background: rgba(255, 107, 107, .1);
  color: #FFC9C9;
  font-size: 11.5px;
  line-height: 1.45;
}
.cp-consent__err.is-on { display: block; }

.cp-consent__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--tps-border-soft);
}
.cp-consent__btn {
  appearance: none; cursor: pointer;
  height: 38px; padding: 0 16px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.cp-consent__btn--ghost {
  border: 1px solid var(--tps-border);
  background: transparent; color: var(--tps-text-2);
}
.cp-consent__btn--ghost:hover { background: rgba(252, 252, 254, .06); color: var(--tps-text); }
.cp-consent__btn--primary {
  border: 0;
  background: linear-gradient(135deg, var(--tps-accent-deep), var(--tps-accent));
  color: #fff;
  box-shadow: 0 8px 20px rgba(123, 63, 163, .34);
}
.cp-consent__btn--primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(123, 63, 163, .44); }
.cp-consent__btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ------------------------------- Mobile -------------------------------- */
@media (max-width: 720px) {
  .cp-access-host { padding: 0 8px 6px; }
  .cp-access { font-size: 11px; padding: 7px 8px; gap: 7px; }
  .cp-access__acts { width: 100%; }
  .cp-access__btn { flex: 1 1 auto; text-align: center; padding: 6px 8px; }
  .cp-read-card { margin-left: 0; }

  .cp-consent-overlay { padding: 0; align-items: flex-end; }
  .cp-consent {
    width: 100%;
    max-height: 94dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    animation: cp-consent-sheet .22s cubic-bezier(.22, .9, .3, 1);
  }
  @keyframes cp-consent-sheet { from { transform: translateY(100%); } to { transform: none; } }
  .cp-consent__head { padding: 14px 14px 10px; }
  .cp-consent__title { font-size: 14.5px; }
  .cp-consent__body { padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .cp-consent__scope { font-size: 12px; }
  .cp-consent__input { height: 46px; font-size: 20px; letter-spacing: 7px; }
  .cp-consent__foot { flex-direction: column-reverse; align-items: stretch; gap: 8px; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .cp-consent__btn { width: 100%; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-access__dot, .cp-access__spin, .cp-read-card__spin,
  .cp-consent, .cp-consent-overlay { animation: none !important; }
  .cp-empty__cta:hover, .cp-consent__btn--primary:hover:not(:disabled) { transform: none; }
}

/* ==========================================================================
   DANH MỤC — MÀN MỞ ĐẦU CỦA TÀI KHOẢN
   --------------------------------------------------------------------------
   .pf-top        hàng đầu hai cột: thẻ NAV bên trái, "Cơ cấu tài sản" bên phải
                  (máy hẹp xếp dọc, NAV trước; không tràn ngang).
   .pf-navbox     thẻ "Tài sản ròng" mở màn: che số mặc định, nút con mắt đổi
                  trạng thái tại chỗ (aria-pressed + aria-controls).
   .pf-detailbar  nút "Hiển thị đầy đủ" nằm ngay dưới hàng hai cột.
   .pf-full       khối chi tiết bung/thu inline bằng grid-template-rows 0fr↔1fr
                  (không cần đo chiều cao bằng JS, không nhảy bố cục).
   .pf-alloc      cột phải: donut tỷ trọng (component dùng chung, mặc định thu
                  gọn) + giá trị thị trường chỉ hiện khi trang mở đầy đủ.
   Chỉ dùng lại token Obsidian Dark sẵn có; không thêm tông màu mới.
   ========================================================================== */

/* Vùng chữ chỉ dành cho trình đọc màn hình (nhãn/trạng thái của shell) */
.tps-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---- Thẻ NAV mở màn ---------------------------------------------------- */
.pf-navbox {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  margin-bottom: 0;
  padding: 20px 22px 18px;
  border-radius: 16px;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(255, 255, 255, .1), transparent 58%),
    var(--tps-accent-deep);
  color: #FCFCFE;
  box-shadow: 0 20px 46px rgba(0, 0, 0, .44);
}

.pf-navbox__main { min-width: 0; flex: 1 1 auto; }
.pf-navbox__labelrow { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.pf-navbox__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .66);
}

.pf-navbox__valuerow { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.pf-navbox__value {
  display: block;
  min-width: 0;
  font-family: var(--tps-font-num);
  font-size: 36px;
  line-height: 1.08;
  font-weight: 750;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #FCFCFE;
}
/* Số đang che: giãn chữ để dấu sao đọc được, không bị nhầm là số 0 */
.pf-navbox__value[data-pf-hidden="1"] { letter-spacing: 3px; color: rgba(255, 255, 255, .84); }
.pf-navbox__value.is-empty { color: rgba(255, 255, 255, .7); }

.pf-navbox__eye {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 11px;
  background: rgba(255, 255, 255, .08);
  color: #FCFCFE;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.pf-navbox__eye:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .52); }
.pf-navbox__eye:focus-visible { outline: 2px solid #FCFCFE; outline-offset: 2px; }
.pf-navbox__eye[aria-pressed="true"] { background: #FCFCFE; border-color: #FCFCFE; color: #14091C; }
/* Ẩn số → icon mắt mở (bấm để hiện); đang hiện → icon mắt gạch (bấm để ẩn) */
.pf-navbox__eye[aria-pressed="false"] .pf-navbox__ico--off { display: none; }
.pf-navbox__eye[aria-pressed="true"] .pf-navbox__ico--on { display: none; }
.pf-navbox__eye[disabled] { opacity: .45; cursor: not-allowed; }

/* Sức mua trong thẻ tím: cùng trạng thái che với NAV, tách bằng đường mảnh */
.pf-navbox__bp {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}
.pf-navbox__bp-labelrow { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.pf-navbox__bp-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .66);
}
.pf-navbox__bp-value {
  font-family: var(--tps-font-num);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #FCFCFE;
}
.pf-navbox__bp-value[data-pf-hidden="1"] { letter-spacing: 2px; color: rgba(255, 255, 255, .84); }

.pf-navbox__meta { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: rgba(255, 255, 255, .74); }
.pf-navbox__meta b { color: #FCFCFE; font-weight: 650; }
.pf-navbox__hint { margin: 4px 0 0; font-size: 11px; line-height: 1.45; color: rgba(255, 255, 255, .6); }
.pf-navbox__side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pf-navbox .pf-hero__btn { height: 38px; }
.pf-navbox .pf-info-btn { color: rgba(216, 196, 236, .72); }

/* ---- Thanh nút bung/thu chi tiết -------------------------------------- */
.pf-detailbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 1px solid var(--tps-border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(21, 30, 40, .72), rgba(10, 15, 20, .66));
}
.pf-detailbar__hint { margin: 0; min-width: 0; font-size: 11.5px; line-height: 1.45; color: var(--tps-muted); }
.pf-detailbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--tps-accent-line);
  border-radius: 9px;
  background: var(--tps-accent-soft);
  color: var(--tps-text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pf-detailbar__btn:hover { background: rgba(168, 107, 209, .2); border-color: var(--tps-accent); }
.pf-detailbar__btn:focus-visible { outline: 2px solid var(--tps-accent); outline-offset: 2px; }
.pf-detailbar__chev { transition: transform .24s ease; }
.pf-detailbar[data-open="1"] .pf-detailbar__chev { transform: rotate(90deg); }

/* ---- Khối chi tiết bung inline ---------------------------------------- */
/* Chiều cao do JS đặt theo số đo thật (0 → px → auto). Grid 0fr→1fr bị
   Chromium kẹp 0px khi khung cao auto, nên không dùng. */
.pf-full {
  height: 0;
  overflow: hidden;
}
.pf-full__inner { min-width: 0; }
.pf-full .pf-hero { margin-bottom: 14px; box-shadow: 0 16px 34px rgba(0, 0, 0, .36); }

/* ---- Cột phải mở màn: "Cơ cấu tài sản" -------------------------------- */
/* Hàng đầu hai cột: NAV bên trái, cơ cấu tài sản bên phải; máy hẹp xếp dọc
   (NAV trước). Cân đối chiều cao: cụm donut thu gọn + chú giải không cao vống
   hơn thẻ NAV — trong thẻ này, máy rộng chia chú giải compact thành hai cột. */
.pf-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 12px;
}
/* Bản thu gọn: thẻ NAV cao bằng thẻ cơ cấu bên phải (cùng một hàng lưới).
   Khi mở đầy đủ, thẻ phải dài ra theo chú giải + khối giá trị nên thẻ NAV
   trả về chiều cao nội dung, tránh một khối tím rỗng rất cao. */
.pf-top[data-pf-full="1"] { align-items: start; }

.pf-alloc {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 15px 16px 14px;
  border: 1px solid var(--tps-border);
  border-radius: 16px;
  background: var(--tps-surface);
}
.pf-alloc__head { min-width: 0; }
.pf-alloc__title { margin: 0; font-size: 15px; font-weight: 750; letter-spacing: -.2px; }
.pf-alloc__sub { margin: 3px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--tps-muted); }
.pf-alloc__sub b { color: var(--tps-text-2); font-weight: 650; }

.pf-alloc__chart { min-width: 0; min-height: 0; margin-top: 10px; display: flex; align-items: center; }
.pf-alloc__chart .tpa { width: 100%; --tpa-seam: var(--tps-surface); }
/* Chế độ xem chỉ do nút "Hiển thị đầy đủ" của trang điều khiển. */
#pf-alloc .tpa__foot { display: none; }
/* Cân chiều cao với thẻ NAV bên trái: ở bản thu gọn trên máy rộng, donut nhỏ
   lại và chú giải chia hai cột. Bề rộng mỗi ô vẫn đủ cho cả nhãn dài (tiền bán
   chờ về / tiền mặt ghi sổ) nên không cắt chữ; máy hẹp để component tự xếp. */
@media (min-width: 1041px) {
  #pf-alloc .tpa[data-pa-view="compact"] .tpa__body {
    grid-template-columns: minmax(0, 128px) minmax(0, 1fr);
    gap: 10px 12px;
  }
  #pf-alloc .tpa[data-pa-view="compact"] .tpa__chartwrap { max-width: 128px; }
  #pf-alloc .tpa[data-pa-view="compact"] .tpa__legend {
    display: grid;
    /* Đủ chỗ mới chia hai cột; hẹp hơn thì tự về một cột — nhãn dài không bị cắt. */
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
    gap: 0 6px;
  }
  #pf-alloc .tpa[data-pa-view="compact"] .tpa__legend-item { min-height: 24px; gap: 5px; padding: 3px 4px 3px 5px; }
  #pf-alloc .tpa[data-pa-view="compact"] .tpa__legend-share { font-size: 10px; padding-left: 4px; }
  /* Câu mẫu số của component lặp lại phụ đề thẻ ("tỷ trọng trên Tổng tài sản"):
     ẩn ở bản thu gọn để cụm không cao thêm; phụ đề thẻ vẫn nói rõ mẫu số. */
  #pf-alloc .tpa[data-pa-view="compact"] .tpa__basis { display: none; }
}

/* Khối giá trị thị trường: chỉ có nội dung khi trang mở đầy đủ */
.pf-alloc__mv {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--tps-border);
}
.pf-alloc__mv[hidden] { display: none; }
.pf-alloc__mv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--tps-muted);
}
.pf-alloc__mv-label { min-width: 0; }
.pf-alloc__mv-num {
  flex: 0 0 auto;
  font-family: var(--tps-font-num);
  font-size: 12px;
  font-weight: 650;
  color: var(--tps-text);
  white-space: nowrap;
}

.pf-alloc__foot { display: flex; justify-content: flex-end; margin-top: auto; padding-top: 10px; }
.pf-alloc__more {
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--tps-border);
  border-radius: 8px;
  background: transparent;
  color: var(--tps-text-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.pf-alloc__more:hover { background: var(--tps-accent-soft); border-color: var(--tps-accent-line); color: var(--tps-text); }
.pf-alloc__more:focus-visible { outline: 2px solid var(--tps-accent); outline-offset: 2px; }

/* Bảng danh mục đầy đủ mặc định ẩn; nút "Bảng danh mục đầy đủ" / deep-link mở. */
#pf-holdings-card[hidden] { display: none !important; }

/* ---- Dự phòng khi thiếu component donut (chỉ hiện tỷ trọng) ----------- */
.pf-sharebar { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.pf-sharebar__bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: rgba(252, 252, 254, .06); }
.pf-sharebar__seg { display: block; height: 100%; }
.pf-sharebar__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 2px 10px;
}
.pf-sharebar__item { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11px; color: var(--tps-text-2); }
.pf-sharebar__dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 2px; }
.pf-sharebar__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-sharebar__pct { margin-left: auto; font-family: var(--tps-font-num); font-weight: 650; }
.pf-sharebar__empty { margin: 0; font-size: 11.5px; color: var(--tps-muted); }

/* ---- Máy hẹp: một cột (NAV trước, cơ cấu tài sản sau), chạm 44px ------ */
@media (max-width: 1040px) {
  .pf-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .pf-navbox { padding: 16px 16px 15px; border-radius: 14px; }
  .pf-navbox__main { flex: 1 1 100%; }
  .pf-navbox__value { font-size: 29px; letter-spacing: -.6px; }
  .pf-navbox__value[data-pf-hidden="1"] { letter-spacing: 2px; }
  .pf-navbox__bp-value { font-size: 16px; }
  .pf-navbox__eye { width: 44px; height: 44px; }
  .pf-navbox__side { width: 100%; }
  .pf-navbox__side .pf-hero__btn { flex: 1 1 0; height: 42px; }
  .pf-detailbar { padding: 8px 10px; }
  .pf-detailbar__hint { font-size: 11px; }
  .pf-detailbar__btn { flex: 1 1 auto; justify-content: center; height: 40px; }
  .pf-alloc { padding: 13px 12px 12px; border-radius: 14px; }
  .pf-alloc__more { height: 36px; }
  .pf-alloc__more:active { background: var(--tps-accent-soft); }
}

@media (prefers-reduced-motion: reduce) {
  .pf-detailbar__chev { transition: none; }
}

@media (forced-colors: active) {
  .pf-navbox__eye { border-color: ButtonText; }
  .pf-detailbar__btn { border-color: ButtonText; }
}
/* ---- Shell: nút "Tới nội dung chính" (chỉ hiện khi focus bàn phím) ----- */
.skip-link {
  position: fixed;
  left: 12px;
  top: 10px;
  z-index: 3000;
  padding: 9px 14px;
  border: 1px solid var(--tps-accent-line);
  border-radius: 10px;
  background: #0A0F14;
  color: var(--tps-text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transform: translateY(-160%);
  transition: transform .16s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--tps-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}
