/* ==========================================================================
   Gold pricing dashboard — UI only (scoped .tlkv-gold-dashboard)
   Does not affect .header, .tlkv-hero, .tv-*, tv-model
   ========================================================================== */

.tlkv-gold-dashboard {
  --tlkv-gp-bg: var(--tlkv-bg-cream, #f8f6f1);
  --tlkv-gp-card: var(--tlkv-bg-pearl, #fdfcf8);
  --tlkv-gp-border: #ebe6dc;
  --tlkv-gp-gold: var(--tlkv-gold, #d4af37);
  --tlkv-gp-gold-soft: var(--tlkv-gold-light, #d4af37);
  --tlkv-gp-text: #1a1a1a;
  --tlkv-gp-muted: var(--tlkv-text-muted, #666666);
  --tlkv-gp-row-h: 2.5rem;
  --tlkv-gp-head-h: 2.375rem;
  --tlkv-gp-title-size: clamp(1.5rem, 1rem + 2.2vw, 2.25rem);
  /* World panel — cùng scale với dòng brand "Thăng Long Kim Việt" (1.1em) */
  --tlkv-gp-world-title-size: clamp(1.65rem, 1.1rem + 2.42vw, 2.475rem);
  /* Unified table header chrome — deep red block, gold titles, white labels */
  --tlkv-gp-header-bg: rgba(155, 1, 2, 1);
  --tlkv-gp-header-gold: rgb(240, 229, 87);
  --tlkv-gp-header-text: #ffffff;
  --tlkv-gp-header-divider: rgba(255, 255, 255, 0.3);

  padding: clamp(2.5rem, 5vw, 3.5rem) 0;
  background: var(--tlkv-gp-bg);
}

/* Gần full viewport — padding hai bên tối thiểu */
.tlkv-gold-dashboard > .container {
  width: 100%;
  max-width: min(98vw, var(--tlkv-container-wide, 1680px)) !important;
  padding-left: clamp(0.375rem, 0.65vw, 0.625rem);
  padding-right: clamp(0.375rem, 0.65vw, 0.625rem);
}

/* Hai cột cân bằng — Grid stretch = chiều cao đồng bộ (Bloomberg-style).
   Side-by-side chỉ từ 1400px: mỗi panel ≥ ~670px để cột Mua/Bán + icon không bị cắt. */
.tlkv-gold-dashboard__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  align-items: stretch;
}

/* Container query root — đo đúng width panel bảng (không phụ thuộc viewport) */
.tlkv-gold-panel--store {
  container-type: inline-size;
  container-name: tlkv-gp-store;
}

@media (min-width: 1400px) {
  .tlkv-gold-dashboard__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    align-items: stretch;
    min-height: 0;
  }

  /* Store giữ height theo nội dung bảng; world khớp qua --tlkv-gp-panel-sync-h */
  .tlkv-gold-panel--world {
    height: var(--tlkv-gp-panel-sync-h, auto);
    min-height: var(--tlkv-gp-panel-sync-h, min(72vh, 640px));
  }

  .tlkv-gold-panel--store {
    min-height: min(72vh, 640px);
  }

  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap {
    flex: 1 1 auto;
    height: var(--tlkv-gp-chart-h, auto);
    min-height: var(--tlkv-gp-chart-h, 280px);
  }

  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tlkv-world-xau-tv-embed,
  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap iframe,
  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tradingview-widget-container,
  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tradingview-widget-container__widget {
    height: 100% !important;
    min-height: 100% !important;
  }
}

/* Premium panel cards */
.tlkv-gold-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--tlkv-gp-card);
  border: 1px solid var(--tlkv-gp-border);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(26, 26, 26, 0.04);
  overflow: hidden;
}

.tlkv-gold-panel__head {
  padding: 1.25rem 1.375rem 0.875rem;
  border-bottom: none;
  text-align: center;
  background: var(--tlkv-gp-header-bg);
  color: var(--tlkv-gp-header-text);
}

/* ===========================================================================
   UNIFIED PREMIUM SECTION TITLES — shared by store + world panels.
   Centered, uppercase, gold on deep-red header chrome.
   ========================================================================= */
.tlkv-gp-title {
  margin: 0 auto 0.5rem;
  text-align: center;
  font-family: "Bookman Old Style", "Bookman", "URW Bookman L", "Bookman ITC", Georgia, serif;
  font-weight: 700;
  line-height: 1.12;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--tlkv-gp-header-gold, #a87f1c);
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: var(--tlkv-gp-header-gold, #a87f1c);
  -webkit-filter: none;
  filter: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.tlkv-gp-title::after {
  display: none;
}

/* Store title = primary focal point: two stacked lines, larger scale */
.tlkv-gold-panel__title.tlkv-gp-title {
  font-size: var(--tlkv-gp-title-size);
}
.tlkv-gp-title__line {
  display: block;
}
.tlkv-gp-title__line--label {
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 1.8px;
}
.tlkv-gp-title__line--brand {
  font-size: 1em;
  font-weight: 800;
}

.tlkv-world-xau-title.tlkv-gp-title {
  font-family: "Bookman Old Style";
  font-weight: 700;
  font-size: calc(var(--tlkv-gp-world-title-size) - 5px);
  letter-spacing: 0.3px;
}

.tlkv-gold-panel__meta,
.tlkv-gold-dashboard .gold-table-meta {
  margin: 0;
  text-align: center;
  font-family: var(--tlkv-font-body);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--tlkv-gp-header-text);
  opacity: 0.95;
}

.tlkv-gold-dashboard .gold-table-brand-italic {
  font-style: normal;
  font-weight: 600;
  color: inherit;
}

.tlkv-gold-panel__body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tlkv-gold-panel--store .tlkv-gold-panel__body {
  padding-left: 0;
  padding-right: 0;
}

/* Scroll shell — header sticky, body scroll nội bộ */
.tlkv-gp-table-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
}

.tlkv-gp-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
}

