/* AriStock – trang công khai dựng sẵn trên máy chủ (finboard/pub): vĩ mô, quỹ, giá xăng dầu, lãi suất, cổ phiếu.
   Nhẹ và tự đủ: không dùng styles.css của giao diện chính. Màu lấy từ cùng bộ token (sáng / tối); mặc định theo hệ điều
   hành, người đã chọn sáng / tối trong giao diện chính thì pub.js đặt data-theme theo lựa chọn đó. */
:root {
  color-scheme: light;
  --bg: #f4f6f9; --card: #ffffff; --card-2: #f8f9fb; --track: #eef1f5; --border: #e3e7ee; --border-strong: #cfd6e0; --grid-line: #eef1f5;
  --text: #0f1b2d; --text-2: #3b4859; --muted: #667085;
  --navy: #14532d; --navy-dark: #0f3f22; --accent: #15803d; --accent-soft: #e7f6ec;
  --up: #0a7d45; --down: #c2261f; --down-fill: #f04438; --chart-main: #16a34a;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --ink: #0f1b2d; --gold: #b0863a;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 1px 3px rgba(15, 27, 45, .03);
  --shadow-lg: 0 12px 28px -10px rgba(15, 27, 45, .28), 0 2px 6px -2px rgba(15, 27, 45, .1);
  --font: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Montserrat, Inter, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b111c; --card: #121a28; --card-2: #172031; --track: #1b2538; --border: #243047; --border-strong: #34425d; --grid-line: #1e293d;
    --text: #e6eaf0; --text-2: #b6c0cf; --muted: #8a94a6;
    --navy: #1f7a45; --navy-dark: #18633a; --accent: #4fd88a; --accent-soft: #123222;
    --up: #35d283; --down: #ff6461; --down-fill: #ff6461; --chart-main: #3ccf7c;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --ink: #f7f3e8; --gold: #d2ae63;
    --shadow: none; --shadow-lg: 0 12px 28px -10px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b111c; --card: #121a28; --card-2: #172031; --track: #1b2538; --border: #243047; --border-strong: #34425d; --grid-line: #1e293d;
  --text: #e6eaf0; --text-2: #b6c0cf; --muted: #8a94a6;
  --navy: #1f7a45; --navy-dark: #18633a; --accent: #4fd88a; --accent-soft: #123222;
  --up: #35d283; --down: #ff6461; --down-fill: #ff6461; --chart-main: #3ccf7c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --ink: #f7f3e8; --gold: #d2ae63;
  --shadow: none; --shadow-lg: 0 12px 28px -10px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.6; color: var(--text); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.sm { font-size: 13.5px; }
.up { color: var(--up); }
.down { color: var(--down); }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--track); color: var(--text-2); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }

/* thanh trên cùng */
.top { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.top-in { max-width: 1160px; margin: 0 auto; padding: 0 20px; height: 58px; display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; flex: none; }
.brand-logo { display: block; }
.brand-logo .lg-ink { fill: var(--ink); }
.brand-logo .lg-gold { fill: var(--gold); }
.brand-text { font: 700 20px var(--font-display); color: var(--ink); }
.nav { flex: 1; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.nav a:hover { background: var(--track); text-decoration: none; color: var(--text); }
.nav a[aria-current] { color: var(--navy); background: var(--accent-soft); font-weight: 600; }
:root[data-theme="dark"] .nav a[aria-current] { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav a[aria-current] { color: var(--accent); } }
.btn { display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 10px 18px; border-radius: 9px; background: var(--navy); color: #fff; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--navy-dark); text-decoration: none; }
.btn-sm { padding: 7px 14px; font-size: 14px; }

/* nội dung */
.wrap { max-width: 1160px; margin: 0 auto; padding: 18px 20px 48px; }
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--text-2); }
.crumbs .sep { margin: 0 7px; opacity: .6; }
h1 { font: 700 28px/1.25 var(--font-display); letter-spacing: -.01em; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 18px; line-height: 1.35; margin: 0 0 12px; }
h3 { font-size: 15.5px; margin: 0 0 8px; }
.updated { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.lead { margin: 0 0 18px; font-size: 16.5px; color: var(--text-2); max-width: 86ch; }
.lead strong { color: var(--text); }
p { margin: 0 0 10px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--shadow); min-width: 0; }
.card > :last-child { margin-bottom: 0; }

/* ô số */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; box-shadow: var(--shadow); min-width: 0; }
.tile-l { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-v { font-size: 23px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile-v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.tile-s { font-size: 13px; color: var(--text-2); }
.tile-s.up { color: var(--up); }
.tile-s.down { color: var(--down); }

/* bảng */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl thead th { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--card-2); border-bottom-color: var(--border-strong); }
.tbl tbody th { font-weight: 500; }
.tbl .n { text-align: right; white-space: nowrap; }
.tbl tbody tr:last-child > * { border-bottom: 0; }
.tbl tbody tr:hover > * { background: var(--card-2); }
.tbl.wide tbody th { min-width: 220px; }
.tbl .grp > * { background: var(--card-2); font-weight: 600; font-size: 13px; color: var(--text-2); }

/* danh sách, lưới */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 24px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts.terms { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.facts.terms dt { color: var(--text); font-weight: 600; font-size: 14.5px; }
.facts.terms dd { color: var(--text-2); }
.links { list-style: none; margin: 0; padding: 0; }
.links li { padding: 3px 0; }
.links.cols { columns: 3 260px; column-gap: 28px; }
.links.cols li { break-inside: avoid; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.box { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--card-2); min-width: 0; }
.box .links { font-size: 14px; }
.box .more { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 13.5px; font-weight: 600; }

/* khối mời đăng nhập */
.cta { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 12px; padding: 18px 20px; margin: 0 0 16px; }
.cta h2 { margin: 0 0 4px; }
.cta p { margin: 0; color: var(--text-2); max-width: 70ch; }

/* biểu đồ */
.chart { margin: 0; }
.chart-box { position: relative; }
.ch { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.ch-m { display: none; }
.ch text { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.ch .unit { font-size: 11.5px; }
.ch .grid { stroke: var(--grid-line); stroke-width: 1; }
.ch .axis { stroke: var(--border-strong); stroke-width: 1; }
.ch .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch .ln.fc { stroke-dasharray: 5 5; }
.ch .dot { stroke: var(--card); stroke-width: 2; }
.ch .pt { stroke: none; }
.ch .end { fill: var(--text); font-weight: 600; }
.ch .bar.fc { opacity: .45; }
.ch .xh { stroke: var(--border-strong); stroke-width: 1; }
.ch .band { fill: var(--text); opacity: .07; }
.s0 { stroke: var(--chart-main); } .f0 { fill: var(--chart-main); }
.s1 { stroke: var(--s1); } .f1 { fill: var(--s1); }
.s2 { stroke: var(--s2); } .f2 { fill: var(--s2); }
.s3 { stroke: var(--s3); } .f3 { fill: var(--s3); }
.s4 { stroke: var(--s4); } .f4 { fill: var(--s4); }
.ch .bar.neg { fill: var(--down-fill); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: currentColor; }
i.sw.f0 { background: var(--chart-main); } i.sw.f1 { background: var(--s1); } i.sw.f2 { background: var(--s2); } i.sw.f3 { background: var(--s3); } i.sw.f4 { background: var(--s4); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 8px; font-size: 13.5px; color: var(--text-2); }
.legend b { margin-left: 6px; color: var(--text); }
.chart figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.tip { position: absolute; top: 0; left: 0; z-index: 5; pointer-events: none; min-width: 120px; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: 13px; line-height: 1.45; }
.tip .t { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.tip .r { display: flex; align-items: center; justify-content: space-between; gap: 12px; white-space: nowrap; }
.tip .r b { font-weight: 600; }

/* chân trang */
.foot { border-top: 1px solid var(--border); background: var(--card); }
.foot-in { max-width: 1160px; margin: 0 auto; padding: 22px 20px 30px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 10px; font-size: 14px; }
.foot-nav a { color: var(--text-2); }
.foot p { margin: 0 0 4px; max-width: 90ch; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .top-in { padding: 0 12px; gap: 10px; height: 54px; }
  .brand-logo { width: 112px; height: 23px; }
  .wrap { padding: 14px 12px 36px; }
  h1 { font-size: 22px; }
  .lead { font-size: 15.5px; }
  .card { padding: 14px 14px; border-radius: 10px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile-v { font-size: 19px; }
  .ch-d { display: none; }
  .ch-m { display: block; }
  .tbl { font-size: 13.5px; }
  .tbl th, .tbl td { padding: 7px 8px; }
  .tbl.wide tbody th { min-width: 150px; }
  .cta .btn { width: 100%; }
}
@media print {
  .top, .foot-nav, .cta, .skip { display: none; }
  body { background: #fff; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
}
