:root {
  --up: #3f7d4f;
  --up-bg: rgba(63, 125, 79, 0.1);
  --down: #c0492f;
  --down-bg: rgba(192, 73, 47, 0.1);
}

.pos { color: var(--up); }
.neg { color: var(--down); }
.flat { color: var(--muted); }

.active-link {
  color: var(--ink) !important;
  background: var(--surface-warm);
}

/* ====================== TAB Chứng khoán / Crypto ====================== */
.mkt-tabs {
  display: flex;
  gap: 10px;
  padding-top: 28px;
  padding-bottom: 4px;
}
.mkt-tab {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.mkt-tab:hover { color: var(--ink); }
.mkt-tab.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
#pane-ck .report-hero, #pane-crypto .report-hero { padding-top: 30px !important; }

/* ====================== AI ANALYSIS ====================== */
.analysis {
  padding-top: 50px !important;
  padding-bottom: 8px !important;
}
.an-title {
  margin: 14px 0 0;
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.025em;
}
.an-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 30px;
}
.an-block {
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.an-block:first-child {
  grid-column: 1 / -1;
  background: var(--ink);
  border-color: var(--ink);
}
.an-block:first-child h3 { color: var(--clay); }
.an-block:first-child p { color: var(--bg); }
.an-block h3 {
  margin: 0 0 12px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clay-deep);
}
.an-block p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 16.5px;
  line-height: 1.78;
}
.an-block:first-child p { font-size: 17.5px; line-height: 1.7; }
.an-block p:last-child { margin-bottom: 0; }
.an-note {
  margin: 24px 0 0;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12.5px;
  color: var(--faint);
}
.analysis-off {
  margin-top: 16px;
  padding: 22px 26px;
  background: var(--surface-warm);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  color: var(--muted);
}