.tlkv-world-xau-meta {
  margin: 0 0 0.35rem;
}

/* ----- TLKV table (store panel) ----- */
.tlkv-gold-dashboard .tlkv-gp-table-shell.table-responsive.gold-table {
  display: flex;
  width: 100%;
  max-width: 100%;
}

.tlkv-gold-dashboard .gold-table-content,
.tlkv-gold-dashboard .gold-table-content.gold-table-extended {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  table-layout: auto !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  border: 1px solid var(--tlkv-gp-border) !important;
  border-top: none !important;
  border-radius: 0 !important;
  background: var(--tlkv-gp-card);
  box-shadow: none !important;
  font-size: 0.75rem;
  overflow: visible !important;
}

.tlkv-gold-panel--store .gold-table-content thead {
  border-top: 1px solid var(--tlkv-gp-header-divider);
}

.tlkv-gold-dashboard .gold-table-content thead th,
.tlkv-gold-dashboard .gold-table-content tbody td {
  border: 1px solid var(--tlkv-gp-border) !important;
  box-sizing: border-box;
}

.tlkv-gold-dashboard .gold-table-content thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: var(--tlkv-gp-head-h);
  max-height: var(--tlkv-gp-head-h);
  background: var(--tlkv-gp-header-bg);
  color: var(--tlkv-gp-header-text);
  font-family: var(--tlkv-font-body);
  font-size: 0.6875rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 0.5rem !important;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  border-color: var(--tlkv-gp-header-divider) !important;
  box-shadow: none;
}

.tlkv-gold-dashboard .gold-table-content thead th:first-child,
.tlkv-gold-dashboard .gold-table-content thead th:last-child {
  border-radius: 0;
}

.tlkv-gold-panel--store .gold-table-content thead th:first-child {
  border-left: none !important;
}

.tlkv-gold-panel--store .gold-table-content thead th:last-child {
  border-right: none !important;
}

.tlkv-gold-panel--store .gold-table-content thead th {
  border-bottom-color: var(--tlkv-gp-border) !important;
}

.tlkv-gold-dashboard .gold-table-content tbody td {
  height: var(--tlkv-gp-row-h);
  max-height: var(--tlkv-gp-row-h);
  padding: 0 0.5rem !important;
  color: var(--tlkv-gp-text);
  font-size: 0.75rem !important;
  text-align: center;
  vertical-align: middle !important;
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  overflow: hidden;
  line-height: var(--tlkv-gp-row-h) !important;
}

