/* ==========================================================================
   TPS iTRADE × AI COPILOT — Shell design system (dark trading terminal)
   --------------------------------------------------------------------------
   Tầng bề mặt (đậm → sáng):
     --tps-bg       nền workspace sâu nhất
     --tps-surface  thẻ / dock (nổi trên nền)
     --tps-surface-2/3  bề mặt nâng: header thẻ, input nổi, trạng thái active
   Brand: cam TPS cho hành động & focus · tím cho AI Copilot.
   Sở hữu: PARENT AGENT. Sub-agent KHÔNG sửa file này.
   ========================================================================== */

:root {
  /* ---- Bề mặt 3 tầng (tên biến là hợp đồng — giá trị tự do) ---- */
  --tps-bg: #0d0a16;
  --tps-bg-2: #131020;
  --tps-surface: #181524;
  --tps-surface-2: #1e1a2c;
  --tps-surface-3: #272134;

  --tps-border: #322b45;
  --tps-border-soft: rgba(244, 242, 248, .06);

  --tps-text: #f4f2f8;
  --tps-text-2: #d0cbd9;
  --tps-muted: #9b93ab;

  /* ---- Giá / trạng thái thị trường ---- */
  --tps-up: #2fd876;
  --tps-down: #ff453a;
  --tps-ref: #f2d24b;
  --tps-ceiling: #fb3dfa;
  --tps-floor: #00f5f3;

  /* ---- Trạng thái nghiệp vụ ---- */
  --tps-ok: #2ee56b;
  --tps-warn: #ffc23d;
  --tps-info: #4aa8ff;

  /* ---- Brand ---- */
  --tps-orange: #ff9800;
  --tps-orange-line: rgba(255, 152, 0, .45);
  --tps-orange-soft: rgba(255, 152, 0, .12);
  --tps-violet: #a06ce8;
  --tps-violet-soft: rgba(160, 108, 232, .14);
  --tps-accent: #6b349f;
  --tps-purple-deep: #461e64;

  --tps-radius: 10px;
  --tps-radius-sm: 7px;
  --tps-shadow: 0 16px 44px rgba(5, 2, 12, .55);

  --tps-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tps-font-num: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", "Segoe UI Mono", monospace;

  --it-rail-w: 72px;
  --it-copilot-w: 430px;
  --it-strip-h: 64px;
  --it-topbar-h: 50px;
  --it-toolbar-h: 44px;
}

/* ==========================================================================
   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.45;
  -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(147, 82, 206, .45); color: #fff; }

:focus-visible {
  outline: 2px solid rgba(255, 152, 0, .65);
  outline-offset: 2px;
}

html { scrollbar-width: thin; scrollbar-color: #3a334d transparent; }

/* ==========================================================================
   1. STICKY — dải chỉ số · topbar · toolbar
   ========================================================================== */
.it-sticky { flex: 0 0 auto; position: relative; z-index: 40; }

/* ---- 1.1 Dải chỉ số — hàng ticker mỏng trên cùng ---- */
.it-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  height: var(--it-strip-h);
  background: var(--tps-border-soft);
  border-bottom: 1px solid var(--tps-border);
}
.it-index {
  background: var(--tps-bg);
  padding: 7px 18px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}
