/* TLD Sales Hub — giao diện nội bộ, không phụ thuộc thư viện ngoài. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6878;
  --line: #e2e6ec;
  --brand: #0b5cad;
  --brand-ink: #ffffff;
  --brand-soft: #e7f0fa;
  --up: #0a7d45;
  --down: #c0392b;
  --warn-bg: #fff4d6;
  --warn-ink: #7a5600;
  --ok-bg: #e3f5ea;
  --ok-ink: #0a6a3a;
  --err-bg: #fde8e6;
  --err-ink: #a3261a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b;
    --surface: #1a2029;
    --text: #e6eaf0;
    --muted: #9aa6b6;
    --line: #2b3440;
    --brand: #5aa2ea;
    --brand-ink: #0b1522;
    --brand-soft: #1d2d40;
    --up: #45c985;
    --down: #ff7b6b;
    --warn-bg: #3a3014;
    --warn-ink: #f3d27a;
    --ok-bg: #173a27;
    --ok-ink: #7fe0a8;
    --err-bg: #43201c;
    --err-ink: #ffab9f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0.2rem 0 0.4rem; line-height: 1.25; }
h2 { font-size: 1.12rem; margin: 0 0 0.6rem; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.88em; background: var(--brand-soft); padding: 0.05em 0.35em; border-radius: 4px; }
code.wrap { word-break: break-all; white-space: pre-wrap; }
pre.log { white-space: pre-wrap; word-break: break-word; max-height: 18rem; overflow: auto; background: var(--bg); padding: 0.6rem; border-radius: 6px; font-size: 0.82rem; margin: 0; }

/* thanh trên */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand-mark { background: var(--brand); color: var(--brand-ink); border-radius: 6px; padding: 0.1rem 0.45rem; font-size: 0.85rem; letter-spacing: 0.04em; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; display: block; flex: none; }
.nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.nav-desktop { flex: 1; margin-left: 1rem; }
.nav a, .nav .link { padding: 0.35rem 0.65rem; border-radius: 6px; color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav a:hover { background: var(--brand-soft); text-decoration: none; }
.nav-sep { flex: 1; min-width: 1rem; }
.nav-user { color: var(--muted) !important; font-size: 0.9rem; }
.nav-user.on { color: var(--brand) !important; }
.nav-user-mobile { display: none; }
/* Hàng tab con của nhóm Thị trường / Khách hàng (base.html: TABS): dải nền nhạt dính dưới thanh trên,
   tab đang chọn là nút trắng viền màu — phải nổi để người dùng thấy nhóm có mục con. */
.subnav.group-tabs { margin: calc(-1 * var(--gutter)) calc(-1 * var(--gutter)) 1.2rem; padding: 0.55rem var(--gutter); gap: 0.4rem; align-items: center;
  background: var(--brand-soft); border-bottom: 1px solid var(--line); border-radius: 0; }
.subnav.group-tabs a { font-size: 1rem; font-weight: 600; padding: 0.45rem 1.05rem; border-radius: 999px; color: var(--brand);
  border: 1px solid transparent; }
.subnav.group-tabs a:hover { background: var(--surface); text-decoration: none; }
.subnav.group-tabs a.on { background: var(--surface); border-color: var(--brand); box-shadow: var(--shadow); }
/* Thanh dưới trên điện thoại: các nhóm menu + Tài khoản (base.html: .tabbar) */
.tabbar { display: none; }

@media (max-width: 760px) {
  .nav-desktop { display: none; }
  .nav-user-mobile { display: inline-block; color: var(--muted); font-size: 0.9rem; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body { padding-bottom: calc(3.7rem + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 0.25rem 0 calc(0.25rem + env(safe-area-inset-bottom));
  }
  .tabbar a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
    padding: 0.2rem 0; font-size: 0.7rem; color: var(--muted); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.on { color: var(--brand); font-weight: 600; }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar .count-badge { position: absolute; top: 0; left: calc(50% + 0.35rem); }
  .subnav.group-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 0.5rem var(--gutter); }
  .subnav.group-tabs a { flex: 1; justify-content: center; text-align: center; white-space: nowrap; font-size: 0.95rem; padding: 0.4rem 0.5rem; }
  .bulk-bar { bottom: calc(4rem + env(safe-area-inset-bottom)); }
}

.container { --gutter: 1rem; width: 100%; max-width: 1200px; margin: 0 auto; padding: var(--gutter); flex: 1; }
.footer { color: var(--muted); font-size: 0.82rem; text-align: center; padding: 1rem; border-top: 1px solid var(--line); }

/* khối */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.page-head { margin-bottom: 1rem; }
.page-head p { margin: 0.2rem 0 0; }
.section-title { margin-top: 1.4rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-head .section-title { margin-top: 1.4rem; }
.more { font-size: 0.9rem; white-space: nowrap; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.4rem 0 0; }
.crumbs { margin: 0 0 0.3rem; font-size: 0.9rem; }
.empty { color: var(--muted); text-align: center; padding: 1.2rem; }
.flash { background: var(--ok-bg); color: var(--ok-ink); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin-bottom: 1rem; }
.alert { background: var(--err-bg); color: var(--err-ink); border-radius: 8px; padding: 0.55rem 0.8rem; margin-bottom: 0.8rem; }
.error-text { color: var(--err-ink); }
.coming ul { margin: 0; padding-left: 1.2rem; }
/* Trang chủ: khối "Hôm nay" — việc đang chờ người dùng (home.html) */
.today { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; }
.today-item { display: flex; flex-direction: column; gap: 0.1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.7rem 0.9rem; color: var(--text); box-shadow: var(--shadow); }
.today-item:hover { text-decoration: none; border-color: var(--brand); }
.today-item strong { font-size: 1.5rem; line-height: 1.2; color: var(--muted); }
.today-item.has strong { color: var(--brand); }
.today-item.warn { border-color: var(--down); }
.today-item.warn strong { color: var(--down); }
.today-item span { color: var(--muted); font-size: 0.85rem; }
/* Lọc hải quan (templates/hai_quan): ô kết quả, nhãn phân loại, bảng dòng hàng */
.hq-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; }
.hq-metric { display: flex; flex-direction: column; gap: 0.1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.7rem 0.9rem; color: var(--text); box-shadow: var(--shadow); }
a.hq-metric:hover { text-decoration: none; border-color: var(--brand); }
.hq-metric strong { font-size: 1.5rem; line-height: 1.2; color: var(--muted); }
.hq-metric.has strong { color: var(--brand); }
.hq-metric.warn { border-color: var(--down); }
.hq-metric.warn strong { color: var(--down); }
.hq-metric span { color: var(--muted); font-size: 0.85rem; }
.hq-pl { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.hq-pl-loại-bỏ { background: var(--bg); color: var(--muted); }
.hq-pl-chưa-xác-định { background: var(--warn-bg); color: var(--warn-ink); }
.hq-pl-filler-masterbatch { background: var(--ok-bg); color: var(--ok-ink); }
.hq-rows td { vertical-align: top; }
.hq-ten-hang { min-width: 18rem; max-width: 32rem; font-size: 0.85rem; }
.hq-text { width: 100%; font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.85rem; }
.check { display: flex; align-items: center; gap: 0.35rem; }
.check input { width: auto; min-height: auto; margin: 0; }
.check-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.3rem 0.7rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0; }
.check-group legend { font-size: 0.85rem; color: var(--muted); padding: 0 0.3rem; }
.coming li { margin: 0.25rem 0; }

/* ô số liệu */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; }
.tile {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 0.85rem 0.95rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--brand); text-decoration: none; }
.tile-name { font-size: 0.86rem; color: var(--muted); }
.tile-value { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile-change { font-size: 0.86rem; }
.tile-meta { font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.unit { font-size: 0.78em; color: var(--muted); font-weight: 400; }

.big-number { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 0.8rem; margin-bottom: 0.6rem; }
.big-number .value { font-size: 2rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* bảng */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; border-radius: 0; margin: 0 -0.2rem; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: none; white-space: nowrap; background: var(--surface); }
table.data tbody tr:hover { background: var(--brand-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.clip { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }

.chg { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg.up { color: var(--up); }
.chg.down { color: var(--down); }
.chg.flat { color: var(--muted); }

.badge { display: inline-block; font-size: 0.74rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.badge.stale { background: var(--warn-bg); color: var(--warn-ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.src-official { background: var(--ok-bg); color: var(--ok-ink); }
.badge.src-paid_internal { background: var(--warn-bg); color: var(--warn-ink); }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 650; padding: 0 0.4rem; border-radius: 4px; background: var(--brand-soft); color: var(--brand); margin-right: 0.2rem; }

.status { font-size: 0.8rem; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--brand-soft); white-space: nowrap; }
.status.st-succeeded { background: var(--ok-bg); color: var(--ok-ink); }
.status.st-failed { background: var(--err-bg); color: var(--err-ink); }
.status.st-deferred, .status.st-queued { background: var(--warn-bg); color: var(--warn-ink); }

.meta-line { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; color: var(--muted); font-size: 0.9rem; }

/* biểu đồ */
.chart-wrap { width: 100%; overflow-x: auto; }
.chart .pt { fill: transparent; cursor: crosshair; }
.chart .pt:hover { fill: var(--brand); fill-opacity: 0.3; }
.spark-link { display: inline-block; line-height: 0; border-radius: 4px; }
.spark-link:hover { background: var(--brand-soft); }
/* Trang chi tiết: biến động theo mốc 1 ngày / 7 ngày / 1 tháng / 1 năm */
.horizons { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.6rem; margin: 0.2rem 0 0.9rem; }
.hz { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.hz-label { font-size: 0.82rem; color: var(--muted); }
.hz-value { font-size: 1.12rem; font-weight: 650; }
.hz-value .chg.flat { font-weight: 400; }
.hz-ref { font-size: 0.78rem; color: var(--muted); }
.tv-single { min-height: 225px; }
svg.chart { width: 100%; height: auto; min-width: 480px; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
svg.chart .line { stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
svg.chart .band { fill: var(--brand); opacity: 0.14; }
svg.chart .dot { fill: var(--brand); }
svg.spark { vertical-align: middle; }
svg.spark polyline { stroke: var(--muted); }
svg.spark.spark-up polyline { stroke: var(--up); }
svg.spark.spark-down polyline { stroke: var(--down); }
.range { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.range a { padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid var(--line); font-size: 0.85rem; color: var(--text); }
.range a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* biểu mẫu */
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.88rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.6rem; min-height: 2.3rem;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.stack { display: flex; flex-direction: column; gap: 0.8rem; }
.narrow { max-width: 26rem; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.7rem; align-items: end; }
.form-actions { display: flex; align-items: end; }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 0.8rem; }
.row-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.row-form input[type=password] { min-width: 12rem; }
label.check { flex-direction: row; align-items: center; gap: 0.3rem; color: var(--text); }
label.check input { min-height: auto; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 0.45rem 0.95rem; min-height: 2.3rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.small { padding: 0.25rem 0.6rem; min-height: 2rem; font-size: 0.85rem; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
button.link.danger { color: var(--down); }
form.inline { display: inline; margin: 0; }

.auth-card { max-width: 24rem; margin: 3rem auto; }
.error-card { max-width: 32rem; margin: 3rem auto; text-align: center; }
.error-code { font-size: 3rem; font-weight: 700; color: var(--muted); margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.2rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.subnav { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0 0 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.subnav a { padding: 0.3rem 0.7rem; border-radius: 6px; color: var(--text); }
.subnav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.token-box { border-color: var(--brand); }
.copy-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.howto { margin-top: 0.8rem; }
.howto summary { cursor: pointer; color: var(--brand); }

/* tìm khách */
.small { font-size: 0.82rem; }
.span-2 { grid-column: span 2; }
textarea { font: inherit; resize: vertical; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.two-col > .card { margin-bottom: 0; }
.row-forms { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.4rem 0; }
.lead-label { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 999px; white-space: nowrap; background: var(--brand-soft); }
.ll-xac_minh { background: var(--ok-bg); color: var(--ok-ink); }
.ll-mot_phan { background: var(--warn-bg); color: var(--warn-ink); }
.ll-chua_mo_duoc { background: var(--brand-soft); color: var(--brand); }
.ll-loai { background: var(--err-bg); color: var(--err-ink); }
.status.rq-cho_duyet, .status.rq-da_duyet, .status.rq-cho_kiem_duyet { background: var(--warn-bg); color: var(--warn-ink); }
.status.rq-dang_chay { background: var(--brand-soft); color: var(--brand); }
.status.rq-da_gui { background: var(--ok-bg); color: var(--ok-ink); }
.status.rq-tu_choi, .status.rq-loi { background: var(--err-bg); color: var(--err-ink); }
.status.ss-chot_don { background: var(--ok-bg); color: var(--ok-ink); }
.status.ss-khong_phu_hop { background: var(--err-bg); color: var(--err-ink); }
ul.contacts, ul.evidence, ul.history { list-style: none; padding: 0; margin: 0 0 0.8rem; }
ul.contacts li, ul.evidence li, ul.history li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
ul.contacts li:last-child, ul.evidence li:last-child, ul.history li:last-child { border-bottom: 0; }
.quote { color: var(--muted); font-style: italic; }
pre.note { white-space: pre-wrap; font-family: var(--font); background: var(--bg); border-radius: 8px; padding: 0.6rem; margin: 0.6rem 0 0; }
.lead-card.rv-da_an { opacity: 0.6; }
.lead-card.rv-da_duyet { border-left: 4px solid var(--up); }
.lead-card h3 { font-size: 0.95rem; margin: 0.6rem 0 0.3rem; }
/* Trang kiểm duyệt: mỗi lead là một <details>; thanh chọn nhiều bám đáy màn hình khi cuộn danh sách */
details.lead-card > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.7rem; cursor: pointer; list-style: none; }
details.lead-card > summary::-webkit-details-marker { display: none; }
details.lead-card > summary::before { content: "▸"; color: var(--muted); width: 0.8rem; }
details.lead-card[open] > summary::before { content: "▾"; }
details.lead-card[open] > summary { margin-bottom: 0.5rem; }
.lead-name { font-weight: 650; font-size: 1.02rem; }
input.pick { width: 1.15rem; height: 1.15rem; min-height: auto; margin: 0; cursor: pointer; }
.group-title { font-size: 1.05rem; margin: 1.3rem 0 0.1rem; }
.group-title + .hint { margin: 0 0 0.6rem; }
.review-counts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0; }
.review-counts .badge { font-size: 0.85rem; padding: 0.15rem 0.6rem; }
.bulk-bar { position: sticky; bottom: 0.6rem; z-index: 5; display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center;
  background: var(--surface); border: 1px solid var(--brand); border-radius: var(--radius); padding: 0.5rem 0.8rem; margin-top: 1rem; box-shadow: 0 4px 14px rgba(16, 24, 40, 0.18); }
.count-badge { display: inline-block; min-width: 1.25rem; padding: 0 0.35rem; border-radius: 999px; background: var(--down); color: #fff;
  font-size: 0.72rem; font-weight: 700; line-height: 1.25rem; text-align: center; margin-left: 0.15rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
/* Nguồn tổng hợp, không chính thức (ví dụ Sina) */
.badge.src-aggregator { background: var(--warn-bg); color: var(--warn-ink); }
/* Widget TradingView trên trang chủ */
.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.8rem; }
.tv-widget { padding: 0.5rem 0.6rem; min-height: 225px; margin-bottom: 0; }
.tv-label { font-size: 0.86rem; color: var(--muted); }
.tradingview-widget-copyright { font-size: 0.7rem; text-align: right; }
.tradingview-widget-copyright a { color: var(--muted); }
.ai-status { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: center; margin-bottom: 0.6rem; }
.ai-status .quota { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.9rem; }
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .container { --gutter: 0.75rem; }
  h1 { font-size: 1.3rem; }
  .tile-value { font-size: 1.3rem; }
  .card { padding: 0.85rem; }
}
/* Tin thị trường */
.news-item h2 { font-size: 1.05rem; margin: 0 0 0.3rem; line-height: 1.4; }
.news-item .meta-line { font-size: 0.82rem; margin: 0 0 0.35rem; }
.news-excerpt { margin: 0; color: var(--muted); font-size: 0.92rem; }
.news-latest { list-style: none; margin: 0; padding: 0.4rem 1rem; }
.news-latest li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.news-latest li:last-child { border-bottom: 0; }
.news-article { max-width: 920px; }
.news-article h1 { font-size: 1.45rem; line-height: 1.35; margin: 0.2rem 0 0.4rem; }
.news-article p { line-height: 1.65; }
.news-article h3 { font-size: 1.05rem; margin: 1.4rem 0 0.4rem; }
.news-table { margin: 0.6rem 0 1rem; }
.news-table td.up { color: var(--up); }
.news-table td.down { color: var(--down); }
.news-table tr.group-row td { background: var(--brand-soft); font-weight: 600; }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 0.45rem 0.8rem; font-size: 0.86rem; }
.news-related { margin: 0; padding-left: 1.1rem; }
.news-related li { margin: 0.3rem 0; }
.pager { display: flex; gap: 0.8rem; align-items: center; justify-content: center; margin: 1rem 0; }
/* Ô lọc không được tràn màn hình điện thoại (tên chuyên mục dài) */
.filters label { max-width: 100%; min-width: 0; }
.filters select, .filters input { max-width: 100%; }
/* Tin thị trường: thanh mục (giống menu trang gốc), bài nổi bật, khối từng mục */
.news-menu { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; background: var(--brand); padding: 0.35rem; border-radius: var(--radius); margin-bottom: 1rem; }
.news-menu a { color: var(--brand-ink); padding: 0.3rem 0.65rem; border-radius: 6px; font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.news-menu a.on, .news-menu a:hover { background: rgba(255, 255, 255, 0.2); text-decoration: none; }
.news-search { margin-left: auto; }
.news-search input { min-height: 2rem; padding: 0.25rem 0.75rem; border-radius: 999px; border: 0; width: 15rem; max-width: 100%; }
.news-featured { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.8rem; margin-bottom: 1.1rem; }
.news-feature { display: flex; flex-direction: column; gap: 0.35rem; color: var(--text); margin-bottom: 0; }
.news-feature:hover { border-color: var(--brand); text-decoration: none; }
.news-feature strong { line-height: 1.4; }
.news-sec { font-size: 0.72rem; color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.news-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0.9rem; }
.news-block { margin-bottom: 0; padding-top: 0; overflow: hidden; }
.news-block-title { margin: 0 -1.1rem 0.5rem; padding: 0.55rem 1.1rem; background: var(--brand); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.02em; }
.news-block-title a { color: var(--brand-ink); }
.news-block ul { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.news-block li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; line-height: 1.45; }
.news-block li:last-child { border-bottom: 0; }
@media (max-width: 640px) {
  .news-search { margin-left: 0; width: 100%; }
  .news-search input { width: 100%; }
  .news-featured, .news-blocks { grid-template-columns: 1fr; }
}
/* Ảnh tin: ảnh đại diện + nội dung HTML gốc (bảng gốc, biểu đồ) */
.news-thumb { width: calc(100% + 2.2rem); margin: -1rem -1.1rem 0.4rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; background: var(--brand-soft); }
.news-item.has-thumb { display: flex; gap: 0.9rem; align-items: flex-start; }
.news-item-thumb { flex: 0 0 132px; }
.news-item-thumb img { width: 132px; height: 88px; object-fit: cover; border-radius: 8px; background: var(--brand-soft); display: block; }
.news-item-body { min-width: 0; flex: 1; }
.news-html { line-height: 1.65; overflow-wrap: anywhere; }
.news-html img { max-width: 100%; height: auto; display: block; margin: 0.8rem auto; border-radius: 6px; }
/* Bảng: không ngắt giữa con số ("40,200-40,700" thành "40,|200|-40,|700" trên điện thoại) — bảng rộng thì cuộn ngang */
.news-html table { border-collapse: collapse; margin: 0.8rem 0; font-size: 0.9rem; display: block; overflow-x: auto; max-width: 100%; overflow-wrap: normal; }
.news-html th, .news-html td { border: 1px solid var(--line); padding: 0.35rem 0.55rem; vertical-align: top; }
.news-html tr:first-child td, .news-html th { background: var(--brand-soft); font-weight: 600; }
.news-html td p { margin: 0; }
.news-html td.up { color: var(--up); }
.news-html td.down { color: var(--down); }
.news-html td.num { white-space: nowrap; }  /* services/news.py::number_cells */
@media (max-width: 640px) {
  .news-item-thumb { flex-basis: 96px; }
  .news-item-thumb img { width: 96px; height: 68px; }
}
/* Sales Kit: Báo giá & in PDF A4 */
.quote-brand { font-size: 1.05rem; color: var(--brand); }
.print-sheet { max-width: 880px; margin: 0.8rem auto; padding: 1.6rem 1.8rem; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 2px solid var(--brand); padding-bottom: 0.8rem; margin-bottom: 1rem; }
.print-title { text-align: right; }
.print-title h2 { color: var(--brand); margin: 0 0 0.2rem; }
.print-table { margin: 1rem 0; }
.print-bank { background: var(--bg); border-radius: 8px; padding: 0.7rem 0.9rem; margin: 0.8rem 0; }
.print-bank h3 { margin: 0 0 0.25rem; font-size: 0.92rem; }
.print-bank p { margin: 0; font-size: 0.9rem; }
.print-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.2rem; text-align: center; padding-bottom: 2.5rem; }
@media print {
  .topbar, .subnav, .tabbar, .footer, .no-print, .crumbs, .flash { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .container { max-width: none; padding: 0; }
  .print-sheet { border: 0; box-shadow: none; margin: 0; padding: 0; }
}
