
/* Bố cục: đầu trang gọn (hãng, ngày chốt số), thanh tab dính trên cùng, mỗi tab vừa một đến hai màn hình. Bảng trên desktop chuyển thành thẻ xếp dọc trên điện thoại. */
/* Màu và chữ theo brand guideline TGSF: xanh royal #051ED8 làm chủ đạo, Lip Coral làm điểm nhấn duy nhất; tiêu đề Bricolage Grotesque, nội dung Be Vietnam Pro. */
:root {
  --bg: #F3F5FC;
  --surface: #FFFFFF;
  --ink: #0B1238;
  --muted: #5A6285;
  --line: #DADFF0;
  --royal: #051ED8;
  --royal-soft: #98A5F3;
  --prev: #C9CEDF;
  --coral: #FF3D77;
  --gold: #FFCB2B;
  --on-royal: #FFFFFF;
  --good: #1B7A4B;
  --warn: #96600A;
  --crit: #B4232F;
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Be Vietnam Pro", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0A0F2A; --surface: #121939; --ink: #EDF0FF; --muted: #A0A8CC; --line: #263060;
    --royal: #8493FF; --royal-soft: #4553B8; --prev: #343E6B; --coral: #FF6A96; --gold: #E5B626; --on-royal: #0A0F2A;
    --good: #5FC892; --warn: #E3B25A; --crit: #FF8A93;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0F2A; --surface: #121939; --ink: #EDF0FF; --muted: #A0A8CC; --line: #263060;
  --royal: #8493FF; --royal-soft: #4553B8; --prev: #343E6B; --coral: #FF6A96; --gold: #E5B626; --on-royal: #0A0F2A;
  --good: #5FC892; --warn: #E3B25A; --crit: #FF8A93;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
[hidden] { display: none !important; }

.mock-note { background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 6px 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--royal); color: var(--on-royal); }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 18px; }
.wordmark span { font-weight: 700; opacity: .8; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.who span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; padding-top: 18px; padding-bottom: 12px; }
.brand h1 { margin: 0; font-family: var(--display); font-size: 40px; line-height: 1; font-weight: 800; letter-spacing: -0.02em; color: var(--royal); }
.sync { font-size: 13px; color: var(--muted); }
.sync strong { color: var(--ink); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; }

.tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.tabs .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs .wrap::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 12px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-selected="true"] { color: var(--royal); border-bottom-color: var(--royal); font-weight: 600; }

main.wrap { padding-top: 24px; padding-bottom: 56px; }
.panel { display: flex; flex-direction: column; gap: 28px; }
h2 { margin: 0 0 4px; font-family: var(--display); font-size: 19px; font-weight: 700; }
.sub { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.lead { margin: 0; max-width: 68ch; font-size: 17px; text-wrap: balance; }
.up { color: var(--good); font-weight: 600; } .down { color: var(--crit); font-weight: 600; } .flat { color: var(--muted); }

.figures { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; border-top: 3px solid var(--royal); border-bottom: 1px solid var(--line); }
.fig { padding: 14px 14px 14px 0; min-width: 0; }
.fig + .fig { padding-left: 14px; border-left: 1px solid var(--line); }
.fig dt { font-size: 13px; color: var(--muted); }
.fig dd { margin: 2px 0 0; font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.15; }
.fig dd small { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--muted); }
.fig .cmp { font-size: 13px; margin-top: 2px; color: var(--muted); }
.fig.key dd { color: var(--royal); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
#chart { display: block; width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i, .bandkey i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.bright { background: var(--royal); color: var(--on-royal); border-radius: 10px; padding: 18px; }
.bright ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.bright li { padding-left: 14px; border-left: 3px solid var(--coral); }
.bandbar { display: flex; gap: 2px; height: 18px; border-radius: 5px; overflow: hidden; }
.bandbar i { display: block; min-width: 4px; }
.bandkey { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 18px; font-size: 14px; }
.bandkey span { color: var(--muted); font-size: 13px; }
.b-ok { background: var(--good); } .b-fast { background: var(--royal); } .b-hi1 { background: var(--gold); } .b-hi2 { background: var(--warn); } .b-none { background: var(--prev); }
.more { align-self: flex-start; color: var(--royal); font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--royal); }

.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; }
.tools .left { display: flex; flex-wrap: wrap; gap: 10px; flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; font-size: 14px; color: var(--muted); min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--royal); color: var(--on-royal); }
.field { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.field input, .field select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 14px; }
.field.grow { flex: 1; min-width: 180px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--royal); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.name { white-space: normal; min-width: 160px; font-weight: 500; }
td.name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
td.strong { font-weight: 600; }
.track { display: block; height: 6px; margin-top: 6px; background: var(--line); border-radius: 3px; overflow: hidden; max-width: 320px; }
.track i { display: block; height: 100%; background: var(--royal); border-radius: 3px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.ok { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.tag.fast { color: var(--royal); background: color-mix(in srgb, var(--royal) 10%, transparent); }
.tag.hi1, .tag.hi2 { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.tag.none { color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }
.closed { font-size: 12px; color: var(--warn); font-weight: 500; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.pager .btns { display: flex; gap: 6px; }
.pager button { min-width: 40px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.pager button[aria-current="true"] { background: var(--royal); color: var(--on-royal); border-color: var(--royal); }
.pager button:disabled { opacity: .45; cursor: default; }
.empty { padding: 28px 0; color: var(--muted); }

.defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 32px; margin: 0; }
.defs dt { font-weight: 600; } .defs dd { margin: 0; color: var(--muted); }

@media (max-width: 760px) {
  body { font-size: 15px; }
  .brand h1 { font-size: 32px; }
  .lead { font-size: 16px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures { column-gap: 16px; }
  .fig, .fig + .fig { padding: 12px 0; border-left: 0; border-top: 1px solid var(--line); }
  .fig.key { grid-column: 1 / -1; border-top: 0; }
  .fig dd { font-size: 26px; }
  .pair { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  /* Bảng thành thẻ: mỗi dòng một thẻ, nhãn cột đi kèm từng số */
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table, tbody { display: block; }
  tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  td { display: flex; flex-direction: column; align-items: flex-start; padding: 0; border: 0; text-align: left; white-space: normal; }
  td[data-l]::before { content: attr(data-l); font-size: 12px; color: var(--muted); font-weight: 400; }
  td.name { grid-column: 1 / -1; min-width: 0; }
  td.wide { grid-column: span 2; }
  .track { max-width: none; width: 100%; }
  .pager .nums { display: none; }
}

.auth { max-width: 560px; margin: 10vh auto; padding: 24px; }
.auth a, .who a { color: inherit; }
.error { color: var(--crit); }
.preview { margin: 16px auto; }

.legend-royal { background: var(--royal); }

.legend-royal-soft { background: var(--royal-soft); }

.legend-prev { background: var(--prev); }