/* watchlist — cổ phiếu cần lưu ý */
.wl-title { margin-top: 40px !important; }
.watch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}
.watch-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.watch-card.wl-short { border-top-color: var(--clay); }
.watch-card.wl-mid { border-top-color: #6a9bcc; }
.watch-card.wl-long { border-top-color: var(--up); }
.wl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.wl-name {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wl-short .wl-name { color: var(--clay-deep); }
.wl-mid .wl-name { color: #4f7cae; }
.wl-long .wl-name { color: var(--up); }
.wl-hold {
  margin-top: 4px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  color: var(--muted);
}
.wl-count {
  flex: none;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  background: var(--surface-warm);
  border-radius: 999px;
  padding: 3px 10px;
}
.wl-list { padding: 4px 22px 14px; }
.wl-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.wl-item:first-child { border-top: none; }
.wl-sum {
  cursor: pointer;
  list-style: none;
}
.wl-sum::-webkit-details-marker { display: none; }
.wl-sum-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wl-sym {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.wl-caret {
  color: var(--faint);
  font-size: 12px;
  transition: transform 0.18s ease;
}
.wl-item[open] .wl-caret { transform: rotate(180deg); color: var(--clay); }
.wl-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}
.wl-analysis {
  margin: 10px 0 2px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

/* luận điểm đầu tư + giá mục tiêu trong khối BCTC */
.thesis {
  margin: 4px 0 18px;
  padding: 18px 20px;
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.th-head {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 14px;
}
.th-row {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.th-row:first-of-type { border-top: none; padding-top: 0; }
.th-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.th-name {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.th-hold {
  margin-left: auto;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  color: var(--muted);
}
.th-why {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.th-target {
  margin: 6px 0 0;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.th-target b { color: var(--clay-deep); }
.fin-stmts-label {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 18px 0 8px;
}

/* bảng chỉ số tài chính */
.metrics { margin-bottom: 8px; }
.metrics-head {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 10px;
}
.metrics .fin-table td:first-child { font-weight: 500; color: var(--ink); }
.metrics .fin-table tr.metric-sub td {
  padding-top: 4px;
  padding-bottom: 9px;
  border-top: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
}
.metrics .fin-table tr.metric-sub td:first-child { font-weight: 400; color: var(--muted); }

/* biểu đồ tài chính */
.fin-charts {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin: 16px 0 4px;
}
.chart-card {
  margin: 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.chart-donut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.fin-chart { width: 100%; height: auto; }
.fin-donut { width: 140px; height: 140px; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
}
.chart-donut-card .chart-legend { margin: 12px 0 0; justify-content: center; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-card figcaption {
  margin-top: 12px;
  font-family: "Lora", Georgia, serif;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* crypto — thông tin coin + tên coin trong bảng */
.ft-cn {
  display: block;
  margin-top: 2px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
}
.coin-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 26px;
  margin-bottom: 12px;
}
.ci-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
}
.ci-row span { color: var(--muted); }
.ci-row b { color: var(--ink); font-weight: 600; }

/* financial statements — báo cáo tài chính */
.fin-note {
  margin: 6px 0 18px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 13px;
  color: var(--faint);
}
.fin-stock {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.fin-stock > summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  padding: 18px 24px;
  font-family: "Poppins", Arial, sans-serif;
}
.fin-stock[open] > summary { border-bottom: 1px solid var(--line); }
.fin-sym { font-size: 16px; font-weight: 600; color: var(--ink); }
.fin-co { color: var(--muted); font-size: 13px; flex: 1; }
.fin-sum { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.fin-body { padding: 4px 24px 18px; }
.fin-stmt { border-top: 1px solid var(--line); }
.fin-stmt:first-child { border-top: none; }
.fin-stmt > summary {
  cursor: pointer;
  padding: 13px 0;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--clay-deep);
}
.fin-scroll {
  overflow-x: auto;
  max-height: 460px;
  overflow-y: auto;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 13px;
  white-space: nowrap;
}
.fin-table th {
  position: sticky;
  top: 0;
  padding: 9px 14px;
  background: var(--surface-warm);
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  text-align: right;
}
.fin-table th:first-child { text-align: left; }
.fin-table td { padding: 8px 14px; border-top: 1px solid var(--line); color: var(--ink-soft); }
.fin-table .ft-n { text-align: right; }
.fin-item { text-align: left; white-space: normal; max-width: 360px; }

/* tô đậm các mã cần lưu ý trong bảng toàn sàn */
.full-table tr.watched { background: rgba(217, 119, 87, 0.06); }
.full-table tr.watched .ft-sym { color: var(--clay-deep); font-weight: 700; }
.wl-star { color: var(--clay); font-size: 10px; vertical-align: middle; }

/* tag kỳ hạn NH / TH / DH */
.ft-tags { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.fin-sym + .ft-tags { margin-left: 4px; }
.htag {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
}
.htag-nh { color: var(--clay-deep); background: rgba(217, 119, 87, 0.13); }
.htag-th { color: #4f7cae; background: rgba(106, 155, 204, 0.16); }
.htag-dh { color: var(--up); background: var(--up-bg); }

/* ====================== DAILY REPORT ====================== */
.report section.shell {
  padding-top: 46px;
  padding-bottom: 0;
}
.report .mono-label {
  margin-bottom: 22px;
}

.report-hero {
  padding-top: 80px !important;
  padding-bottom: 30px !important;
  border-bottom: 1px solid var(--line);
}
.hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.report-hero h1 {
  margin: 14px 0 0;
  font-size: clamp(34px, 5vw, 60px);
  font-weight: 600;
  letter-spacing: -0.03em;
}
.hero-chg {
  margin-top: 12px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
}
.spark {
  width: 320px;
  max-width: 100%;
  height: 64px;
}

/* index cards */
.idx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.idx-card {
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.idx-name {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.idx-close {
  margin-top: 12px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.idx-chg {
  margin-top: 6px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
}

/* stat grid (breadth / liquidity / foreign) */
.stat-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
}
.stat-card {
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat-label {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.stat-value {
  margin-top: 14px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.stat-sub {
  margin-top: 6px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 13px;
  color: var(--muted);
}
.breadth-bar {
  display: flex;
  height: 12px;
  margin-top: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-warm);
}
.breadth-bar span { display: block; height: 100%; }
.b-adv { background: var(--up); }
.b-unch { background: var(--mid-gray, #b0aea5); }
.b-dec { background: var(--down); }
.breadth-legend {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
}

/* sectors */
.sectors {
  display: grid;
  gap: 12px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sec-row {
  display: grid;
  grid-template-columns: 150px 1fr 64px;
  align-items: center;
  gap: 16px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
}
.sec-name { font-weight: 500; }
.sec-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-warm);
}
.sec-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
}
.sec-fill.pos { left: 0; background: var(--up); }
.sec-fill.neg { right: 0; background: var(--down); }
.sec-fill.flat { left: 0; background: var(--mid-gray, #b0aea5); }
.sec-pct { text-align: right; font-weight: 600; font-size: 13px; }

/* mini tables */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.mini-grid.two { grid-template-columns: repeat(2, 1fr); }
.mini {
  padding: 8px 22px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.mini h3 {
  margin: 18px 0 6px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
}
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
}
.mini-table td {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
.mt-sym { font-weight: 600; color: var(--ink); }
.mt-name {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-price { text-align: right; color: var(--ink-soft); }
.mt-val { text-align: right; font-weight: 600; width: 90px; }

/* full stock table */
.full-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.full-head .mono-label { margin-bottom: 0; }
.stock-search {
  width: 280px;
  max-width: 100%;
  padding: 11px 16px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.15s ease;
}
.stock-search:focus { border-color: var(--clay); }
.stock-search::placeholder { color: var(--faint); }

.table-scroll-full {
  margin-top: 22px;
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.full-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  white-space: nowrap;
}
.full-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  background: var(--surface-warm);
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
}
.full-table th.ft-n { text-align: right; }
.full-table th.sortable { cursor: pointer; user-select: none; }
.full-table th.sortable:hover { color: var(--ink); }
.full-table th.sorted-asc::after { content: " ↑"; color: var(--clay); }
.full-table th.sorted-desc::after { content: " ↓"; color: var(--clay); }
.full-table tbody td {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}
.full-table tbody tr:hover { background: var(--surface-warm); }
.ft-sym { font-weight: 600; color: var(--ink); }
.ft-name {
  color: var(--muted);
  font-size: 13px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ft-n { text-align: right; }
.search-empty {
  padding: 36px 16px;
  text-align: center;
  font-family: "Poppins", Arial, sans-serif;
  color: var(--muted);
}

.report .disclaimer {
  display: block;
  max-width: 80ch;
  margin: 56px auto 0;
  padding-bottom: 80px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--faint);
}

/* ====================== HUB (market.html) ====================== */
.latest-card {
  display: block;
  margin-top: 30px;
  padding: 34px 36px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  transition: transform 0.18s ease;
}
.latest-card:hover { transform: translateY(-2px); }
.latest-card .ll {
  font-family: "Poppins", Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid-gray, #b0aea5);
}
.latest-card .lv {
  margin-top: 14px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.latest-card .lsub {
  margin-top: 10px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  color: var(--mid-gray, #b0aea5);
}

.archive-section {
  margin-top: 30px;
  border-top: 1px solid var(--line);
}
.archive-section .an-title { margin-top: 14px; }

.archive {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.arch-row {
  display: grid;
  grid-template-columns: 130px 1.3fr 1fr 1fr 1fr 40px;
  gap: 16px;
  align-items: center;
  padding: 18px 24px;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink-soft);
  transition: background 0.15s ease;
}
.arch-row + .arch-row { border-top: 1px solid var(--line); }
a.arch-row:hover { background: var(--surface-warm); }
.arch-row.head {
  background: var(--surface-warm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}
.arch-date { font-weight: 600; color: var(--ink); }
.arch-row .arrow { justify-self: end; color: var(--faint); }
a.arch-row:hover .arrow { color: var(--clay); }

@media (max-width: 820px) {
  .stat-grid { grid-template-columns: 1fr; }
  .mini-grid, .mini-grid.two { grid-template-columns: 1fr; }
  .an-grid, .watch-grid, .fin-charts { grid-template-columns: 1fr; }
  .sec-row { grid-template-columns: 110px 1fr 56px; gap: 10px; font-size: 13px; }
  .arch-row { grid-template-columns: 90px 1fr 60px; }
  .arch-row .arch-c, .arch-row.head .arch-c { display: none; }
}