/* Single-line ellipsis — text layer tách khỏi layout box */
.tlkv-gold-dashboard .tlkv-gp-cell__text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: var(--tlkv-gp-row-h);
}

.tlkv-gold-dashboard td.col-product .tlkv-gp-cell__text {
  text-align: left;
}

.tlkv-gold-dashboard td.price .tlkv-gp-cell__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  max-width: 100%;
  height: var(--tlkv-gp-row-h);
  overflow: visible;
  white-space: nowrap;
}

/* Chỉ truncate phần số giá — giữ icon ▲/▼ không bị clip bởi border cột */
.tlkv-gold-dashboard td.price .tlkv-gp-cell__inner .tv-price-text {
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.tlkv-gold-dashboard td.price .gold-price-trend {
  flex-shrink: 0;
}

.tlkv-gold-dashboard td.price {
  line-height: normal !important;
}

.tlkv-gold-dashboard .gold-table-content tbody tr:last-child td {
  border-bottom: 1px solid var(--tlkv-gp-border) !important;
}

.tlkv-gold-dashboard .gold-table-content tbody tr:hover td {
  background: rgba(201, 161, 74, 0.04);
}

/* Bạc: nền xanh SP / hàm lượng / giá */
.tlkv-gold-dashboard .gold-table-content tbody tr.row-silver > td.col-product,
.tlkv-gold-dashboard .gold-table-content tbody tr.row-silver > td.col-purity,
.tlkv-gold-dashboard .gold-table-content tbody tr.row-silver > td.price {
  background: #1a56a8 !important;
  color: #fff !important;
}

.tlkv-gold-dashboard .gold-table-content tbody tr.row-silver:hover > td.col-product,
.tlkv-gold-dashboard .gold-table-content tbody tr.row-silver:hover > td.col-purity,
.tlkv-gold-dashboard .gold-table-content tbody tr.row-silver:hover > td.price {
  background: #1a56a8 !important;
  color: #fff !important;
}

/* Website: dòng 1,3,6,8 — chỉ MUA VÀO / BÁN RA */
.tlkv-gold-dashboard .gold-table-content tbody tr.row-price-band > td.price {
  background: #fdeeb3 !important;
  color: var(--tlkv-gp-text, #1a1a1a) !important;
}

.tlkv-gold-dashboard .gold-table-content tbody tr.row-price-band:hover > td.price {
  background: #fdeeb3 !important;
  color: var(--tlkv-gp-text, #1a1a1a) !important;
}

.tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.col-product {
  text-align: left !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
}

.tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.col-purity {
  white-space: nowrap !important;
}

.tlkv-gold-dashboard .gold-table-content.gold-table-extended td.price,
.tlkv-gold-dashboard .gold-table-content.gold-table-extended thead th:nth-child(4),
.tlkv-gold-dashboard .gold-table-content.gold-table-extended thead th:nth-child(5) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap !important;
  font-weight: 600 !important;
}

/* Giá Mua/Bán: +2px so với các cột khác, không đổi --tlkv-gp-row-h */
.tlkv-gold-dashboard .gold-table-content.gold-table-extended td.price {
  font-size: 0.875rem !important;
}

.tlkv-gold-dashboard td.price .tlkv-gp-cell__inner {
  font-size: inherit;
  line-height: 1;
}

.tlkv-gold-dashboard td.price .gold-price-trend {
  font-size: 0.8125rem;
  line-height: 1;
  margin-left: 0.2rem;
}

.tlkv-gold-dashboard td.price .gold-price-trend svg {
  width: 14px;
  height: 14px;
}

.tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.gold-brand-cell {
  min-width: 5.5rem;
}

.tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.gold-table-corner-bl,
.tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.gold-table-corner-br {
  border-radius: 0 !important;
  overflow: visible !important;
}

.tlkv-gold-dashboard .gold-table-content th:nth-child(1),
.tlkv-gold-dashboard .gold-table-content td:nth-child(1) {
  min-width: 5.75rem;
}

.tlkv-gold-dashboard .gold-table-content th:nth-child(2),
.tlkv-gold-dashboard .gold-table-content td:nth-child(2) {
  min-width: 9.5rem;
}

.tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.col-product .tlkv-gp-cell__text {
  max-width: none;
}

.tlkv-gold-dashboard .gold-table-content th:nth-child(3),
.tlkv-gold-dashboard .gold-table-content td:nth-child(3) {
  min-width: 5.25rem;
}

.tlkv-gold-dashboard .gold-table-content th:nth-child(4),
.tlkv-gold-dashboard .gold-table-content td:nth-child(4),
.tlkv-gold-dashboard .gold-table-content th:nth-child(5),
.tlkv-gold-dashboard .gold-table-content td:nth-child(5) {
  min-width: 5rem;
}

.tlkv-gold-dashboard .gold-price-trend--up {
  color: #3d7a52;
}

.tlkv-gold-dashboard .gold-price-trend--down {
  color: #9e4a4a;
}

/* World panel: chart card fills column */
.tlkv-gold-panel--world {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--tlkv-gp-card);
}

.tlkv-gold-panel--world .tlkv-world-xau {
  margin: 0;
  padding: 0;
  border: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tlkv-gold-panel--world .tlkv-world-xau-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  gap: 0;
}

.tlkv-gold-panel--world .tlkv-world-xau-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: var(--tlkv-gp-card);
}

