/* Góc Tiện Ích - giao diện công khai. CSS thuần, font hệ thống, không phụ thuộc ngoài. */
:root {
  /* Màu */
  --c-text: #1b2733;
  --c-muted: #4f5d6b;
  --c-bg: #ffffff;
  --c-soft: #f3f6f9;
  --c-tint: #e8f3ef;
  --c-line: #d9e2ec;
  --c-brand: #0b6b57;
  --c-brand-dark: #08523f;
  --c-accent: #b45309;
  --c-up: #1a7f37;
  --c-down: #c92a2a;
  --c-warn-bg: #fff6e0;
  --c-warn-line: #b7791f;
  --c-focus: #1c7ed6;
  /* Khoảng cách, bo góc, bóng */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 40px;
  --r: 12px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 36, 52, .06), 0 2px 8px rgba(16, 36, 52, .06);
  --shadow-hover: 0 2px 4px rgba(16, 36, 52, .08), 0 8px 20px rgba(16, 36, 52, .1);
  /* Chữ */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.15rem; --fs-xl: 1.5rem; --fs-2xl: 2rem;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.65; color: var(--c-text); background: var(--c-bg); overflow-wrap: break-word; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-brand); text-underline-offset: 2px; }
a:hover { color: var(--c-brand-dark); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: 4px; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--s4); }
.skip-link { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--c-muted); font-size: var(--fs-sm); }
.icon { width: 24px; height: 24px; flex: none; }

