/* biome-ignore-all lint/style/noDescendingSpecificity: tệp xếp theo thành phần (header, bảng, form…); quy tắc chung của thẻ a/input đứng trước, quy tắc riêng của từng thành phần đứng sau và không đè lên nhau. */
/* Một tệp CSS, không phông web, không framework: trang nhẹ để Lighthouse mobile >= 90. */

:root {
  /* Bảng màu theo VnExpress: đỏ mận #9f224e, chữ #222, kẻ #e5e5e5, nền xám rất nhạt. */
  --text: #222222;
  --muted: #5c5c5c;
  --bg: #ffffff;
  --page: #f7f7f7;
  --surface: #f4f4f4;
  --card: #ffffff;
  --line: #e5e5e5;
  --line-strong: #cfcfcf;
  --accent: #9f224e;
  --accent-hover: #7e1a3d;
  --accent-soft: #f9eef2;
  --accent-text: #ffffff;
  --notice: #fff7df;
  --notice-line: #d9b43c;
  --row-alt: #fafafa;
  --row-hover: #fbf1f5;
  --shadow: 0 1px 2px rgb(0 0 0 / 5%), 0 1px 3px rgb(0 0 0 / 7%);
  --shadow-lg: 0 10px 30px rgb(0 0 0 / 12%);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  /* Màu đường của biểu đồ: bảng màu tham chiếu dataviz, đã kiểm bằng validate_palette. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #ececec;
    --muted: #b3b3b3;
    --bg: #151515;
    --page: #101010;
    --surface: #1e1e1e;
    --card: #191919;
    --line: #2e2e2e;
    --line-strong: #404040;
    --accent: #e8829f;
    --accent-hover: #f2a7bc;
    --accent-soft: #34151f;
    --accent-text: #151515;
    --notice: #2e260d;
    --notice-line: #8a7224;
    --row-alt: #171717;
    --row-hover: #2a1820;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-lg: 0 10px 30px rgb(0 0 0 / 50%);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Header dính ở màn rộng: chừa chỗ khi nhảy tới neo (#calc-…). */
@media (min-width: 48rem) {
  html {
    scroll-padding-top: 5rem;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.65rem, 1.2rem + 1.8vw, 2.35rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0.75rem 0 0.5rem;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 2.75rem 0 0.9rem;
}

h3 {
  font-size: 1.075rem;
  font-weight: 650;
  margin: 1.75rem 0 0.5rem;
}

p {
  margin: 0.75rem 0;
}

main p,
main li {
  max-width: 52rem;
}

strong {
  font-weight: 650;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 20;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Khung trang */

.wrap,
main {
  max-width: 66rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 48rem) {
  .wrap,
  main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 48rem) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(8px);
  }
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1.5rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.site-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 750;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.site-name:hover {
  color: var(--text);
}

.site-name .logo {
  color: var(--accent);
  flex: none;
}

/* Chế độ tối: nền logo là hồng mận sáng, chữ PS đổi sang màu tối để đủ tương phản. */
.site-name .logo-text {
  fill: var(--accent-text);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin: 0 -0.5rem;
}

.site-nav > a,
.states-menu summary {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
}

.site-nav > a:hover,
.states-menu summary:hover,
.states-menu[open] summary {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 30rem) {
  .site-nav > a,
  .states-menu summary {
    padding: 0.3rem 0.45rem;
    font-size: 0.9rem;
  }
}

/* Nút Menu chỉ hiện trên màn hẹp và khi có JavaScript (header có lớp js-nav). */
.nav-toggle {
  display: none;
}

@media (max-width: 47.99rem) {
  .js-nav .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--line-strong);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
  }

  .js-nav .nav-toggle:hover,
  .js-nav.nav-open .nav-toggle {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
  }

  .js-nav .site-nav {
    display: none;
  }

  .js-nav.nav-open .site-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0.25rem 0 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--line);
  }

  .js-nav.nav-open .site-nav > a,
  .js-nav.nav-open .states-menu summary {
    padding: 0.65rem 0.5rem;
    font-size: 1rem;
    color: var(--text);
  }

  .js-nav.nav-open .states-menu ul {
    position: static;
    min-width: 0;
    margin: 0 0 0.25rem 0.75rem;
    padding: 0;
    border: 0;
    box-shadow: none;
    columns: 2;
  }
}