.tlkv-gold-panel--world .tlkv-world-xau-head {
  padding: 1.25rem 1.375rem 1rem;
  border-bottom: 1px solid var(--tlkv-gp-header-divider);
  background: var(--tlkv-gp-header-bg);
  color: var(--tlkv-gp-header-text);
}

.tlkv-gold-panel--world .tlkv-world-xau-title:not(.tlkv-gp-title) {
  font-family: var(--tlkv-font-heading);
  font-size: clamp(1.25rem, 1.85vw, 1.4375rem);
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--tlkv-gp-text);
}

.tlkv-gold-panel--world .tlkv-world-xau-meta {
  font-family: var(--tlkv-font-body);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--tlkv-gp-header-text);
}

.tlkv-gold-panel--world .tlkv-world-xau-sub {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--tlkv-gp-header-text);
  opacity: 0.95;
}

.tlkv-gold-panel--world .tlkv-world-xau-spot {
  text-align: right;
}

.tlkv-gold-panel--world .tlkv-world-xau-price {
  font-family: var(--tlkv-font-body);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--tlkv-gp-header-gold);
}

.tlkv-gold-panel--world .tlkv-world-xau-change {
  font-size: 0.8125rem;
  font-weight: 500;
}

.tlkv-gold-panel--world .tlkv-world-xau-change--up {
  color: #3d7a52;
}

.tlkv-gold-panel--world .tlkv-world-xau-change--down {
  color: #9e4a4a;
}

.tlkv-gold-panel--world .tlkv-world-xau-tv-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--tlkv-gp-bg);
}

.tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tlkv-world-xau-tv-embed,
.tlkv-gold-panel--world .tlkv-world-xau-tv-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
}

.tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tlkv-world-xau-tv-embed {
  overflow: hidden;
}

@media (min-width: 1400px) {
  /* Store stretch theo grid; world height do sync JS/--tlkv-gp-panel-sync-h điều khiển */
  .tlkv-gold-panel--store {
    height: 100%;
    min-height: min(72vh, 640px);
  }

  .tlkv-gold-dashboard .gold-table-content.gold-table-extended {
    table-layout: fixed !important;
  }

  /* SP rộng hơn để hiện full tên SP; Mua/Bán đủ chỗ cho số + icon */
  .tlkv-gold-dashboard .gold-table-content th:nth-child(1),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(1) {
    width: 18% !important;
    min-width: 0 !important;
  }

  .tlkv-gold-dashboard .gold-table-content th:nth-child(2),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(2) {
    width: 32% !important;
    min-width: 0 !important;
  }

  .tlkv-gold-dashboard .gold-table-content th:nth-child(3),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(3) {
    width: 12% !important;
    min-width: 0 !important;
  }

  .tlkv-gold-dashboard .gold-table-content th:nth-child(4),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(4) {
    width: 19% !important;
    min-width: 0 !important;
  }

  .tlkv-gold-dashboard .gold-table-content th:nth-child(5),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(5) {
    width: 19% !important;
    min-width: 0 !important;
  }

  .tlkv-gold-dashboard .gold-table-content td.price {
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
  }

  .tlkv-gold-dashboard .gold-table-content thead th,
  .tlkv-gold-dashboard .gold-table-content tbody td {
    font-size: clamp(0.6875rem, 0.85vw, 0.8125rem) !important;
    padding: 0.5rem 0.375rem !important;
  }

  .tlkv-gold-dashboard .gold-table-content.gold-table-extended td.price {
    font-size: 0.875rem !important;
  }

}