.it-index__head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.it-index__name {
  font-size: 10px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
  color: var(--tps-text-2);
  white-space: nowrap;
}
.it-index__state {
  font-size: 9px; font-weight: 600; letter-spacing: .3px;
  color: var(--tps-muted);
  padding: 1px 7px;
  border: 1px solid var(--tps-border);
  border-radius: 99px;
  background: rgba(244, 242, 248, .03);
  white-space: nowrap;
}
.it-index__body { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.it-index__value {
  font-family: var(--tps-font-num);
  font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.it-index__chg {
  font-family: var(--tps-font-num);
  font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: baseline; gap: 4px;
  white-space: nowrap;
}
.it-index__chg i { font-style: normal; opacity: .72; font-weight: 500; }
.it-index__meta {
  display: flex; gap: 14px;
  font-size: 10px; color: var(--tps-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.it-index__meta b { color: var(--tps-text-2); font-weight: 600; }

/* ---- 1.2 Topbar — logo · đồng hồ · tìm · KPI · tài khoản ---- */
.it-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--it-topbar-h);
  padding: 0 14px 0 12px;
  background: var(--tps-surface);
  border-bottom: 1px solid var(--tps-border);
}

.it-logo {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--tps-orange);
  flex: 0 0 auto;
}
.it-logo__mark {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(155deg, rgba(255, 152, 0, .22), rgba(255, 152, 0, .05));
  border: 1px solid var(--tps-orange-line);
}
.it-logo__word { display: flex; flex-direction: column; line-height: 1.08; }
.it-logo__word b {
  font-size: 15px; font-weight: 800; letter-spacing: 1.4px;
  color: var(--tps-text);
}
.it-logo__word i {
  font-style: normal; font-size: 7.5px; font-weight: 700;
  letter-spacing: .72px; color: var(--tps-muted);
  text-transform: uppercase;
}

.it-clock {
  font-family: var(--tps-font-num);
  font-size: 11.5px; font-weight: 500;
  color: var(--tps-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
  padding-left: 12px;
  border-left: 1px solid var(--tps-border-soft);
}

.it-search {
  position: relative;
  display: flex; align-items: center;
  gap: 7px;
  width: 226px; height: 30px;
  padding: 0 11px;
  background: var(--tps-bg-2);
  border: 1px solid var(--tps-border);
  border-radius: var(--tps-radius-sm);
  color: var(--tps-muted);
  flex: 0 0 auto;
  transition: border-color .15s, box-shadow .15s;
}
.it-search:focus-within {
  border-color: var(--tps-orange-line);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, .14);
}
.it-search input {
  flex: 1 1 auto; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--tps-text); font-family: inherit; font-size: 12.5px;
}
.it-search input::placeholder { color: #6e667f; }

/* ---- KPI: nhóm chip tài chính gọn — nhãn mờ, số nổi ---- */
.it-kpis { display: flex; align-items: stretch; margin-left: auto; }
.it-kpi {
  display: flex; flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 3px 14px;
  border-left: 1px solid var(--tps-border-soft);
  min-width: 94px;
}
.it-kpi__label {
  font-size: 9.5px; font-weight: 600; color: var(--tps-muted);
  letter-spacing: .4px; text-transform: uppercase;
  white-space: nowrap;
}
.it-kpi__value {
  font-family: var(--tps-font-num);
  font-size: 13.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.1px;
  white-space: nowrap;
}
.it-kpi__value.is-up { color: var(--tps-up); }
.it-kpi__value.is-down { color: var(--tps-down); }
.it-kpi__value.is-warn { color: var(--tps-warn); }

.it-account {
  display: flex; align-items: center; gap: 9px;
  padding-left: 14px;
  border-left: 1px solid var(--tps-border-soft);
  flex: 0 0 auto;
}
.it-account__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  color: #1c1226;
  background: linear-gradient(150deg, #ffc46b, var(--tps-orange));
}
.it-account__meta { display: flex; flex-direction: column; line-height: 1.25; }
.it-account__name { font-size: 11.5px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.it-account__id { font-size: 10px; color: var(--tps-muted); font-variant-numeric: tabular-nums; }
.it-account__id b { color: var(--tps-text-2); font-weight: 600; }

/* ---- 1.3 Toolbar — chip sàn & công cụ ---- */
.it-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--it-toolbar-h);
  padding: 0 12px;
  background: var(--tps-bg);
  border-bottom: 1px solid var(--tps-border);
  overflow: hidden;
}
.it-toolbar__left {
  display: flex; align-items: center; gap: 3px;
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.it-toolbar__left::-webkit-scrollbar { display: none; }
.it-toolbar__right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }

.it-chip {
  appearance: none;
  display: inline-flex; align-items: center; gap: 5px;
  height: 27px;
  padding: 0 11px;
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  color: var(--tps-text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--tps-radius-sm);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background .14s, color .14s, border-color .14s;
}
.it-chip:hover { background: rgba(244, 242, 248, .06); color: var(--tps-text); }
.it-chip.is-active {
  color: #ffd9a3;
  background: rgba(255, 152, 0, .14);
  border-color: rgba(255, 152, 0, .4);
}
.it-chip--select {
  background: var(--tps-surface-2);
  border-color: var(--tps-border);
  color: var(--tps-text);
  font-weight: 700;
  margin-right: 4px;
}
.it-chip--select:hover { background: var(--tps-surface-3); }
.it-chip-sep {
  width: 1px; height: 16px;
  background: rgba(244, 242, 248, .1);
  margin: 0 5px;
  flex: 0 0 1px;
}