.states-menu {
  position: relative;
}

.states-menu summary {
  cursor: pointer;
  list-style: none;
}

.states-menu summary::-webkit-details-marker {
  display: none;
}

.states-menu summary::after {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-left: 0.4em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
}

.states-menu[open] summary::after {
  transform: translateY(0.05em) rotate(-135deg);
}

.states-menu ul {
  position: absolute;
  z-index: 15;
  min-width: 13rem;
  margin: 0.4rem 0 0;
  padding: 0.4rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.states-menu li a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.states-menu li a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.states-menu li:last-child {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--line);
}

.states-menu li:last-child a {
  color: var(--accent);
  font-weight: 600;
}

main {
  padding-top: 1.25rem;
  padding-bottom: 3rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 2rem 0 2.5rem;
  background: var(--page);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  max-width: 52rem;
  margin-top: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.site-footer nav a {
  color: var(--muted);
  font-weight: 550;
  text-decoration: none;
}

.site-footer nav a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Chữ */

.lede {
  font-size: 1.1rem;
  color: var(--muted);
  margin-top: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 550;
  line-height: 1.5;
  vertical-align: 0.1em;
  white-space: nowrap;
}

.notice {
  padding: 0.85rem 1rem;
  background: var(--notice);
  border: 1px solid color-mix(in srgb, var(--notice-line) 45%, transparent);
  border-left: 4px solid var(--notice-line);
  border-radius: var(--radius-sm);
}

.verbatim {
  white-space: pre-line;
  padding: 0.85rem 1rem;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.925rem;
}

.comparison {
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.breadcrumbs li + li::before {
  content: "›";
  margin-right: 0.35rem;
  color: var(--line-strong);
}

/* Trang chủ */

.hero {
  margin: 0.5rem 0 1rem;
  padding: 1.5rem 1.25rem;
  background:
    radial-gradient(
      120% 140% at 100% 0%,
      color-mix(in srgb, var(--accent) 14%, transparent),
      transparent 60%
    ),
    linear-gradient(180deg, var(--accent-soft), var(--page));
  border: 1px solid var(--line);
  border-radius: 1rem;
}

@media (min-width: 48rem) {
  .hero {
    padding: 2.25rem 2.25rem 2rem;
  }
}

.hero h1 {
  margin-top: 0;
  max-width: 40rem;
}

.hero .lede {
  max-width: 44rem;
}

.hero .search-form {
  max-width: 40rem;
  margin: 1.25rem 0;
}

.hero .search-row input {
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.hero .search-row button {
  padding: 0.75rem 1.4rem;
  font-size: 1.05rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  margin: 1.25rem 0 0;
}

.stats div {
  display: flex;
  flex-direction: column-reverse;
}

.stats dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.stats dd {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.extremes {
  display: grid;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

.extremes li {
  padding-left: 1rem;
  border-left: 3px solid var(--line-strong);
}

/* Bảng */

/* position: relative giữ các nhãn ẩn (visually-hidden, position: absolute) bên trong khung cuộn;
   thiếu nó thì nhãn ẩn ở cột cuối đẩy cả trang rộng ra và trang cuộn ngang. */
.table-scroll {
  position: relative;
  overflow-x: auto;
  margin: 0.75rem 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

caption {
  caption-side: bottom;
  padding: 0.6rem 0.9rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.8125rem;
  background: var(--page);
  border-top: 1px solid var(--line);
}

th,
td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

@media (max-width: 30rem) {
  th,
  td {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}

thead th a {
  color: inherit;
  text-decoration: none;
}

thead th a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Cột sắp xếp được: mũi tên mờ, cột đang sắp xếp đậm màu. */
thead th a[data-sort-first]::after {
  content: " ↕";
  opacity: 0.45;
}

thead th[aria-sort] a {
  color: var(--accent);
}

thead th[aria-sort="ascending"] a::after {
  content: " ↑";
  opacity: 1;
}

thead th[aria-sort="descending"] a::after {
  content: " ↓";
  opacity: 1;
}

tbody th {
  font-weight: 600;
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

tbody tr:hover {
  background: var(--row-hover);
}

td.empty {
  color: var(--muted);
}

/* Cỡ chữ bảng lương đổi theo nút A−/A+ (biến --table-scale do site.js đặt). */
.schedule {
  font-size: calc(1rem * var(--table-scale, 1));
}

.schedule thead th {
  font-size: 0.75em;
}

.table-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 -0.25rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.table-tools[hidden] {
  display: none;
}

.table-tools span {
  margin-right: 0.25rem;
}

.table-tools button {
  min-width: 2.25rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 650;
}

.table-tools button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.table-tools button:disabled {
  opacity: 0.4;
  cursor: default;
}

.schedule-picker {
  margin: 1.5rem 0;
}

.schedule-picker h2 {
  margin-top: 0;
}

.schedule-picker ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.6rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.schedule-picker li {
  max-width: none;
}

.schedule-picker a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  height: 100%;
  padding: 0.75rem 0.95rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
}

.schedule-picker a:hover {
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}

.picker-title {
  font-weight: 650;
}

.back-link {
  font-size: 0.9rem;
}

.schedule td,
.schedule thead th:not(:first-child) {
  text-align: right;
}

.districts thead th:nth-child(n + 4),
.districts td:nth-child(n + 4) {
  text-align: right;
}

.districts tbody th {
  min-width: 15rem;
  white-space: normal;
}

/* Bảng lương có JavaScript: tô hàng và cột dưới con trỏ, ô đang chọn của máy tính có viền. */
.schedule tbody tr.hl-row > *,
.schedule tbody tr.hl-row > th,
.schedule .hl-col {
  background: var(--row-hover);
}

.schedule thead th.hl-col {
  color: var(--accent);
}

.schedule td.hl-cell {
  background: var(--accent-soft);
}

.schedule.is-interactive td[data-cents] {
  cursor: pointer;
}

.schedule td.is-selected {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
  font-weight: 700;
}

.self-row,
.self-row:nth-child(even) {
  background: var(--accent-soft);
}

.self-row th {
  font-weight: 700;
}

/* Cột bậc đứng yên khi cuộn ngang trên điện thoại. */
.schedule th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.schedule tbody th:first-child {
  background: var(--page);
}

.schedule th,
.schedule td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

/* Bảng lương dài: cuộn trong khung, hàng tên lane dính trên cùng, cột bậc dính bên trái. */
.table-scroll.tall {
  max-height: min(38rem, 78vh);
  overflow: auto;
}

.tall thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.tall .schedule thead th:first-child {
  z-index: 3;
}

.notes {
  font-size: 0.875rem;
  color: var(--muted);
}

.download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.download span {
  color: var(--muted);
  font-size: 0.9rem;
}

.download a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.download a::before {
  content: "↓";
}

.download a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Biểu đồ lương theo bậc */

.pay-chart {
  position: relative;
  max-width: 36rem;
  margin: 0.75rem 0 1.5rem;
  padding: 0.75rem 0.75rem 0.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pay-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-size: 12px;
  touch-action: pan-y;
}

/* Màn hẹp: SVG thu nhỏ theo chiều rộng nên tăng cỡ chữ (đơn vị của viewBox) để vẫn đọc được. */
@media (max-width: 30rem) {
  .pay-chart {
    padding: 0.6rem 0.4rem 0.4rem;
  }

  .pay-chart svg {
    font-size: 14px;
  }
}

.pay-chart .grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.pay-chart text {
  fill: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pay-chart .end-label {
  fill: var(--text);
  font-weight: 600;
}

.pay-chart .series path {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.pay-chart .leader {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
}

.pay-chart circle {
  stroke: var(--card);
  stroke-width: 2;
}

.pay-chart .crosshair {
  stroke: var(--muted);
  stroke-width: 1;
  visibility: hidden;
}

.pay-chart path.s1 {
  stroke: var(--series-1);
}

.pay-chart path.s2 {
  stroke: var(--series-2);
}

.pay-chart path.s3 {
  stroke: var(--series-3);
}

.pay-chart path.s4 {
  stroke: var(--series-4);
}

.pay-chart circle.s1,
.chart-legend .s1,
.chart-tip .s1 {
  fill: var(--series-1);
  background: var(--series-1);
}

.pay-chart circle.s2,
.chart-legend .s2,
.chart-tip .s2 {
  fill: var(--series-2);
  background: var(--series-2);
}

.pay-chart circle.s3,
.chart-legend .s3,
.chart-tip .s3 {
  fill: var(--series-3);
  background: var(--series-3);
}

.pay-chart circle.s4,
.chart-legend .s4,
.chart-tip .s4 {
  fill: var(--series-4);
  background: var(--series-4);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-legend .key {
  width: 0.9rem;
  height: 0.25rem;
  border-radius: 999px;
}

.pay-chart figcaption {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.chart-tip {
  position: absolute;
  top: 2.25rem;
  z-index: 2;
  min-width: 9rem;
  padding: 0.45rem 0.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  pointer-events: none;
  transform: translateX(-50%);
}

.chart-tip strong {
  display: block;
  margin-bottom: 0.15rem;
}

.chart-tip .key {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
}

.chart-tip div {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.chart-tip div span:last-child {
  margin-left: auto;
  padding-left: 0.75rem;
  font-weight: 600;
}

/* Trang so sánh: mức cao nhất, thấp nhất và thanh tỉ lệ */

.compare tbody th {
  min-width: 12rem;
  white-space: normal;
}

.amount-cell {
  min-width: 11rem;
  white-space: normal;
}

.amount-cell .amount {
  font-weight: 650;
}

.amount-cell .bar {
  display: block;
  height: 0.35rem;
  margin: 0.3rem 0 0.15rem;
  border-radius: 999px;
  background: var(--line-strong);
}

.top-row .amount-cell .bar {
  background: var(--accent);
}

.amount-cell .gap {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.badge-top {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
}

.top-row,
.top-row:nth-child(even) {
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}

/* Bảng mẫu ở trang chủ: số liệu căn phải như bảng của trang bang. */
.benchmarks thead th:nth-child(n + 3),
.benchmarks td:nth-child(n + 3) {
  text-align: right;
}

/* Thanh độ phủ của trang bang */
.coverage {
  max-width: 32rem;
  margin: 0.25rem 0 1rem;
}

.coverage-bar {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.coverage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.coverage p {
  margin: 0.35rem 0 0;
}

.table-filter[hidden] {
  display: none;
}

@media (min-width: 48rem) {
  .table-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
  }

  .table-filter label {
    margin-bottom: 0;
  }

  .table-filter input {
    flex: 1 1 18rem;
  }

  .table-filter p {
    flex-basis: 100%;
  }
}

/* Trang bang: hai bảng xếp hạng */
.top-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem 1.5rem;
}

.top-lists h3 {
  margin-top: 0.5rem;
}

.top-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rank;
  border-top: 1px solid var(--line);
}

.top-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  max-width: none;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--line);
  counter-increment: rank;
}

.top-list li::before {
  content: counter(rank);
  min-width: 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.top-list a {
  flex: 1;
  font-weight: 600;
}

.top-list span {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history td {
  text-align: right;
}

/* Thẻ liên kết nhỏ (học khu gợi ý sẵn, liên kết của trang 404) */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.chip-list li {
  max-width: none;
}

.chip-list a {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  font-weight: 600;
  text-decoration: none;
}

.chip-list a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.chip-list .muted {
  font-weight: 500;
}

/* Biểu mẫu */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 12rem;
  flex: 1 1 12rem;
}

label {
  font-weight: 600;
  font-size: 0.875rem;
}

select,
input,
textarea {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  max-width: 100%;
}

select:hover,
input:hover,
textarea:hover {
  border-color: var(--muted);
}

button,
.button {
  display: inline-block;
  font: inherit;
  font-weight: 650;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

button:hover,
.button:hover {
  background: var(--accent-hover);
  color: var(--accent-text);
}

.calc {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 1rem;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* button có display riêng nên phải ẩn rõ khi mang thuộc tính hidden (nút Calculate khi có JS). */
button[hidden] {
  display: none;
}

.search-form {
  margin: 1rem 0;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.search-row input {
  flex: 1;
  min-width: 0;
}

.search-row {
  position: relative;
}

/* Danh sách gợi ý dưới ô tìm kiếm (site.js). */
.suggest {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 22rem;
  margin: 0;
  padding: 0.35rem;
  overflow-y: auto;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.suggest li {
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.suggest li[aria-selected="true"] {
  background: var(--accent-soft);
}

.suggest-name {
  font-weight: 650;
  color: var(--accent);
}

.suggest-place {
  color: var(--muted);
  font-size: 0.85rem;
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 40rem;
}

.hp {
  position: absolute;
  left: -9999px;
}

/* Ô số liệu */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.facts > div {
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.facts dt {
  color: var(--muted);
  font-size: 0.8125rem;
}

.facts dd {
  margin: 0.15rem 0 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.calc-result dd {
  font-size: 1.05rem;
}

.calc-result > div:first-child {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.calc-result > div:first-child dd {
  font-size: 1.4rem;
}

@media (max-width: 30rem) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .facts > div {
    padding: 0.7rem 0.8rem;
  }

  .facts dd {
    font-size: 1.1rem;
  }

  .calc-result > div:first-child {
    grid-column: 1 / -1;
  }
}

.facts.source {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.facts.source > div {
  box-shadow: none;
}

.facts.source dd {
  font-size: 0.95rem;
  font-weight: 550;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

/* Danh sách */

.state-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.state-list li {
  position: relative;
  max-width: none;
  padding: 0.7rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.state-list li:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.state-list a {
  display: block;
  font-weight: 650;
  text-decoration: none;
}

/* Cả ô bấm được, chữ vẫn nằm trong một liên kết. */
.state-list a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.state-list .muted {
  display: block;
  font-size: 0.8rem;
}

.result-list {
  margin: 1rem 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.result-list li {
  max-width: none;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid var(--line);
}

.result-list a {
  font-weight: 600;
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.6rem;
  border-top: 0;
}

.recent-list li {
  padding: 0.75rem 0.95rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.recent-list a {
  display: block;
}

.recent-list li:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.table-filter {
  margin: 0.75rem 0;
}

.table-filter label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.table-filter input {
  width: 100%;
  max-width: 26rem;
  padding: 0.6rem 0.8rem;
}

.table-filter p {
  margin: 0.3rem 0 0;
  min-height: 1.3em;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin: 1.25rem 0;
}

.pagination a {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}

.pagination a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.faq {
  border-top: 1px solid var(--line);
}

.faq:last-of-type {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.25rem;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1;
}

.faq[open] summary::after {
  content: "−";
}

.faq summary:hover h3 {
  color: var(--accent);
}

.faq h3 {
  margin: 0;
  font-size: 1rem;
}

.faq p {
  margin: 0 0 0.9rem;
  padding: 0 0.25rem;
  color: var(--muted);
}

/* Mục lục "On this page" của trang học khu */
.on-page {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 1rem 0 0.5rem;
  font-size: 0.875rem;
}

.on-page span {
  margin-right: 0.25rem;
  color: var(--muted);
  font-weight: 600;
}

.on-page a {
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-weight: 600;
  text-decoration: none;
}

.on-page a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Chỗ chừa cho quảng cáo (Công đoạn 8): kích thước cố định để bố cục không xô lệch. */
.ad-slot {
  min-height: 280px;
  margin: 1.5rem 0;
  background: var(--surface);
  border-radius: var(--radius);
}

@media (min-width: 48rem) {
  .ad-slot {
    min-height: 250px;
  }
}

/* Viền tiêu điểm đặt cuối tệp để không bị quy tắc nào phía dưới ghi đè. */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media print {
  .site-header,
  .site-footer,
  .ad-slot,
  .calc,
  .calc-result,
  .download {
    display: none;
  }

  .table-scroll,
  .table-scroll.tall {
    max-height: none;
    overflow: visible;
    box-shadow: none;
  }
}

/* Phân tích bảng lương trên trang học khu (analysis.ts). */
.growth-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.distance {
  font-size: 0.875em;
  white-space: nowrap;
}

/* Trang xếp hạng (views/rankings.ts). */
.rank-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rank-table td:first-child {
  width: 3.5em;
  font-variant-numeric: tabular-nums;
}
nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
nav.tabs a {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
}
nav.tabs a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