/* Priority compact: khi panel bảng < 670px (container) — thu chữ Mua/Bán + icon,
   ẩn cột Hàm lượng để tránh giá/icon đè lên line phân cách. */
@container tlkv-gp-store (max-width: 669px) {
  .gold-table-content.gold-table-extended:not(.gold-table--stacked) th:nth-child(3),
  .gold-table-content.gold-table-extended:not(.gold-table--stacked) td.col-purity {
    display: none !important;
  }

  .gold-table-content.gold-table-extended:not(.gold-table--stacked) th:nth-child(1),
  .gold-table-content.gold-table-extended:not(.gold-table--stacked) td:nth-child(1) {
    width: 22% !important;
  }

  .gold-table-content.gold-table-extended:not(.gold-table--stacked) th:nth-child(2),
  .gold-table-content.gold-table-extended:not(.gold-table--stacked) td:nth-child(2) {
    width: 38% !important;
  }

  .gold-table-content.gold-table-extended:not(.gold-table--stacked) th:nth-child(4),
  .gold-table-content.gold-table-extended:not(.gold-table--stacked) td:nth-child(4),
  .gold-table-content.gold-table-extended:not(.gold-table--stacked) th:nth-child(5),
  .gold-table-content.gold-table-extended:not(.gold-table--stacked) td:nth-child(5) {
    width: 20% !important;
  }

  .gold-table-content.gold-table-extended td.price {
    font-size: 0.75rem !important;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
  }

  td.price .tlkv-gp-cell__inner {
    gap: 0.15rem !important;
    overflow: visible !important;
  }

  td.price .gold-price-trend {
    font-size: 0.625rem !important;
    margin-left: 0.1rem !important;
  }

  td.price .gold-price-trend svg {
    width: 11px !important;
    height: 11px !important;
  }
}

/* Panel hẹp vừa (670–780px): giữ đủ cột nhưng thu nhẹ chữ giá + icon */
@container tlkv-gp-store (min-width: 670px) and (max-width: 780px) {
  .gold-table-content.gold-table-extended td.price {
    font-size: 0.8125rem !important;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
  }

  td.price .tlkv-gp-cell__inner {
    gap: 0.2rem !important;
    overflow: visible !important;
  }

  td.price .gold-price-trend {
    font-size: 0.6875rem !important;
    margin-left: 0.12rem !important;
  }

  td.price .gold-price-trend svg {
    width: 12px !important;
    height: 12px !important;
  }
}

@media (min-width: 1200px) {
  .tlkv-gold-dashboard > .container {
    max-width: min(98.5vw, 1680px) !important;
    padding-left: clamp(0.5rem, 0.5vw, 0.75rem);
    padding-right: clamp(0.5rem, 0.5vw, 0.75rem);
  }

  .tlkv-gold-dashboard {
    --tlkv-gp-row-h: 2.625rem;
    --tlkv-gp-head-h: 2.5rem;
  }

  .tlkv-gold-dashboard .gold-table-content thead th,
  .tlkv-gold-dashboard .gold-table-content tbody td {
    font-size: 0.8125rem !important;
  }

  .tlkv-gold-dashboard .gold-table-content.gold-table-extended td.price {
    font-size: 0.9375rem !important;
  }

  .tlkv-gold-dashboard td.price .gold-price-trend {
    font-size: 0.875rem;
  }

  .tlkv-gold-dashboard td.price .gold-price-trend svg {
    width: 15px;
    height: 15px;
  }
}