.it-flag-margin {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 9px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .2px;
  color: var(--tps-muted);
  border: 1px dashed var(--tps-border);
  border-radius: var(--tps-radius-sm);
  white-space: nowrap;
}

.it-subacc { display: flex; align-items: center; gap: 6px; }
.it-subacc label { font-size: 10px; font-weight: 600; color: var(--tps-muted); letter-spacing: .2px; }
.it-select {
  appearance: none;
  height: 27px;
  max-width: 210px;
  padding: 0 24px 0 9px;
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--tps-text);
  background: var(--tps-surface-2)
    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='%239b93ab'/></svg>")
    no-repeat right 8px center;
  border: 1px solid var(--tps-border);
  border-radius: var(--tps-radius-sm);
  cursor: pointer;
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.it-select:focus {
  border-color: var(--tps-orange-line);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, .14);
}

.it-iconbtn {
  display: grid; place-items: center;
  width: 29px; height: 29px;
  color: var(--tps-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--tps-radius-sm);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .14s, color .14s, border-color .14s;
}
.it-iconbtn:hover {
  color: var(--tps-text);
  background: rgba(244, 242, 248, .06);
  border-color: var(--tps-border);
}
.it-iconbtn.is-on {
  color: var(--tps-orange);
  border-color: var(--tps-orange-line);
  background: var(--tps-orange-soft);
}

/* ==========================================================================
   2. WORKSPACE — rail · viewport · copilot dock
   ========================================================================== */
.it-workspace, .tps-main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
  background: var(--tps-bg);
}

/* ---- 2.1 Rail trái — icon + nhãn 10px, active có accent cam ---- */
.it-rail {
  flex: 0 0 var(--it-rail-w);
  width: var(--it-rail-w);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 8px 6px 10px;
  background: var(--tps-surface);
  border-right: 1px solid var(--tps-border);
  overflow-y: auto;
  scrollbar-width: none;
}
.it-rail::-webkit-scrollbar { display: none; }

.it-rail__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 54px;
  padding: 0 2px;
  border-radius: 9px;
  color: var(--tps-muted);
  text-decoration: none;
  border-bottom: none;
  transition: background .14s, color .14s;
  flex: 0 0 auto;
}
.it-rail__item svg { opacity: .92; }
.it-rail__item span {
  font-size: 10px; font-weight: 600; letter-spacing: .1px;
  line-height: 1; white-space: nowrap;
}
.it-rail__item:hover { color: var(--tps-text); background: rgba(244, 242, 248, .05); }
.it-rail__item.is-active {
  color: var(--tps-text);
  background: rgba(255, 152, 0, .09);
}
.it-rail__item.is-active svg { color: var(--tps-orange); opacity: 1; }
.it-rail__item.is-active::before {
  content: "";
  position: absolute;
  left: -6px; top: 13px; bottom: 13px;
  width: 3px;
  border-radius: 99px;
  background: var(--tps-orange);
}

.it-rail__sep {
  height: 1px; margin: 6px 8px;
  background: var(--tps-border-soft);
  flex: 0 0 1px;
}
.it-rail__spacer { flex: 1 1 auto; }

/* Nút AI cuối rail — tím là màu riêng của Copilot */
.it-rail__ai {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  height: 56px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(165deg, #8b4fd6, var(--tps-accent));
  border: 1px solid rgba(178, 128, 245, .38);
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(75, 32, 122, .4);
  flex: 0 0 auto;
  transition: filter .14s, box-shadow .14s;
}
.it-rail__ai span { font-size: 9.5px; font-weight: 800; letter-spacing: .8px; }
.it-rail__ai:hover { filter: brightness(1.12); }
.it-rail__ai.is-on {
  border-color: rgba(178, 128, 245, .7);
  box-shadow: 0 0 0 2px rgba(139, 79, 214, .35), 0 5px 16px rgba(75, 32, 122, .4);
}

/* ---- 2.2 Viewport giữa ---- */
.it-viewport, .tps-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  padding: 16px 18px 30px;
  scrollbar-width: thin;
  scrollbar-color: #3a334d transparent;
}
.it-viewport::-webkit-scrollbar, .tps-viewport::-webkit-scrollbar { width: 9px; height: 9px; }
.it-viewport::-webkit-scrollbar-thumb, .tps-viewport::-webkit-scrollbar-thumb {
  background: #3a334d; border-radius: 6px;
}
.it-viewport::-webkit-scrollbar-track { background: transparent; }