/* Header + dải tra cứu nhanh */
.site-header { background: #fff; border-bottom: 1px solid var(--c-line); position: sticky; top: 0; z-index: 10; }
.ticker { display: none; background: var(--c-brand-dark); color: #fff; font-size: var(--fs-sm); }
.ticker-inner { display: flex; align-items: center; gap: var(--s4); min-height: 36px; }
.ticker-label { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; opacity: .9; }
.ticker-list { list-style: none; display: flex; gap: var(--s5); margin: 0; padding: 0; flex: 1; overflow: hidden; }
.ticker a { color: #fff; text-decoration: none; display: inline-block; padding: 6px 0; white-space: nowrap; }
.ticker a:hover { text-decoration: underline; }
.ticker .ticker-more { margin-left: auto; text-decoration: underline; }
.ticker .lookup-up { color: #8ce99a; }
.ticker .lookup-down { color: #ffa8a8; }
.ticker a:focus-visible { outline-color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s2); padding-top: var(--s2); padding-bottom: var(--s2); }
.logo { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 800; font-size: 1.2rem; color: var(--c-brand-dark); text-decoration: none; min-height: 40px; }
.menu-toggle { font: inherit; font-size: var(--fs-md); min-height: 44px; padding: 8px 16px; border: 1px solid var(--c-line); background: var(--c-soft); border-radius: var(--r-sm); cursor: pointer; color: var(--c-text); }
.main-nav { display: none; width: 100%; }
.main-nav.open { display: block; }
.main-nav ul { list-style: none; margin: 0; padding: 0; }
.main-nav a { display: block; padding: 12px 4px; text-decoration: none; color: var(--c-text); font-size: var(--fs-md); border-top: 1px solid var(--c-line); }
.main-nav a:hover { color: var(--c-brand); }
.main-nav .nav-lookup { font-weight: 700; color: var(--c-brand); }
.main-nav .nav-more { display: none; }
@media (min-width: 720px) {
  .main-nav .nav-extra { display: none; }
  .main-nav .nav-more { display: block; position: relative; }
  .nav-more summary { list-style: none; cursor: pointer; padding: 8px 10px; border-radius: 6px; font-size: .93rem; white-space: nowrap; }
  .nav-more summary::-webkit-details-marker { display: none; }
  .nav-more summary::after { content: " \25BE"; }
  .nav-more summary:hover, .nav-more details[open] summary { background: var(--c-soft); }
  .main-nav .nav-more ul { flex-direction: column; position: absolute; right: 0; top: 100%; min-width: 230px; background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-sm); box-shadow: var(--shadow-hover); padding: 6px; z-index: 20; display: block; }
  .nav-more ul a { padding: 10px 12px; white-space: nowrap; }
}

main { padding-top: var(--s4); padding-bottom: var(--s6); min-height: 60vh; }
h1 { font-size: 1.65rem; line-height: 1.3; margin: .4em 0; letter-spacing: -.01em; }
h2 { font-size: var(--fs-xl); line-height: 1.3; margin: 1.6em 0 .5em; }
h3 { font-size: var(--fs-lg); line-height: 1.4; margin: 1.2em 0 .4em; }
.sec-title { margin: var(--s6) 0 var(--s3); }
.lead { font-size: 1.08rem; color: var(--c-muted); margin: 0 0 var(--s4); }
.empty-state { background: var(--c-soft); border-radius: var(--r); padding: var(--s5) var(--s4); text-align: center; color: var(--c-muted); }
.panel { background: var(--c-soft); border: 1px solid var(--c-line); border-radius: var(--r); padding: var(--s4); }

.hero { background: linear-gradient(135deg, var(--c-tint), #f3f6f9); border: 1px solid var(--c-line); border-radius: var(--r); padding: var(--s5) var(--s4); margin-bottom: var(--s2); }
.hero h1 { margin: 0 0 var(--s2); color: var(--c-brand-dark); font-size: 1.9rem; }
.hero p { margin: 0; max-width: 62ch; color: var(--c-text); }

/* Breadcrumb */
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 var(--s2); padding: 0; font-size: var(--fs-sm); color: var(--c-muted); }
.breadcrumb li:not(:last-child)::after { content: "\203A"; margin-left: 4px; }
.breadcrumb a { color: var(--c-muted); }

/* Thẻ bài */
.grid { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
.card { border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; background: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: box-shadow .15s; }
.card:hover, .card:focus-within { box-shadow: var(--shadow-hover); }
.card-img { display: block; }
.card-img img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--c-soft); }
.card-ph { display: flex; align-items: center; justify-content: center; aspect-ratio: 1200 / 630; background: linear-gradient(135deg, var(--c-tint), var(--c-soft)); color: var(--c-brand); }
.icon-ph { width: 44px; height: 44px; opacity: .55; }
.card-body { padding: var(--s3) var(--s4) var(--s4); }
.card-body h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.card-body h3 a, .feature h3 a { color: var(--c-text); text-decoration: none; }
.card-body h3 a:hover, .feature h3 a:hover { text-decoration: underline; color: var(--c-brand-dark); }
.card-body p { margin: 0 0 6px; font-size: .94rem; line-height: 1.5; }
.card-cat { font-size: .78rem !important; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; margin: 0 0 4px; }
.card-cat a { text-decoration: none; }
.plain-list { padding-left: 20px; }
.article-list li { margin: 8px 0; }
.pagination { display: flex; gap: var(--s4); align-items: center; justify-content: center; margin: 28px 0; flex-wrap: wrap; }
.pagination a { display: inline-block; padding: 10px 16px; border: 1px solid var(--c-line); border-radius: var(--r-sm); text-decoration: none; }
.btn { display: inline-block; background: var(--c-brand); color: #fff; padding: 11px 20px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; min-height: 44px; }
.btn:hover { background: var(--c-brand-dark); color: #fff; }

/* Trang chủ: thẻ tra cứu nhanh */
.quick-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.quick-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.quick-link { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); color: var(--c-text); text-decoration: none; height: 100%; border-radius: var(--r); }
.quick-link:hover { background: var(--c-soft); color: var(--c-text); }
.quick-head { display: flex; align-items: center; gap: var(--s2); color: var(--c-brand); }
.quick-title { font-size: var(--fs-sm); font-weight: 700; color: var(--c-muted); line-height: 1.3; }
.quick-value { font-size: 1.3rem; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.quick-value small { font-size: .72rem; font-weight: 600; color: var(--c-muted); }
.quick-empty { font-size: 1rem; color: var(--c-muted); font-weight: 600; }
.quick-sub, .quick-time { font-size: .8rem; color: var(--c-muted); line-height: 1.4; }
.quick-note { margin: var(--s2) 0 0; }

/* Bài nổi bật */
.featured { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
.feature { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.feature .card-img img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--c-soft); }
.feature-body { padding: var(--s3) var(--s4) var(--s4); }
.feature h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.feature-lg h3 { font-size: 1.4rem; }
.feature-body p { margin: 0 0 6px; }
.feature-sm .feature-body p.muted { margin: 0; }

/* Khối chuyên mục */
.cat-block { margin-top: var(--s6); }
.cat-block-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.cat-block-title { flex: 1; min-width: 180px; }
.cat-block-title h2 { margin: 0; font-size: 1.3rem; }
.cat-block-title h2 a { color: var(--c-text); text-decoration: none; }
.cat-block-title h2 a:hover { color: var(--c-brand); text-decoration: underline; }
.cat-block-title p { margin: 0; line-height: 1.4; }
.cat-badge { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--c-tint); color: var(--c-brand); flex: none; }
.cat-badge-lg { width: 56px; height: 56px; border-radius: 14px; }
.cat-badge-lg .icon { width: 30px; height: 30px; }
.see-all { font-weight: 700; text-decoration: none; padding: 10px 4px; white-space: nowrap; min-height: 40px; }
.see-all:hover { text-decoration: underline; }
.page-head { display: flex; gap: var(--s4); align-items: center; margin: var(--s2) 0 var(--s4); }
.page-head h1 { margin: 0 0 4px; }
.page-head .lead { margin: 0; }

/* Lưới chuyên mục */
.cat-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.cat-tile { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: var(--s4); background: var(--c-soft); border: 1px solid var(--c-line); border-radius: var(--r); text-decoration: none; color: var(--c-text); }
.cat-tile .icon { color: var(--c-brand); width: 28px; height: 28px; }
.cat-tile:hover { background: var(--c-tint); border-color: var(--c-brand); }
.cat-tile-name { font-weight: 700; line-height: 1.3; }
.cat-tile .muted { line-height: 1.35; }

/* Vì sao tin chúng tôi */
.trust { margin-top: var(--s6); background: var(--c-brand-dark); color: #fff; border-radius: var(--r); padding: var(--s5) var(--s4); }
.trust h2 { margin: 0 0 var(--s3); color: #fff; }
.trust-list { margin: 0 0 var(--s4); padding: 0; list-style: none; display: grid; gap: var(--s3); }
.trust-list li { padding-left: var(--s4); border-left: 3px solid #7ad3b8; line-height: 1.5; font-size: .98rem; }
.trust .btn { background: #fff; color: var(--c-brand-dark); }
.trust .btn:hover { background: var(--c-tint); }
.trust a:focus-visible { outline-color: #fff; }

/* Bài viết */
.article { max-width: 70ch; margin: 0 auto; }
.article h1 { font-size: 1.85rem; }
.byline { color: var(--c-muted); font-size: .95rem; margin: 0 0 var(--s3); }
.cover { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: var(--r); background: var(--c-soft); margin: var(--s2) 0 var(--s4); }
.box { border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin: var(--s5) 0; border-left: 5px solid var(--c-brand); background: var(--c-tint); }
.box h2 { margin: 0 0 6px; font-size: var(--fs-lg); }
.box p { margin: 0; }
.box-note { border-left-color: #5b4fc4; background: #f2f0fd; }
.box-warn { border-left-color: var(--c-warn-line); background: var(--c-warn-bg); font-size: .95rem; }
.toc { border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: var(--s2) var(--s4); margin: var(--s5) 0; background: #fff; }
.toc summary { cursor: pointer; font-weight: 700; padding: 8px 0; min-height: 40px; }
.toc ol { margin: 4px 0 8px; padding-left: 20px; font-size: .95rem; line-height: 1.5; }
.toc li { margin: 3px 0; }
.toc .toc-l3 { margin-left: var(--s4); list-style: circle; }
.prose { overflow-wrap: anywhere; }
.prose img { max-width: 100%; width: auto; height: auto; margin: var(--s4) auto; border-radius: var(--r-sm); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--c-line); padding: 6px 10px; text-align: left; }
.prose th { background: var(--c-soft); }
.prose blockquote { margin: var(--s4) 0; padding: 4px var(--s4); border-left: 4px solid var(--c-line); color: var(--c-muted); }
.prose pre { overflow-x: auto; background: var(--c-soft); padding: var(--s3); border-radius: var(--r-sm); }
.prose h2, .prose h3 { scroll-margin-top: 90px; }
.page-article { max-width: 70ch; margin: 0 auto; }
.faq-item { border-top: 1px solid var(--c-line); }
.faq-item h3 { margin-top: var(--s3); }
.sources { background: var(--c-soft); border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: 0 var(--s4) var(--s2); margin-top: var(--s5); }
.sources ol { padding-left: 22px; font-size: .95rem; line-height: 1.55; }
.sources li { margin: 6px 0; }
.author-box { border-top: 1px solid var(--c-line); margin-top: 28px; }
.person, .author-profile { display: flex; gap: 14px; align-items: center; margin: 10px 0; }
.person p, .author-profile p { margin: 0 0 4px; }
.avatar { border-radius: 50%; flex: none; background: var(--c-soft); }
.tag { display: inline-block; background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 14px; padding: 0 10px; font-size: .85rem; margin: 2px 2px 2px 0; }

/* Lỗi */
.error-page { max-width: 70ch; margin: 0 auto; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--c-brand); margin: 0; line-height: 1; }

/* Footer */
.site-footer { background: #13262f; color: #cfdbe3; padding: var(--s6) 0 var(--s5); font-size: .95rem; }
.site-footer a { color: #e6f1f5; }
.site-footer a:hover { color: #fff; }
.site-footer a:focus-visible { outline-color: #fff; }
.site-footer .logo { color: #fff; }
.footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5) var(--s4); }
.footer-brand { grid-column: 1 / -1; }
.footer-brand p { margin: var(--s2) 0 0; max-width: 40ch; }
.site-footer h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #9fb4c0; margin: 0 0 var(--s2); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li a { display: inline-block; padding: 6px 0; text-decoration: none; }
.site-footer li a:hover { text-decoration: underline; }
.footer-ai { margin: var(--s5) 0 var(--s2); padding-top: var(--s4); border-top: 1px solid #2c4350; font-size: .9rem; }
.footer-copy { margin: 0; font-size: .85rem; color: #9fb4c0; }

@media (min-width: 720px) {
  body { font-size: 18px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .featured { grid-template-columns: 1.6fr 1fr; }
  .feature-lg { grid-row: 1 / span 3; }
  .feature-lg .card-img { flex: 1; min-height: 220px; position: relative; }
  .feature-lg .card-img img { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; }
  .feature-lg .card-ph { aspect-ratio: auto; }
  .feature-lg .icon-ph { width: 72px; height: 72px; }
  .feature-sm .card-ph { aspect-ratio: auto; }
  .grid.grid-n1 { grid-template-columns: 1fr; }
  .grid-n1 .card { flex-direction: row; }
  .grid-n1 .card-img { width: 40%; flex: none; }
  .grid-n1 .card-img img { height: 100%; aspect-ratio: auto; }
  .grid-n1 .card-ph { aspect-ratio: auto; min-height: 150px; }
  .grid-n1 .card-body { padding: var(--s4) var(--s5); align-self: center; }
  .grid.grid-n2 { grid-template-columns: repeat(2, 1fr); }
  .feature-sm { flex-direction: row; }
  .feature-sm .card-img { width: 38%; flex: none; }
  .feature-sm .card-img img { height: 100%; aspect-ratio: auto; }
  .cat-tiles { grid-template-columns: repeat(3, 1fr); }
  .trust-list { grid-template-columns: 1fr 1fr; }
  .ticker { display: block; }
  .menu-toggle { display: none; }
  .main-nav { display: block; width: auto; }
  .main-nav ul { display: flex; flex-wrap: wrap; gap: 2px 6px; }
  .main-nav a { border-top: 0; padding: 8px 8px; font-size: .93rem; border-radius: 6px; }
  .main-nav a:hover { background: var(--c-soft); }
  h1 { font-size: 2.1rem; }
  .hero { padding: var(--s6) var(--s5); }
  .hero h1 { font-size: 2.4rem; }
  .article h1 { font-size: 2.2rem; }
  .footer-cols { grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; }
  .footer-brand { grid-column: auto; }
}
@media (min-width: 980px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.grid-n3 { grid-template-columns: repeat(3, 1fr); }
  .cat-tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid.grid-n1 { grid-template-columns: 1fr; }
  .grid.grid-n2 { grid-template-columns: repeat(2, 1fr); }
  .grid.grid-n3 { grid-template-columns: repeat(3, 1fr); }
  .article { max-width: 1000px; display: grid; grid-template-columns: minmax(0, 70ch) 260px; column-gap: 40px; align-items: start; }
  .article > * { grid-column: 1; min-width: 0; }
  .article > .toc { grid-column: 2; grid-row: 1 / span 40; position: sticky; top: 120px; margin-top: 0; max-height: calc(100vh - 140px); overflow-y: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* Xem trước trong quản trị */
.preview-banner { background: #fff3bf; border: 1px solid #f08c00; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; font-size: .95rem; }
mark.verify { background: #ffe066; color: #1f2933; padding: 0 3px; border-radius: 3px; outline: 1px solid #f08c00; }

/* Tra cứu */
.lookup-table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--c-line); border-radius: var(--r-sm); }
.lookup-table { width: 100%; border-collapse: collapse; font-size: 1rem; background: #fff; }
.lookup-table th, .lookup-table td { border-bottom: 1px solid var(--c-line); padding: 10px 12px; text-align: left; }
.lookup-table tbody tr:last-child > * { border-bottom: 0; }
.lookup-table thead th { background: var(--c-soft); font-size: .88rem; }
.lookup-table tbody th { font-weight: 600; }
.lookup-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lookup-table-mini { font-size: .92rem; }
.lookup-table-mini th, .lookup-table-mini td { padding: 8px 6px; }
.lookup-summary .card-body { overflow-x: auto; }
.lookup-change { font-size: .8rem; white-space: nowrap; font-weight: 600; }
.lookup-up { color: var(--c-up); }
.lookup-down { color: var(--c-down); }
.lookup-empty { color: var(--c-muted); }
.lookup-updated { margin: var(--s2) 0; }
.lookup-group h2 { font-size: 1.15rem; margin: var(--s5) 0 var(--s2); }
.lookup-chart { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-sm); }
.chart-y, .chart-x { font-size: 10px; fill: #4f5d6b; }
@media (max-width: 719px) { .chart-y, .chart-x { font-size: 16px; } }
@media (max-width: 479px) { .chart-y, .chart-x { font-size: 22px; } }

/* Bảng tra cứu dạng thẻ xếp dọc dưới 480px: không bị cắt cột */
@media (max-width: 479px) {
  .lookup-table-wrap { border: 0; }
  .lookup-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lookup-table, .lookup-table tbody, .lookup-table tr, .lookup-table th, .lookup-table td { display: block; width: 100%; }
  .lookup-table tr { border: 1px solid var(--c-line); border-radius: var(--r-sm); margin: 0 0 var(--s2); padding: var(--s2) var(--s3); background: #fff; }
  .lookup-table tbody th, .lookup-table th, .lookup-table td { border: 0; padding: 4px 0; }
  .lookup-table tbody th { font-size: 1rem; padding-bottom: 6px; }
  .lookup-table td.num { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); text-align: right; }
  .lookup-table td.num::before { content: attr(data-label); color: var(--c-muted); font-size: var(--fs-sm); font-weight: 400; text-align: left; }
  .lookup-table-mini tr { padding: 6px 10px; }
}
.lookup-index .lookup-summary h2 { font-size: 1.15rem; margin: 0 0 6px; }
.lookup-h { display: flex; align-items: center; gap: var(--s2); }
.lookup-h a { color: var(--c-text); text-decoration: none; }
.lookup-h a:hover { text-decoration: underline; }
.lookup-tabs { display: flex; gap: var(--s2); flex-wrap: wrap; margin: 0 0 var(--s4); }
.lookup-tabs a { padding: 8px 14px; border: 1px solid var(--c-line); border-radius: 999px; text-decoration: none; color: var(--c-text); min-height: 40px; background: #fff; }
.lookup-tabs a:hover { border-color: var(--c-brand); }
.lookup-tabs a[aria-current="page"] { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }

/* Phản hồi người đọc (GĐ4) */
.feedback { border-left-color: var(--c-brand); }
.feedback h2 { margin-top: 0; }
.fb-helpful[hidden] { display: none; }
.fb-vote { margin: var(--s2) 0; }
.btn-fb { font: inherit; font-weight: 600; min-height: 44px; padding: 8px 18px; border: 1px solid var(--c-brand); background: #fff; color: var(--c-brand-dark); border-radius: var(--r-sm); cursor: pointer; }
.btn-fb:hover { background: var(--c-tint); }
.btn-fb:disabled { opacity: .6; cursor: default; }
.fb-form { display: grid; gap: var(--s2); margin-top: var(--s2); max-width: 100%; }
.fb-form[hidden], .fb-msg[hidden] { display: none; }
.fb-form label { display: grid; gap: 4px; font-size: var(--fs-sm); }
.fb-form textarea, .fb-form input[type=email], .fb-form select { font: inherit; width: 100%; max-width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--c-line); border-radius: var(--r-sm); }
.fb-form .fb-check { display: flex; gap: var(--s2); align-items: flex-start; width: 100%; }
.fb-form .fb-check input[type=checkbox] { flex: none; width: 20px; height: 20px; margin: 2px 0 0; }
.fb-form .fb-check span { flex: 1 1 auto; min-width: 0; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-more { margin-top: var(--s2); }
.fb-more summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.fb-msg { margin: var(--s2) 0; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; }
.fb-ok { background: #e6f4ea; color: #14532d; }
.fb-err { background: #fdecec; color: #8a1c1c; }

/* Công cụ tính toán */
.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--s3); }
.tool-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.tool-card a { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); text-decoration: none; color: var(--c-text); height: 100%; border-radius: var(--r); }
.tool-card a:hover { background: var(--c-soft); }
.tool-card .icon { flex: none; color: var(--c-brand); margin-top: 2px; }
.tool-card strong { display: block; line-height: 1.35; }
.tool-card span.tool-sub { display: block; font-size: var(--fs-sm); color: var(--c-muted); line-height: 1.45; }
.tool-group h2 { margin-top: var(--s5); }
.tool-form { background: var(--c-soft); border: 1px solid var(--c-line); border-radius: var(--r); padding: var(--s4); display: grid; gap: var(--s3); grid-template-columns: 1fr; }
.tool-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-field label { font-weight: 600; font-size: .95rem; }
.tool-field input[type="text"], .tool-field select { font: inherit; min-height: 44px; padding: 8px 12px; border: 1px solid #9fb0c0; border-radius: var(--r-sm); background: #fff; color: var(--c-text); width: 100%; max-width: 100%; }
.tool-field input:focus-visible, .tool-field select:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 1px; }
.tool-field .tool-unit { font-weight: 400; color: var(--c-muted); font-size: var(--fs-sm); }
.tool-check { flex-direction: row; align-items: center; gap: var(--s2); }
.tool-check input { width: 22px; height: 22px; }
.field-err { color: var(--c-down); font-size: var(--fs-sm); margin: 0; font-weight: 600; }
.tool-actions { grid-column: 1 / -1; display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.tool-actions button { font: inherit; border: 0; cursor: pointer; }
.tool-result { margin-top: var(--s4); }
.tool-result:empty { display: none; }
.tool-summary { margin: 0 0 var(--s3); display: grid; gap: 0; border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; background: #fff; }
.tool-summary > div { display: flex; justify-content: space-between; gap: var(--s3); padding: 10px var(--s4); border-bottom: 1px solid var(--c-line); align-items: baseline; }
.tool-summary > div:last-child { border-bottom: 0; }
.tool-summary dt { color: var(--c-muted); min-width: 0; }
.tool-summary dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.tool-summary .is-main { background: var(--c-tint); }
.tool-summary .is-main dd { font-size: 1.2rem; font-weight: 800; color: var(--c-brand-dark); }
.tool-table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: #fff; }
.tool-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tool-table th, .tool-table td { padding: 8px 12px; border-bottom: 1px solid var(--c-line); text-align: left; white-space: nowrap; }
.tool-table thead th { background: var(--c-soft); font-size: .85rem; position: sticky; top: 0; }
.tool-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tool-table tbody tr:last-child td { border-bottom: 0; }
.tool-table-box { margin: var(--s4) 0; }
.tool-table-box h3 { margin: 0 0 var(--s2); }
.tool-table-box.is-long .tool-table-wrap { max-height: 480px; overflow-y: auto; }
.scroll-hint { display: block; margin: 4px 0 0; }
.tool-chart { margin: var(--s4) 0; }
.tool-notes { margin: var(--s3) 0; padding-left: 1.2em; color: var(--c-muted); font-size: var(--fs-sm); }
.tool-error { background: #fdecec; border: 1px solid #e6a5a5; border-radius: var(--r-sm); padding: var(--s3) var(--s4); color: #7a1f1f; font-weight: 600; }
.tool-law { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: var(--s3) var(--s4); font-size: var(--fs-sm); }
.tool-law ul { margin: 4px 0 0; padding-left: 1.2em; }
.tool-sugg { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0 0; padding: 0; list-style: none; }
.tool-sugg a { display: inline-block; padding: 6px 12px; border: 1px solid var(--c-line); border-radius: 999px; background: #fff; text-decoration: none; font-size: var(--fs-sm); color: var(--c-text); }
.tool-sugg a:hover { border-color: var(--c-brand); }
.tool-section h2 { margin-top: var(--s5); }
.tool-example { background: var(--c-tint); border-radius: var(--r-sm); padding: var(--s3) var(--s4); }
.home-tools .tool-grid { grid-template-columns: 1fr 1fr; }
@media (min-width: 720px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-form { grid-template-columns: repeat(2, 1fr); padding: var(--s5); }
  .scroll-hint { display: none; }
  .home-tools .tool-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .home-tools .tool-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 500px) {
  .home-tools .tool-grid { grid-template-columns: 1fr 1fr; gap: var(--s2); }
  .home-tools .tool-card .icon { display: none; }
  .home-tools .tool-card a { padding: var(--s3); }
  .tool-summary > div { flex-direction: column; gap: 2px; }
  .tool-summary dd { text-align: left; }
}

.tool-grid { margin-bottom: var(--s5); }
.tool-soon { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--c-warn-bg); border: 1px solid var(--c-warn-line); color: #7a4a05; vertical-align: middle; }
.tool-error-list { margin: var(--s2) 0 0; padding-left: 1.2em; font-weight: 600; }
.tool-error a { color: inherit; }
.tool-hint { color: var(--c-muted); font-size: .8rem; }
.money-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 2px 0; }
.money-sugg[hidden] { display: none; }
.money-sugg-lead { font-size: var(--fs-sm); color: var(--c-muted); }
.money-sugg-btn { font: inherit; font-size: var(--fs-sm); min-height: 40px; min-width: 40px; padding: 6px 12px; border: 1px solid var(--c-line); border-radius: 999px; background: #fff; color: var(--c-text); cursor: pointer; }
.money-sugg-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tool-stale { margin: 0 0 var(--s2); padding: 4px 10px; border-left: 3px solid var(--c-brand); background: #f3f6f9; font-size: var(--fs-sm); color: var(--c-muted); }
.money-sugg-btn:hover { border-color: var(--c-brand); }
.money-sugg-btn:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 1px; }
.tool-law-title { margin-top: 0; }
@media (max-width: 500px) {
  .tool-head .cat-badge-lg { display: none; }
}

/* Công cụ đợt 2: ô nhiều dòng, mẫu điền nhanh, khung số liệu tham khảo */
.tool-field textarea { font: inherit; min-height: 96px; padding: 8px 12px; border: 1px solid #9fb0c0; border-radius: var(--r-sm); background: #fff; color: var(--c-text); width: 100%; max-width: 100%; resize: vertical; box-sizing: border-box; }
.tool-field textarea:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 1px; }
.tool-presets { margin-top: var(--s4); }
.tool-presets h2 { margin-top: 0; font-size: 1.1rem; }
.box-info { background: var(--c-tint); border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: var(--s3) var(--s4); }
.tool-form .tool-field:has(textarea) { grid-column: 1 / -1; }
.home-tools .tool-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* scroll hint: always visible on narrow screens; on wider ones only when JS finds the table overflows its box */
.tool-table-box.is-overflow .scroll-hint { display: block; }
.tool-table-box.is-fit .scroll-hint { display: none; }
/* advanced options block inside tool forms */
.tool-advanced { grid-column: 1 / -1; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: #fff; padding: 0 var(--s3); }
.tool-advanced > summary { cursor: pointer; font-weight: 600; padding: var(--s3) 0; min-height: 44px; box-sizing: border-box; }
.tool-advanced-body { display: grid; gap: var(--s3); grid-template-columns: 1fr; padding-bottom: var(--s3); }
@media (min-width: 720px) { .tool-advanced-body { grid-template-columns: repeat(2, 1fr); } }

/* ===== Đợt tinh chỉnh giao diện (T20261016-ui-polish) ===== */
:root { --fs-xs: .8rem; --c-focus-ring: 0 0 0 3px rgba(28, 126, 214, .35); }
html { scroll-padding-top: 80px; }
body { font-kerning: normal; text-rendering: optimizeLegibility; }
h1, h2, h3 { text-wrap: balance; }
.prose p, .prose li { line-height: 1.7; }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--s4); }
.prose li { margin: 4px 0; }
.prose h2 { margin-top: var(--s6); padding-top: var(--s2); }
.prose th, .prose td { vertical-align: top; }
.prose table { font-size: .95rem; }
.prose a { overflow-wrap: anywhere; }
.muted, .quick-sub, .quick-time, .tool-hint { color: #4a5866; }

/* Header/menu mobile: không tràn viewport, vùng chạm >= 44px */
.main-nav a { min-height: 44px; display: flex; align-items: center; }
@media (max-width: 719px) {
  .main-nav.open { max-height: calc(100vh - 70px); max-height: calc(100dvh - 70px); overflow-y: auto; overscroll-behavior: contain; padding-bottom: var(--s2); }
  .main-nav .nav-extra a { padding-left: var(--s4); }
  .site-header { box-shadow: 0 1px 6px rgba(16, 36, 52, .06); }
}
.menu-toggle:hover { background: var(--c-tint); }
.menu-toggle[aria-expanded="true"] { background: var(--c-tint); border-color: var(--c-brand); }
@media (min-width: 720px) { .main-nav a { min-height: 40px; } }

/* Thẻ: bo góc/bóng thống nhất, hover + focus rõ */
.card, .quick-card, .feature, .tool-card { transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease; }
.quick-card:hover, .quick-card:focus-within, .tool-card:hover, .tool-card:focus-within, .feature:hover, .feature:focus-within { box-shadow: var(--shadow-hover); border-color: #b8c7d6; }
.card:hover, .card:focus-within { border-color: #b8c7d6; }
.quick-link:focus-visible, .tool-card a:focus-visible, .cat-tile:focus-visible { outline: 3px solid var(--c-focus); outline-offset: -3px; }
.cat-tile { box-shadow: var(--shadow); transition: background .15s, border-color .15s, box-shadow .15s; }
.cat-tile:hover { box-shadow: var(--shadow-hover); }
.card-body h3 a:focus-visible, .feature h3 a:focus-visible { outline-offset: 3px; }
.quick-value { letter-spacing: -.01em; }
.quick-value small { font-size: .75rem; }
.lookup-summary .card-body { padding: var(--s4); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card:hover, .feature:hover, .quick-card:hover, .tool-card:hover { transform: translateY(-2px); }
}
@media (max-width: 359px) { .quick-grid, .cat-tiles { grid-template-columns: 1fr; } }

/* Bảng tra cứu: tiêu đề nhóm rõ, số căn phải, cuộn ngang trong khung */
.lookup-table-wrap { -webkit-overflow-scrolling: touch; background: #fff; }
.lookup-table thead th { color: var(--c-text); font-weight: 700; border-bottom: 2px solid var(--c-line); }
.lookup-table thead th.num { text-align: right; }
.lookup-table tbody tr:hover > * { background: #f8fafc; }
.lookup-group h2 { font-size: 1.15rem; margin: var(--s5) 0 var(--s2); padding-left: var(--s3); border-left: 4px solid var(--c-brand); line-height: 1.3; }
.lookup-index .lookup-summary h2 { padding-left: 0; border: 0; }
.lookup-tabs a { display: inline-flex; align-items: center; min-height: 44px; }
.lookup-tabs a:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }

/* Form/công cụ: ô nhập >= 44px, chữ >= 16px, nhãn rõ */
.tool-field label, .fb-form label { font-weight: 600; color: var(--c-text); }
.tool-field input[type="text"], .tool-field input[type="number"], .tool-field input[type="date"], .tool-field input[type="email"], .tool-field select { font-size: max(16px, 1rem); }
.tool-field textarea, .fb-form textarea, .fb-form input[type=email], .fb-form select { font-size: max(16px, 1rem); }
.fb-form input[type=email], .fb-form select { min-height: 44px; }
.fb-form textarea { min-height: 96px; }
.tool-field input:focus-visible, .tool-field select:focus-visible, .tool-field textarea:focus-visible, .fb-form textarea:focus-visible, .fb-form input:focus-visible, .fb-form select:focus-visible { border-color: var(--c-focus); box-shadow: var(--c-focus-ring); }
.tool-actions .btn, .tool-actions button { min-height: 48px; padding: 12px 24px; font-size: 1.05rem; border-radius: var(--r-sm); }
.btn { display: inline-flex; align-items: center; justify-content: center; }
.btn:focus-visible, .btn-fb:focus-visible, .pagination a:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.pagination a { min-height: 44px; display: inline-flex; align-items: center; }
.pagination a:hover { border-color: var(--c-brand); background: var(--c-soft); }
.money-sugg-btn { min-height: 44px; }
.tool-sugg a { min-height: 40px; display: inline-flex; align-items: center; }
.tool-summary > div { padding: 12px var(--s4); }
@media (max-width: 719px) { .tool-actions .btn, .tool-actions button { flex: 1 1 100%; } }

/* Bài viết: gọn mục lục, nguồn, ảnh/bảng không tràn */
.article h1 { line-height: 1.25; }
.toc { box-shadow: var(--shadow); }
.toc a { display: inline; padding: 3px 0; }
.toc li { min-height: 28px; }
.sources { font-size: .95rem; }
.sources h2 { font-size: var(--fs-lg); margin-top: var(--s4); }
.article img, .page-article img { max-width: 100%; height: auto; }
.article table, .page-article table { max-width: 100%; }
.box, .sources, .toc { overflow-wrap: anywhere; }

/* Hiệu năng/trợ năng */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover, .feature:hover, .quick-card:hover, .tool-card:hover { transform: none; }
}

/* Stock photo credits and generated visuals */
.cover-fig { margin: 0; }
.cover-fig .cover { margin-bottom: var(--s1); }
.img-credit, .stock-photo figcaption { font-size: var(--fs-sm); color: var(--c-muted); line-height: 1.4; }
.img-credit a, .stock-photo figcaption a { color: var(--c-muted); }
.stock-photo { margin: var(--s4) 0; }
.stock-photo img { display: block; margin-bottom: var(--s1); }
.prose .stock-photo img { margin: 0 auto var(--s1); }
.stock-photo figcaption { text-align: center; }
.visual { margin: var(--s4) 0; max-width: 100%; }
.visual-svg { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; font-family: var(--font); }
.visual-svg text { fill: var(--c-text); font-family: inherit; }
.visual-svg .vz-detail { fill: var(--c-muted); }
.visual-svg .vz-num { fill: #fff; }
.visual-svg .vz-title { fill: var(--c-brand-dark); }
.visual-svg .vz-bg { fill: var(--c-bg); stroke: var(--c-line); }
.visual-svg .vz-dot, .visual-svg .vz-bar { fill: var(--c-brand); }
.visual-svg .vz-colhead { fill: var(--c-tint); stroke: var(--c-brand); }