/* Desktop store gold table — responsive typography + wrap (preserve row density) */
@media (min-width: 1024px) {
  .tlkv-gold-panel--store .tlkv-gp-table-shell.table-responsive.gold-table,
  .tlkv-gold-panel--store .tlkv-gp-table-scroll {
    overflow-x: hidden !important;
    max-width: 100%;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    height: auto;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended tbody {
    height: auto;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended thead tr {
    height: auto;
    min-height: var(--tlkv-gp-head-h);
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended tbody tr {
    height: auto;
    min-height: var(--tlkv-gp-row-h);
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended th:nth-child(1),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td:nth-child(1),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended th:nth-child(2),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td:nth-child(2),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended th:nth-child(3),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td:nth-child(3),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended th:nth-child(4),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td:nth-child(4),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended th:nth-child(5),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td:nth-child(5),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended tbody td.gold-brand-cell {
    min-width: 0 !important;
    max-width: 100%;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended thead th,
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended tbody td {
    height: auto !important;
    min-height: inherit;
    max-height: none !important;
    vertical-align: middle !important;
    font-size: clamp(13px, 0.75vw, 18px) !important;
    line-height: 1.4 !important;
    text-overflow: unset !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended thead th {
    min-height: var(--tlkv-gp-head-h);
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended tbody td {
    min-height: var(--tlkv-gp-row-h);
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended tbody td.col-product {
    text-align: left !important;
    font-weight: 500 !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended .tlkv-gp-cell__text {
    display: block;
    max-width: 100% !important;
    font-size: inherit !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td.price,
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended thead th:nth-child(4),
  .tlkv-gold-panel--store .gold-table-content.gold-table-extended thead th:nth-child(5) {
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    font-weight: 600 !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td.price .tlkv-gp-cell__inner {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 0.25rem;
    width: auto !important;
    max-width: 100% !important;
    min-height: var(--tlkv-gp-row-h);
    height: auto;
    font-size: inherit !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td.price .tlkv-gp-cell__inner .tv-price-text {
    display: inline-block !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex-shrink: 1 !important;
  }

  .tlkv-gold-panel--store .gold-table-content.gold-table-extended td.price .gold-price-trend {
    flex-shrink: 0 !important;
  }
}

/* Legacy wrappers inside dashboard — neutralize old layout */
.tlkv-gold-dashboard .chart-container-row {
  display: block;
}

.tlkv-gold-dashboard .chart-container.container-l {
  width: 100%;
  max-width: 100%;
  flex: none;
}

.tlkv-gold-dashboard .chart-title.title-w-deco,
.tlkv-gold-dashboard .chart-body > .gold-title {
  display: none;
}

/* Responsive — dưới 1400px: xếp dọc (bảng full-width, chart bên dưới) */
@media (max-width: 1399.98px) {
  .tlkv-gold-dashboard__grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .tlkv-gold-panel--store,
  .tlkv-gold-panel--world {
    height: auto;
    min-height: 0;
  }

  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap {
    min-height: min(52vh, 480px);
    height: min(52vh, 480px);
  }

  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tlkv-world-xau-tv-embed,
  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap iframe,
  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tradingview-widget-container,
  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap .tradingview-widget-container__widget {
    min-height: 100%;
    height: 100%;
  }
}

@media (max-width: 768px) {
  /* ===========================================================================
     MOBILE TABLE — fit-to-viewport, full-text wrapping, vertical scroll.
     Replaces the desktop "fixed-row-height / single-line ellipsis" trading grid
     with a readable, fully-expanded data table. No horizontal scroll, no
     truncation. Colors are inherited from the base rules — only layout/typography
     is touched here.
     ========================================================================= */

  /* --- 1. SCROLL SHELL ------------------------------------------------------
     Shell has no overflow of its own — the inner scroll wrapper is now also
     static (no height cap, no overflow). Everything flows vertically and the
     page owns the scroll axis on mobile. */
  .tlkv-gold-dashboard .table-responsive.gold-table,
  .tlkv-gold-dashboard .tlkv-gp-table-shell {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: 0;
  }

  /* No nested scroll on mobile — table grows naturally and the page scrolls.
     All previous height-cap / overflow constraints are lifted here. */
  .tlkv-gold-dashboard .tlkv-gp-table-scroll {
    max-height: none !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: auto !important;
    overscroll-behavior-y: auto;
    touch-action: auto;
    padding-bottom: 0;
  }

  /* --- 2. FIT-TO-WIDTH LAYOUT ----------------------------------------------- */
  .tlkv-gold-dashboard .gold-table-content.gold-table-extended {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important; /* was: max-content + auto */
  }

  /* Proportional column widths (Σ = 100%); min-width:0 lets fixed layout shrink them */
  .tlkv-gold-dashboard .gold-table-content th:nth-child(1),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(1) { width: 21% !important;   min-width: 0 !important; }
  .tlkv-gold-dashboard .gold-table-content th:nth-child(2),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(2) { width: 21% !important;   min-width: 0 !important; }
  .tlkv-gold-dashboard .gold-table-content th:nth-child(3),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(3) { width: 15% !important;   min-width: 0 !important; }
  .tlkv-gold-dashboard .gold-table-content th:nth-child(4),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(4) { width: 21.5% !important; min-width: 0 !important; }
  .tlkv-gold-dashboard .gold-table-content th:nth-child(5),
  .tlkv-gold-dashboard .gold-table-content td:nth-child(5) { width: 21.5% !important; min-width: 0 !important; }

  /* --- 3. FULL-TEXT WRAPPING (kill the single-line ellipsis grid) -----------
     Base rules pin cells to a fixed row height with white-space:nowrap +
     text-overflow:ellipsis. Lift all of it so long Vietnamese names wrap and
     rows grow to fit their content. */
  .tlkv-gold-dashboard .gold-table-content thead th,
  .tlkv-gold-dashboard .gold-table-content tbody td {
    height: auto !important;
    max-height: none !important;
    line-height: 1.5 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    text-overflow: clip !important;
    overflow: visible !important;
    vertical-align: middle !important;
    text-align: center !important;
    /* --- 4. READABILITY: comfortable tap spacing + legible sizing --- */
    padding: 10px 6px !important;
  }

  .tlkv-gold-dashboard .gold-table-content tbody td {
    font-size: 13px !important;
  }

  .tlkv-gold-dashboard .gold-table-content thead th {
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  /* The JS wraps cell text in .tlkv-gp-cell__text with ellipsis — undo it here */
  .tlkv-gold-dashboard .tlkv-gp-cell__text {
    display: block;
    max-width: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.5 !important;
  }

  /* Product name (left-aligned, wraps to as many lines as needed) */
  .tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.col-product,
  .tlkv-gold-dashboard .gold-table-content.gold-table-extended tbody td.col-product .tlkv-gp-cell__text {
    text-align: left !important;
    vertical-align: top !important;
    white-space: normal !important;
    max-width: 100% !important;
  }

  /* Brand + price columns: centered in header and body */
  .tlkv-gold-dashboard .gold-table-content thead th:nth-child(1),
  .tlkv-gold-dashboard .gold-table-content tbody td:nth-child(1),
  .tlkv-gold-dashboard .gold-table-content tbody td.gold-brand-cell,
  .tlkv-gold-dashboard .gold-table-content thead th:nth-child(4),
  .tlkv-gold-dashboard .gold-table-content thead th:nth-child(5),
  .tlkv-gold-dashboard .gold-table-content tbody td.price {
    text-align: center !important;
    vertical-align: middle !important;
  }

  .tlkv-gold-dashboard .gold-table-content tbody td.gold-brand-cell .tlkv-gp-cell__text {
    text-align: center;
    margin-inline: auto;
  }

  /* Stacked 4-column layout: buy/sell are columns 3–4 */
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked thead th:nth-child(3),
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked thead th:nth-child(4),
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked tbody td.price {
    text-align: center !important;
    vertical-align: middle !important;
  }

  /* Prices: number + trend icon are ONE inline unit that never wraps.
     (Overrides the earlier wrap rule — financial figures must read on a single line.)
     Price headers (Mua/Bán labels) may still wrap. */
  .tlkv-gold-dashboard .gold-table-content thead th:nth-child(4),
  .tlkv-gold-dashboard .gold-table-content thead th:nth-child(5) {
    white-space: normal !important;
  }

  .tlkv-gold-dashboard .gold-table-content td.price {
    white-space: nowrap !important;
    font-size: 13.5px !important;
  }

  /* price-wrapper: full-width flex row, centered as a unit */
  .tlkv-gold-dashboard td.price .tlkv-gp-cell__inner {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    overflow: visible !important;
  }

  /* price-value */
  .tlkv-gold-dashboard td.price .tlkv-gp-cell__inner .tv-price-text {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-weight: 600 !important;
    line-height: 1 !important;
  }

  /* price-icon: slightly smaller than the number, never shrinks or wraps */
  .tlkv-gold-dashboard td.price .gold-price-trend {
    flex-shrink: 0 !important;
    margin-left: 0 !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }
  .tlkv-gold-dashboard td.price .gold-price-trend svg {
    width: 11px !important;
    height: 11px !important;
  }

  .tlkv-gold-dashboard .gold-brand-cell {
    white-space: normal !important;
    min-width: 0 !important;
  }

  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked th:nth-child(1),
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked td:nth-child(1) { width: 22% !important; min-width: 0 !important; }
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked th:nth-child(2),
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked td:nth-child(2) { width: calc(38% - 20px) !important; min-width: 0 !important; }
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked th:nth-child(3),
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked td:nth-child(3),
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked th:nth-child(4),
  .tlkv-gold-dashboard .gold-table-content.gold-table--stacked td:nth-child(4) { width: calc(20% + 10px) !important; min-width: 0 !important; }
}

@media (max-width: 767.98px) {
  .tlkv-gold-dashboard .tlkv-world-xau-title.tlkv-gp-title {
    font-size: 20px !important;
  }
}

@media (max-width: 575.98px) {
  .tlkv-gold-dashboard__grid {
    grid-template-columns: 1fr;
  }

  .tlkv-gold-panel__head,
  .tlkv-gold-panel--world .tlkv-world-xau-head {
    padding: 1rem 1rem 0.75rem;
  }

  .tlkv-gold-panel__body {
    padding-bottom: 0.75rem;
  }

  .tlkv-gold-panel--world .tlkv-world-xau-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .tlkv-gold-panel--world .tlkv-world-xau-spot {
    text-align: left;
    width: 100%;
  }
}

/* Samsung / Chrome forced-dark: re-assert dashboard colours when OS is dark */
@media (prefers-color-scheme: dark) {
  .tlkv-gold-dashboard {
    background-color: #f8f6f1 !important;
    color: #1a1a1a !important;
  }

  .tlkv-gold-panel {
    background-color: #fdfcf8 !important;
    border-color: #ebe6dc !important;
  }

  .tlkv-gold-panel__head,
  .tlkv-gold-panel--world .tlkv-world-xau-head,
  .tlkv-gold-dashboard .gold-table-content thead th {
    background-color: rgba(155, 1, 2, 1) !important;
    color: #ffffff !important;
    -webkit-filter: none !important;
    filter: none !important;
  }

  .tlkv-gold-dashboard .tlkv-gp-title,
  .tlkv-gold-dashboard .tlkv-gold-panel__title.tlkv-gp-title,
  .tlkv-gold-dashboard .tlkv-world-xau-title.tlkv-gp-title {
    color: rgb(240, 229, 87) !important;
    background: none !important;
    -webkit-text-fill-color: rgb(240, 229, 87) !important;
    -webkit-filter: none !important;
    filter: none !important;
  }

  .tlkv-gold-panel__meta,
  .tlkv-gold-dashboard .gold-table-meta,
  .tlkv-gold-panel--world .tlkv-world-xau-sub,
  .tlkv-gold-panel--world .tlkv-world-xau-meta {
    color: #ffffff !important;
    opacity: 1 !important;
  }

  .tlkv-gold-dashboard .gold-table-content,
  .tlkv-gold-dashboard .gold-table-content tbody td {
    background-color: #fdfcf8 !important;
    color: #1a1a1a !important;
    border-color: #ebe6dc !important;
  }

  .tlkv-gold-dashboard .gold-table-content thead th {
    border-color: rgba(255, 255, 255, 0.3) !important;
  }

  .tlkv-gold-panel--world .tlkv-world-xau-tv-wrap {
    background-color: #f8f6f1 !important;
  }
}