/* ---- 2.3 Copilot dock phải — nền surface khác biệt, viền trái phân tách ---- */
.it-copilot, .tps-copilot {
  flex: 0 0 var(--it-copilot-w);
  width: var(--it-copilot-w);
  min-width: 372px;
  border-left: 1px solid var(--tps-border);
  background: var(--tps-surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.it-copilot, #ai-copilot-panel { display: flex; flex-direction: column; min-height: 0; }
.it-copilot.is-collapsed { display: none; }

.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. SHARED COMPONENTS — dùng chung cho mọi module
   ========================================================================== */

/* ---- Đầu trang module ---- */
.tps-page-head {
  display: flex; align-items: flex-end; gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tps-page-head__title {
  font-size: 17px; font-weight: 700; margin: 0;
  letter-spacing: .1px; line-height: 1.25;
}
.tps-page-head__sub { font-size: 11.5px; color: var(--tps-muted); margin: 3px 0 0; }
.tps-page-head__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

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

/* ---- Thẻ ---- */
.tps-card {
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  border-radius: var(--tps-radius);
  overflow: hidden;
}
.tps-card + .tps-card { margin-top: 14px; }
.tps-card__head {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px;
  background: var(--tps-surface-2);
  border-bottom: 1px solid var(--tps-border-soft);
}
.tps-card__title {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--tps-text-2);
}
.tps-card__head-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.tps-card__body { padding: 14px; }
.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)); }
@media (max-width: 1420px) {
  .tps-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Khối số liệu ---- */
.tps-stat {
  padding: 12px 14px;
  border: 1px solid var(--tps-border-soft);
  border-radius: 9px;
  background: var(--tps-surface-2);
}
.tps-stat__label {
  font-size: 10px; font-weight: 600; color: var(--tps-muted);
  letter-spacing: .4px; text-transform: uppercase;
}
.tps-stat__value {
  font-family: var(--tps-font-num);
  font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 3px; letter-spacing: -.2px;
  line-height: 1.2;
}
.tps-stat__note { font-size: 10.5px; color: var(--tps-muted); margin-top: 3px; }
.tps-stat--accent {
  border-color: rgba(160, 108, 232, .38);
  background: linear-gradient(165deg, rgba(107, 52, 159, .3), rgba(107, 52, 159, .05)), var(--tps-surface-2);
}
.tps-stat--warn {
  border-color: rgba(255, 69, 58, .38);
  background: linear-gradient(165deg, rgba(255, 69, 58, .12), rgba(255, 69, 58, .02)), var(--tps-surface-2);
}

/* ---- Bảng ---- */
.tps-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tps-table th, .tps-table thead th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  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: 38px;
  padding: 0 12px;
  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(147, 82, 206, .09); }
.tps-table tbody tr.is-selected { background: rgba(107, 52, 159, .3); }
.tps-table .num { text-align: right; font-family: var(--tps-font-num); white-space: nowrap; }
.tps-table .sym { font-weight: 700; letter-spacing: .3px; }

/* ---- Màu giá theo chuẩn bảng 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: 19px; padding: 0 8px;
  border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .2px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tps-badge--ok { color: #7bf0b4; background: rgba(46, 229, 107, .12); border-color: rgba(46, 229, 107, .32); }
.tps-badge--warn { color: #ffd08a; background: rgba(255, 194, 61, .13); border-color: rgba(255, 194, 61, .36); }
.tps-badge--danger { color: #ff9c92; background: rgba(255, 69, 58, .13); border-color: rgba(255, 69, 58, .38); }
.tps-badge--info { color: #a9d5ff; background: rgba(74, 168, 255, .13); border-color: rgba(74, 168, 255, .32); }
.tps-badge--muted { color: var(--tps-text-2); background: rgba(244, 242, 248, .05); border-color: var(--tps-border); }
.tps-badge--violet { color: #d4b8ff; background: var(--tps-violet-soft); border-color: rgba(160, 108, 232, .42); }

/* ---- Form ---- */
.tps-field { display: flex; flex-direction: column; gap: 5px; }
.tps-label {
  font-size: 10px; font-weight: 600; letter-spacing: .45px;
  color: var(--tps-muted); text-transform: uppercase;
}
.tps-input {
  font-family: inherit; font-size: 13px;
  height: 32px; padding: 0 11px;
  background: var(--tps-bg-2);
  border: 1px solid var(--tps-border);
  border-radius: var(--tps-radius-sm);
  color: var(--tps-text);
  outline: none;
  width: 100%;
  font-variant-numeric: tabular-nums;
  transition: border-color .14s, box-shadow .14s;
}
.tps-input:focus {
  border-color: var(--tps-orange-line);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, .14);
}
.tps-input::placeholder { color: #6e667f; }
.tps-input:disabled { opacity: .5; }

/* ---- Nút ---- */
.tps-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px;
  padding: 0 14px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  border-radius: var(--tps-radius-sm);
  border: 1px solid var(--tps-border);
  background: var(--tps-surface-3);
  color: var(--tps-text);
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .1s, filter .14s;
  white-space: nowrap;
}
.tps-btn:hover { background: #322a44; border-color: #4a4060; }
.tps-btn:active { transform: translateY(1px); }
.tps-btn:disabled { opacity: .42; cursor: not-allowed; }
.tps-btn.is-active { border-color: rgba(244, 242, 248, .3); color: var(--tps-text); }

.tps-btn--ghost { background: transparent; }
.tps-btn--ghost:hover { background: rgba(244, 242, 248, .06); }
.tps-btn--primary {
  background: linear-gradient(170deg, #8a4fd0, var(--tps-accent));
  border-color: rgba(160, 108, 232, .55);
  color: #fff; font-weight: 700;
}
.tps-btn--primary:hover { filter: brightness(1.12); background: linear-gradient(170deg, #8a4fd0, var(--tps-accent)); }
.tps-btn--accent {
  background: var(--tps-orange);
  border-color: transparent; color: #1c1226; font-weight: 700;
}
.tps-btn--accent:hover { filter: brightness(1.08); background: var(--tps-orange); }
.tps-btn--danger {
  background: rgba(255, 69, 58, .14);
  border-color: rgba(255, 69, 58, .42);
  color: #ff9c92;
}
.tps-btn--danger:hover { background: rgba(255, 69, 58, .22); border-color: rgba(255, 69, 58, .55); }
.tps-btn--sm { height: 26px; padding: 0 10px; font-size: 11px; }
.tps-btn--block { width: 100%; }

/* MUA / BÁN — nền cơ bản; screens-webtrade override trạng thái is-active */
.tps-btn.is-buy {
  background: rgba(46, 229, 107, .14);
  border-color: rgba(46, 229, 107, .45);
  color: #7bf0b4;
}
.tps-btn.is-buy:hover { background: rgba(46, 229, 107, .22); border-color: rgba(46, 229, 107, .6); }
.tps-btn.is-sell {
  background: rgba(255, 69, 58, .14);
  border-color: rgba(255, 69, 58, .45);
  color: #ff9c92;
}
.tps-btn.is-sell:hover { background: rgba(255, 69, 58, .22); border-color: rgba(255, 69, 58, .6); }

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

/* ---- Meter Rtt — màu bắt buộc theo ngữ nghĩa ký quỹ ----
   ok = xanh (an toàn) · warn = vàng hổ phách (vùng cảnh báo) · danger = đỏ (dưới ngưỡng call) */
.tps-meter {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: rgba(244, 242, 248, .09);
  overflow: hidden;
}
.tps-meter__fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s cubic-bezier(.3, .9, .3, 1);
}
.tps-meter__fill--ok { background: #2ee56b; }
.tps-meter__fill--warn { background: #ffc23d; }
.tps-meter__fill--danger { background: #ff453a; }
.tps-meter__mark {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px;
  background: rgba(244, 242, 248, .6);
}

/* ---- Khác ---- */
.tps-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--tps-muted);
  font-size: 12.5px;
}

.tps-module-missing {
  margin: 18px;
  padding: 24px;
  border: 1px dashed var(--tps-border);
  border-radius: var(--tps-radius);
  color: var(--tps-muted);
  font-size: 12.5px;
  text-align: center;
  background: var(--tps-surface);
}

/* ---- Nav item chung (khi router dựng nav ngoài rail) ---- */
.tps-navitem {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--tps-radius-sm);
  color: var(--tps-text-2);
  text-decoration: none;
  cursor: pointer;
}
.tps-navitem:hover { background: rgba(244, 242, 248, .05); color: var(--tps-text); }

/* ==========================================================================
   4. AI NAVBANNER + SPOTLIGHT — router dò stylesheet, có sẵn thì khỏi inject
   ========================================================================== */
.ai-navbanner {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  margin: 0 0 12px;
  border-radius: var(--tps-radius);
  background: linear-gradient(90deg, rgba(255, 152, 0, .15), rgba(255, 152, 0, .04));
  border: 1px solid rgba(255, 152, 0, .35);
  color: #ffd9a3;
  font-size: 12.5px;
}
.ai-navbanner__icon { color: var(--tps-orange); font-size: 14px; flex: 0 0 auto; }
.ai-navbanner__text { font-weight: 700; color: #ffd9a3; }
.ai-navbanner__msg { color: var(--tps-muted); font-size: 11.5px; margin-left: 8px; }
.ai-navbanner__close {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(244, 242, 248, .18);
  color: var(--tps-muted);
  font-family: inherit;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--tps-radius-sm);
  cursor: pointer;
  transition: color .14s, border-color .14s;
}
.ai-navbanner__close:hover { color: var(--tps-text); border-color: var(--tps-orange); }

@keyframes tpsSpot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
  50% { box-shadow: 0 0 0 9px rgba(255, 152, 0, .22); }
}
.ai-spotlight-pulse {
  outline: 2px solid rgba(255, 152, 0, .75);
  outline-offset: 3px;
  border-radius: var(--tps-radius-sm);
  animation: tpsSpot 1.1s ease-in-out 3;
}

/* Banner "AI đã điền sẵn" (dùng bởi screens-webtrade) */
.ai-prefill-banner {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: var(--tps-radius);
  background: rgba(107, 52, 159, .28);
  border: 1px solid rgba(160, 108, 232, .45);
  color: var(--tps-text);
  font-size: 12px;
}
.ai-prefill-banner b { color: #d4b8ff; }

/* ==========================================================================
   5. TOAST
   ========================================================================== */
.tps-toast-wrap {
  position: fixed;
  bottom: 20px; right: 16px;
  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: 400px;
  padding: 11px 14px;
  border-radius: var(--tps-radius);
  background: var(--tps-surface-2);
  border: 1px solid var(--tps-border);
  box-shadow: var(--tps-shadow);
  font-size: 12.2px;
  color: var(--tps-text);
  transition: opacity .35s, transform .35s;
}
.tps-toast.is-out { opacity: 0; transform: translateX(24px); }
.tps-toast__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; 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; }

/* ==========================================================================
   6. MODAL dùng chung (điều khoản, SmartOTP, cấu hình LLM)
   ========================================================================== */
.tps-modal-backdrop {
  position: fixed; inset: 0;
  z-index: 9000;
  background: rgba(6, 2, 12, .72);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 24px;
}
.tps-modal {
  width: min(560px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--tps-surface);
  border: 1px solid var(--tps-border);
  border-radius: 14px;
  box-shadow: var(--tps-shadow);
  overflow: hidden;
}
.tps-modal__head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  background: var(--tps-surface-2);
  border-bottom: 1px solid var(--tps-border-soft);
}
.tps-modal__title { font-size: 13.5px; font-weight: 700; }
.tps-modal__close {
  margin-left: auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: transparent; border: none;
  color: var(--tps-muted); cursor: pointer;
  border-radius: var(--tps-radius-sm); font-size: 18px; line-height: 1;
}
.tps-modal__close:hover { background: rgba(244, 242, 248, .08); color: var(--tps-text); }
.tps-modal__body { padding: 16px; overflow-y: auto; font-size: 12.5px; line-height: 1.65; }
.tps-modal__foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--tps-border-soft);
  background: var(--tps-bg-2);
}

/* ==========================================================================
   7. Responsive — màn hình trình chiếu nhỏ
   ========================================================================== */
@media (max-width: 1360px) {
  :root { --it-copilot-w: 400px; }
  .it-kpi { min-width: 82px; padding: 3px 10px; }
  .it-search { width: 180px; }
}
@media (max-width: 1180px) {
  .it-clock, .it-flag-margin { display: none; }
  .it-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; }
  .it-index { padding: 6px 14px; }
}
@media (max-width: 980px) {
  :root { --it-rail-w: 60px; }
  .it-rail__item span { font-size: 9px; }
}
