/* AI WIKI TOTAL — TOTAL ATLAS v3 · EDITORIAL MAGAZINE
   Tạp chí kiến thức xe: nền trắng ngà, chữ xanh đen, nhấn cobalt.
   Serif cho tiêu đề lớn (Georgia/Noto Serif hỗ trợ tiếng Việt), sans cho thân bài.
   Đường viền nhẹ thay bóng đổ; bán kính tiết chế; không hộp tròn lặp đi lặp lại.
   —————
   Quy ước giữ từ v2:
   • Một overlay tương tác mở tại một thời điểm (xem assets/js/overlay.js).
   • Kích thước màn hình dùng dvh (fallback vh) + env(safe-area-inset-*) cho iPhone.
   • Mọi token dùng chung đặt ở :root — component không tự chế giá trị ngẫu nhiên. */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Màu nền tảng — trắng ngà + mực xanh đen + cobalt */
  --bg: #FBFAF6;
  --bg-soft: #F1EEE4;
  --ink: #16243D;
  --ink-soft: #3A4A66;
  --muted: #626D80; /* ≥4.5:1 trên nền trắng ngà lẫn trắng card (WCAG AA chữ nhỏ) */
  --cobalt: #3157D5;
  --cobalt-deep: #26449F;
  --amber: #B45309;
  --navy: #101B31;
  --card: #FFFFFF;
  --line: #E8E5DB;
  --line-strong: #D3CDBC;

  /* Bán kính tiết chế */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;

  /* Bóng đổ: chỉ dùng cho overlay nổi; card dùng viền */
  --shadow-sm: 0 1px 2px rgba(22, 36, 61, 0.05);
  --shadow: 0 1px 3px rgba(22, 36, 61, 0.06);
  --shadow-lg: 0 18px 48px rgba(16, 27, 49, 0.22);

  /* Thang khoảng cách */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* Bố cục */
  --content-max: 1280px;
  --header-h: 60px;
  --read-w: 780px;          /* cột tiêu đề bài viết; thân bài khoá theo ký tự/dòng */

  /* Safe area iPhone */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-head: Georgia, "Times New Roman", "Noto Serif", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Nhấn theo danh mục (data-acc) — mọi token dùng làm CHỖ phải đạt ≥4.5:1 trên trắng */
[data-acc="emerald"] { --acc: #0B7A55; }
[data-acc="cobalt"], .acc-cobalt { --acc: #3157D5; }
[data-acc="navy"] { --acc: #22406F; }
[data-acc="violet"] { --acc: #7C5CD9; }
[data-acc="cyan"] { --acc: #036A82; }
[data-acc="blue"], .acc-blue { --acc: #2563EB; }
[data-acc="teal"] { --acc: #0A6E63; }
[data-acc="amber"] { --acc: #B45309; }
[data-acc="slate"] { --acc: #64748B; }
[data-acc="red"] { --acc: #C2410C; }
[data-acc="orange"] { --acc: #B44E0A; }
[data-acc="gold"] { --acc: #8A6D1C; }
[data-acc="purple"] { --acc: #7C4DBE; }

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }
/* KHOÁ CUỘN khi overlay mở — html.awt-lock do overlay.js thêm */
html.awt-lock, html.awt-lock body { overflow: hidden; }
/* QUAN TRỌNG: [hidden] luôn thắng mọi display của author —
   trước đây .search-modal/.chatbot-panel display:flex đè [hidden]
   khiến hai overlay luôn hiển thị và chồng lên nhau trên mobile. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--cobalt); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: break-word; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 300;
  background: var(--cobalt); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

/* Neo cuộn: anchor không bị header sticky che */
[id] { scroll-margin-top: calc(var(--header-h) + var(--sat) + 16px); }

/* ---------- 3. Header + điều hướng ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251, 250, 246, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  padding-top: var(--sat);
}
.header-inner {
  max-width: var(--content-max); margin: 0 auto; padding: 8px 20px;
  display: flex; align-items: center; gap: 14px; min-height: var(--header-h);
}
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-mark { display: inline-flex; }
.logo-text { font-size: 17px; letter-spacing: 0.2px; white-space: nowrap; font-family: var(--font-head); }
.logo-text strong { color: var(--cobalt); }
.main-nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav-link {
  color: var(--ink); padding: 8px 11px; border-radius: var(--radius-sm); font-size: 14.5px;
  min-height: 44px; display: inline-flex; align-items: center; background: none; border: 0;
  font-family: inherit; cursor: pointer; position: relative; white-space: nowrap;
}
.nav-link:hover { background: var(--bg-soft); text-decoration: none; }
.nav-link.active { color: var(--acc, var(--cobalt)); font-weight: 600; }
.nav-link.active::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 4px;
  height: 2px; background: var(--acc, var(--cobalt));
}
.caret { font-size: 11px; opacity: 0.7; margin-left: 3px; }

.search-open {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 9px 16px; min-height: 44px; cursor: pointer; font-family: inherit; font-size: 14px;
  color: var(--muted); flex-shrink: 0; transition: border-color 0.15s;
}
.search-open:hover { border-color: var(--cobalt); color: var(--cobalt); text-decoration: none; }
.nav-toggle {
  display: none; background: none; border: 0; padding: 10px; cursor: pointer;
  min-width: 44px; min-height: 44px; border-radius: var(--radius-sm);
}
.nav-toggle:hover { background: var(--bg-soft); }
.nav-toggle .bar { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px auto; }

/* Drawer mobile */
.mobile-nav {
  display: none; padding: 8px 20px calc(20px + var(--sab));
  max-height: calc(100dvh - var(--header-h) - var(--sat));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--line); background: var(--bg);
}
.mobile-nav.open { display: block; }
.mnav-list { display: block; }
.mnav-cap {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); margin: 16px 0 4px;
}
.mnav-link {
  display: flex; align-items: center; min-height: 46px; padding: 11px 8px;
  color: var(--ink); border-bottom: 1px solid var(--line); font-size: 15px;
  border-radius: var(--radius-sm);
}
.mnav-link:hover { background: var(--bg-soft); text-decoration: none; }
.mnav-group { border-bottom: 1px solid var(--line); }
.mnav-parent {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 46px; padding: 11px 8px; font-size: 15px; font-weight: 600;
  color: var(--ink); border-radius: var(--radius-sm); cursor: pointer; list-style: none;
}
.mnav-parent::-webkit-details-marker { display: none; }
.mnav-parent:hover { background: var(--bg-soft); }
.mnav-chev { flex: none; color: var(--muted); transition: transform 0.15s ease; }
.mnav-group[open] .mnav-chev { transform: rotate(180deg); }
.mnav-children { display: flex; flex-direction: column; padding: 2px 0 6px; }
.mnav-cat, .mnav-child {
  display: flex; align-items: center; min-height: 44px; padding: 10px 8px 10px 20px;
  font-size: 14px; color: var(--ink-soft); border-radius: var(--radius-sm);
}
.mnav-child { padding-left: 30px; }
.mnav-cat { font-weight: 600; color: var(--ink); }
.mnav-cat:hover, .mnav-child:hover { background: var(--bg-soft); text-decoration: none; color: var(--ink); }

/* Dropdown "Thuê xe" */
.dropdown { position: relative; }
.nav-dd-trigger { white-space: nowrap; }
.dd-panel {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: min(340px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; z-index: 120;
}
.dropdown.open .dd-panel { display: block; }
.dd-item { display: block; padding: 10px 12px; border-radius: var(--radius-sm); min-height: 44px; }
.dd-item:hover { background: var(--bg-soft); text-decoration: none; }
.dd-name { display: block; font-weight: 600; color: var(--ink); }
.dd-desc { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.dd-all { display: block; padding: 12px; border-top: 1px solid var(--line); margin-top: 6px; font-weight: 600; }

/* Mega menu — neo vào header sticky */
.mega {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.mega-grid {
  max-width: var(--content-max); margin: 0 auto; padding: 22px 20px 26px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px;
  max-height: calc(100dvh - var(--header-h)); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.mega-cell { display: flex; flex-direction: column; gap: 4px; }
.mega-cat {
  font-weight: 700; color: var(--acc, var(--cobalt));
  border-bottom: 2px solid var(--line-strong); padding-bottom: 6px; margin-bottom: 4px;
}
.mega-cat:hover { text-decoration: none; color: var(--cobalt-deep); }
.mega-sub { font-size: 13px; color: var(--ink); padding: 4px 0; }
.mega-count { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 4. Bố cục chung ---------- */
.site-main {
  max-width: var(--content-max); margin: 0 auto;
  padding: 24px 20px calc(64px + var(--sab));
  padding-left: max(20px, var(--sal));
  padding-right: max(20px, var(--sar));
}
.breadcrumb {
  font-size: 13px; color: var(--muted); padding: 6px 0 16px;
  display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px;
}
.breadcrumb .crumb-sep { margin: 0 6px; }
.breadcrumb .crumb[aria-current] { color: var(--ink); font-weight: 600; }
.page-head { margin: 10px 0 28px; max-width: 840px; }
.eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--cobalt); margin: 0 0 10px;
}
h1 { font-family: var(--font-head); font-size: clamp(30px, 4.6vw, 42px); line-height: 1.18; margin: 0 0 12px; }
.page-lead { font-size: 17px; color: var(--ink-soft); max-width: 70ch; margin: 0; }
.h-small { font-size: 16px; margin: 0 0 10px; }
.read-more { font-weight: 600; }

/* Tiêu đề khối nội dung: chữ hoa nhỏ + hairline kéo dài */
.section-h {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink); margin: 0 0 16px;
}
.section-h::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

/* ---------- 5. Hero (trang chủ) ---------- */
.hero { text-align: center; padding: 46px 0 36px; border-bottom: 1px solid var(--line); }
.hero-kicker {
  color: var(--cobalt); font-weight: 700; letter-spacing: 1.6px;
  text-transform: uppercase; font-size: 12.5px; margin: 0 0 12px;
}
.hero-title { font-family: var(--font-head); font-size: clamp(33px, 5.6vw, 54px); margin: 0 0 12px; letter-spacing: -0.01em; }
.hero-sub { font-size: 17.5px; color: var(--ink-soft); max-width: 640px; margin: 0 auto 26px; }
.hero-search {
  display: flex; max-width: 620px; margin: 0 auto 16px; border-radius: 999px;
  overflow: hidden; border: 1px solid var(--line-strong); background: #fff;
}
.hero-search input { flex: 1; border: 0; padding: 15px 20px; font-size: 16px; font-family: inherit; min-width: 0; min-height: 50px; background: none; }
.hero-search input:focus { outline: none; }
.hero-search button {
  border: 0; background: var(--cobalt); color: #fff; padding: 15px 26px;
  font-size: 15.5px; font-weight: 600; cursor: pointer; min-height: 50px; font-family: inherit;
}
.hero-search button:hover { background: var(--cobalt-deep); }
.hero-search:focus-within { border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.14); }
.hero-hint { color: var(--muted); font-size: 12.5px; margin: 2px 0 14px; }
.hero-hint kbd {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: var(--radius-sm); padding: 1px 6px;
}
.hero-tag { color: var(--muted); font-size: 14.5px; margin: 0; }

/* ---------- 6. Bài nổi bật (featured) — TEXT-ONLY editorial ----------
   Card lớn không ảnh: accent viền trái cobalt + typography lớn.
   Desktop chia 2 vùng CHỮ: trái = nhãn/chuyên mục, phải = tiêu đề/tóm tắt/meta/CTA. */
.featured { padding: 34px 0; border-bottom: 1px solid var(--line); }
.feat-card {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); background: var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--cobalt);
  border-radius: var(--radius);
  color: inherit; text-decoration: none;
}
.feat-card:hover { text-decoration: none; border-color: var(--cobalt); box-shadow: var(--shadow-sm); }
.feat-side {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 22px 20px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(49, 87, 213, 0.045), rgba(49, 87, 213, 0));
}
.feat-label {
  display: inline-block; color: #fff; background: var(--cobalt);
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
}
.feat-cat { font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); }
.feat-body { padding: 22px 26px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.feat-title { font-family: var(--font-head); font-size: clamp(22px, 2.6vw, 30px); line-height: 1.25; margin: 0; color: var(--ink); }
.feat-card:hover .feat-title { text-decoration: underline; text-decoration-color: var(--cobalt); text-underline-offset: 4px; }
.feat-dek { font-size: 15.5px; color: var(--ink-soft); margin: 0; }
.feat-meta { font-size: 13px; color: var(--muted); margin: 0; }
.feat-cta { font-weight: 700; color: var(--cobalt); font-size: 15px; }

/* ---------- 7. Cụm thuê xe ---------- */
.rental-cluster, .cats, .latest { padding: 34px 0; border-bottom: 1px solid var(--line); }
.rental-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rental-cell {
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid #0E9F6E;
  border-radius: var(--radius); padding: 18px;
}
.rental-cell:hover { text-decoration: none; border-color: #0E9F6E; }
.rental-cell:hover .rental-name { text-decoration: underline; text-underline-offset: 3px; }
.rental-name { display: block; font-weight: 700; font-size: 17px; color: var(--ink); }
.rental-desc { display: block; font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.rental-cluster .read-more { display: inline-block; margin-top: 18px; }

/* ---------- 8. Bài mới nhất (featured + lưới gộp MỘT khối duy nhất) ---------- */
.latest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
/* Featured nằm TRONG khối latest — không còn padding/viền đôi của section cũ */
.latest .featured { padding: 0; border-bottom: 1px solid var(--line); margin: 0 0 28px; }
.latest .featured + .latest-grid { margin-top: 0; }
/* Thẻ bài TEXT-ONLY: chuyên mục → tiêu đề → mô tả → meta → CTA.
   Card tự co theo nội dung — không fixed/min-height, không ảnh. */
.post-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px;
  color: inherit; text-decoration: none;
}
.post-card:hover { text-decoration: none; border-color: var(--cobalt); box-shadow: var(--shadow-sm); }
.post-card:hover .post-title { text-decoration: underline; text-decoration-color: var(--cobalt); text-underline-offset: 3px; }
.post-cat { font-size: 11.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--cobalt); }
.post-title { font-family: var(--font-head); font-size: 18px; line-height: 1.35; color: var(--ink); }
.post-dek { font-size: 14px; color: var(--ink-soft); }
.post-meta { font-size: 12.5px; color: var(--muted); }
.post-cta { font-size: 14px; font-weight: 700; color: var(--cobalt); margin-top: 2px; }

/* Danh sách hàng bài gọn text-only (danh mục/hub) */
.post-list { display: flex; flex-direction: column; padding: 6px 0 26px; }
.post-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none;
  min-height: 44px;
}
.post-row:hover { text-decoration: none; background: rgba(255, 255, 255, 0.7); }
.post-row:hover .row-title { text-decoration: underline; text-decoration-color: var(--cobalt); text-underline-offset: 3px; }
.row-body { display: flex; flex-direction: column; gap: 4px; }
.row-cat { font-size: 11.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--cobalt); }
.row-title { font-family: var(--font-head); font-size: 16.5px; line-height: 1.35; color: var(--ink); }
.row-meta { font-size: 12.5px; color: var(--muted); }
.row-go { color: var(--cobalt); font-weight: 700; font-size: 15px; }

/* ---------- 9. Khối danh mục: 5 ô lớn + mục lục gọn ---------- */
.cats { padding-bottom: 40px; }
.cat-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.cat-tile {
  display: flex; flex-direction: column; gap: 6px; background: var(--card);
  border: 1px solid var(--line); border-top: 3px solid var(--acc, var(--cobalt));
  border-radius: var(--radius); padding: 16px; color: inherit; text-decoration: none;
}
.cat-tile:hover { text-decoration: none; border-color: var(--acc, var(--cobalt)); }
.cat-tile:hover .tile-name { text-decoration: underline; text-underline-offset: 3px; }
.tile-name { font-family: var(--font-head); font-weight: 700; font-size: 17.5px; color: var(--ink); }
.tile-tag { font-size: 13px; color: var(--ink-soft); flex: 1; }
.tile-count { font-size: 12.5px; font-weight: 600; color: var(--acc, var(--cobalt)); }
.cat-index {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px;
}
.cat-index li { border-bottom: 1px solid var(--line); }
.cat-idx {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 4px; color: var(--ink); font-size: 14.5px; min-height: 44px;
}
.cat-idx:hover { text-decoration: none; color: var(--cobalt); }
.idx-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ---------- 10. Hub ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hub-card {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--acc, var(--cobalt));
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px;
  color: inherit; text-decoration: none;
}
.hub-card:hover { text-decoration: none; border-color: var(--acc, var(--cobalt)); }
.hub-card:hover .hub-name { text-decoration: underline; text-underline-offset: 3px; }
.hub-name { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--ink); }
.hub-desc { font-size: 13.5px; color: var(--ink-soft); }
.hub-topics { font-size: 12.5px; color: var(--muted); flex: 1; }
.hub-count { font-size: 12.5px; font-weight: 600; color: var(--acc, var(--cobalt)); }

.empty-note { color: var(--ink-soft); background: var(--bg-soft); border: 1px dashed var(--line-strong); padding: 18px; border-radius: var(--radius); }
.empty-state {
  background: var(--bg-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 20px 22px; margin: 8px 0 24px; color: var(--ink-soft);
}
.empty-state .section-h { margin-bottom: 8px; }

.chips { padding: 26px 0; }
.chips .chip {
  display: inline-block; margin: 4px 10px 4px 0; padding: 8px 16px; background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13.5px; color: var(--ink);
  min-height: 44px; line-height: 26px;
}
.chips .chip:hover { border-color: var(--cobalt); color: var(--cobalt); text-decoration: none; }

/* ---------- 11. Bài viết — hệ thống article ---------- */
.article { max-width: 1080px; margin: 0 auto; }
.article-head {
  max-width: var(--read-w); margin: 0 0 26px; padding-bottom: 22px;
  border-bottom: 3px double var(--line-strong);
}
.article-head h1 { margin-bottom: 14px; }
.article-dek { font-size: 17.5px; color: var(--ink-soft); margin: 4px 0 16px; line-height: 1.6; }
.article-byline {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px;
  font-size: 13.5px; color: var(--muted);
}
.byline-ava { display: inline-flex; align-items: center; }
.byline-pub strong { color: var(--ink); }
.byline-sep { opacity: 0.5; }
.byline-read { font-weight: 600; color: var(--ink-soft); }
.art-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px;
}
.act-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-family: inherit;
  background: var(--card); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  min-height: 44px; min-width: 44px;
}
.act-btn:hover { border-color: var(--cobalt); color: var(--cobalt); }
.act-hint { font-size: 13px; color: var(--muted); }

/* Lưới thân bài: TOC sticky bên trái + cột đọc */
.article-body {
  display: grid; grid-template-columns: 220px minmax(0, 1fr);
  gap: 44px; justify-content: center; align-items: start;
}
.article-content { max-width: var(--read-w); }

/* Mục lục */
.article-toc { position: relative; }
.toc {
  position: sticky; top: calc(var(--header-h) + var(--sat) + 20px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.toc details > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 46px; padding: 12px 16px; cursor: pointer; list-style: none;
  font-weight: 700; font-size: 14px; color: var(--ink);
}
.toc details > summary::-webkit-details-marker { display: none; }
.toc details > summary:hover { background: var(--bg-soft); }
.toc .toc-chev { transition: transform 0.15s; color: var(--muted); }
.toc details[open] .toc-chev { transform: rotate(180deg); }
.toc ol {
  margin: 0; padding: 6px 8px 12px; list-style: none; counter-reset: toc;
  max-height: 60vh; max-height: 60dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.toc li { counter-increment: toc; }
.toc li::before {
  content: counter(toc); float: left; margin-left: 8px;
  font-size: 12px; color: var(--muted); line-height: 2.2; min-width: 16px;
}
.toc a { display: flex; align-items: center; min-height: 44px; padding: 8px 8px 8px 30px; border-radius: var(--radius-sm); font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }
.toc a:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }

/* Quick answer + key points: left-rule + tint, không dày hộp */
.quick-answer, .key-points {
  border-left: 3px solid var(--amber); background: #FBF6E9;
  padding: 16px 20px; margin: 0 0 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.quick-answer { border-left-color: var(--amber); }
.quick-answer h2, .key-points h2 {
  font-family: var(--font); font-size: 12.5px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 10px;
}
.quick-answer p { font-size: 16px; color: var(--ink); margin: 0; }
.key-points { border-left-color: var(--cobalt); background: #F0F3FB; }
.key-points ul, .aside-block ul { margin: 0; padding-left: 20px; }
.key-points li, .aside-block li { margin: 6px 0; }
.key-points li::marker { color: var(--cobalt); }

/* Trải nghiệm đọc: 65–75 ký tự/dòng, chữ 17.5px desktop */
.prose { font-size: 17.5px; line-height: 1.7; color: var(--ink); max-width: 34em; overflow-wrap: break-word; }
.prose p { margin: 0 0 17px; }
.prose-sec h2 { font-family: var(--font-head); font-size: clamp(22px, 2.6vw, 26px); margin: 36px 0 14px; line-height: 1.3; }
.prose h3 { font-size: 19.5px; margin: 26px 0 10px; }
.prose h4 { font-size: 17px; margin: 22px 0 8px; }
.prose ul, .prose ol { margin: 0 0 17px; padding-left: 24px; }
.prose li { margin: 7px 0; }
.prose a { text-decoration: underline; text-decoration-color: rgba(49, 87, 213, 0.35); text-underline-offset: 3px; overflow-wrap: anywhere; }
.prose a:hover { text-decoration-color: var(--cobalt); }
.prose strong { color: var(--ink); }
.prose blockquote {
  margin: 0 0 17px; padding: 8px 20px; border-left: 3px solid var(--cobalt);
  color: var(--ink-soft); font-style: italic;
}
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.prose figure { margin: 22px 0; }
.prose figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; text-align: center; }
.prose code {
  font-family: var(--mono); font-size: 0.88em; background: var(--bg-soft);
  padding: 2px 6px; border-radius: var(--radius-sm); overflow-wrap: anywhere;
}
.prose pre {
  background: var(--navy); color: #E5EAF5; padding: 16px 18px; border-radius: var(--radius);
  overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 13.5px; line-height: 1.6;
  margin: 0 0 17px;
}
.prose pre code { background: none; padding: 0; color: inherit; }
/* Bảng responsive: cuộn ngang trong khung, không tràn cột đọc */
.prose table {
  display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-collapse: collapse; margin: 0 0 20px;
}
.prose th, .prose td { border: 1px solid var(--line-strong); padding: 10px 12px; font-size: 15px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-soft); font-weight: 700; font-family: var(--font); font-size: 14px; }

/* Callout kiến thức: tint + left-rule thay hộp dày */
.aside-block {
  border-left: 3px solid var(--line-strong); background: var(--card);
  border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 16px 20px; margin: 24px 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.aside-block h2 { font-family: var(--font); font-size: 13px; letter-spacing: 0.8px; text-transform: uppercase; margin: 0 0 10px; color: var(--ink); }
.aside-warn { border-left-color: #C2410C; background: #FBF1EC; }
.aside-warn li::marker { color: #C2410C; }
.aside-note { border-left-color: var(--amber); background: #FBF6E9; }
.aside-note li::marker { color: var(--amber); }
.aside-checklist { border-left-color: #0E9F6E; background: #EFF8F2; }
.aside-checklist li::marker { color: #0E9F6E; }
.aside-steps { border-left-color: var(--cobalt); background: #F0F3FB; }
.aside-steps li::marker { color: var(--cobalt); font-weight: 700; }
.aside-refs li, .aside-note li { font-size: 14px; color: var(--ink-soft); }

/* Trang giới thiệu dùng cùng cột đọc */
.about-prose { margin-bottom: 28px; }

/* Bài liên quan + bài trước/bài sau */
.article-related { padding-top: 34px; }
.article-related .section-h { margin-top: 0; }
.article-related .latest-grid { margin-top: 16px; }
.art-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; }
.pn-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 5px; min-height: 44px;
  color: inherit; text-decoration: none;
}
.pn-card:hover { text-decoration: none; border-color: var(--cobalt); }
.pn-card:hover .pn-title { text-decoration: underline; text-decoration-color: var(--cobalt); text-underline-offset: 3px; }
.pn-card.pn-next { text-align: right; }
.pn-label { font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); }
.pn-title { font-family: var(--font-head); font-weight: 700; color: var(--ink); font-size: 16px; line-height: 1.4; }
.pn-meta { font-size: 12.5px; color: var(--muted); }

/* Shared publisher box: color tokens adapt to existing theme settings. */
.author-box {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-5); margin-top: var(--sp-6);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
}
.author-box-brand { flex: 0 0 auto; }
.author-box-brand .logo { color: var(--ink); }
.author-box-details { min-width: 0; flex: 1 1 240px; }
.author-box-name { font-weight: 700; margin: 0 0 var(--sp-2); }
.author-box-desc { color: var(--ink-soft); margin: 0 0 var(--sp-3); line-height: 1.6; }
.author-box-contact { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
@media (max-width: 479px) {
  .author-box { padding: var(--sp-4); }
  .author-box-brand .logo-text { font-size: 15px; }
}

/* ---------- 12. Tìm kiếm (modal) ---------- */
.search-modal {
  position: fixed; inset: 0; z-index: 150; background: rgba(16, 27, 49, 0.52);
  display: flex; align-items: flex-start; justify-content: center;
  padding: calc(var(--sat) + 16px) max(16px, var(--sar)) calc(var(--sab) + 16px) max(16px, var(--sal));
}
.search-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  width: min(680px, 100%); box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 100vh; max-height: 100dvh; margin: 0 auto;
}
.search-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 14px 18px; border-bottom: 1px solid var(--line); min-height: 52px;
}
.search-title { font-weight: 700; font-size: 15px; }
.search-close, .chatbot-close {
  background: none; border: 0; cursor: pointer; font-family: inherit; font-size: 14px;
  color: var(--muted); min-height: 44px; min-width: 44px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px;
}
.search-close:hover, .chatbot-close:hover { background: var(--bg-soft); color: var(--ink); }
.search-input-row {
  display: flex; align-items: center; gap: 10px; padding: 2px 18px;
  border-bottom: 1px solid var(--line);
}
.search-ico { color: var(--muted); flex-shrink: 0; }
#search-input {
  flex: 1; border: 0; padding: 15px 0; font-size: 16px; font-family: inherit;
  min-width: 0; min-height: 48px; background: none; color: var(--ink);
}
#search-input:focus { outline: none; }
/* Chưa có kết quả: khung chỉ cao theo nội dung; có kết quả: danh sách cuộn riêng */
.search-results { padding: 8px; min-height: 0; }
.search-results:not(:empty) {
  max-height: 60vh; max-height: 60dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.sr-item { display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: var(--radius-sm); min-height: 44px; }
.sr-item:hover { background: var(--bg-soft); text-decoration: none; }
.sr-title { font-weight: 600; color: var(--ink); font-size: 15px; }
.sr-kind { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.sr-desc { font-size: 13.5px; color: var(--muted); }
.sr-empty { padding: 22px 16px; color: var(--muted); }

/* Trang tìm kiếm riêng */
.search-page-box { max-width: 720px; }
#page-search-form { display: flex; gap: 8px; margin-bottom: 18px; }
#page-search-input {
  flex: 1; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 14px;
  font-size: 16px; font-family: inherit; min-width: 0; min-height: 48px; background: var(--card); color: var(--ink);
}
#page-search-input:focus { outline: none; border-color: var(--cobalt); }
#page-search-form button {
  border: 0; background: var(--cobalt); color: #fff; font-weight: 600; padding: 14px 22px;
  border-radius: var(--radius); cursor: pointer; min-height: 48px; font-family: inherit;
}
#page-search-form button:hover { background: var(--cobalt-deep); }
.search-page-box .search-results { padding: 0; }
.search-page-box .sr-item { padding: 12px 4px; border-bottom: 1px solid var(--line); border-radius: 0; }

/* ---------- 13. Trợ lý AI (panel chat) ---------- */
.chatbot-launcher {
  position: fixed; right: max(18px, var(--sar)); bottom: max(18px, var(--sab)); z-index: 140;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--cobalt); color: #fff; border: 0; border-radius: 999px;
  padding: 13px 22px; font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow-lg); min-height: 48px; font-family: inherit;
}
.chatbot-launcher:hover { background: var(--cobalt-deep); }

/* Desktop: panel bên phải ~480px, cao ~74dvh; chiều cao co theo bàn phím ảo qua --vvh */
.chatbot-panel {
  position: fixed; right: max(18px, var(--sar)); bottom: calc(76px + var(--sab)); z-index: 145;
  width: min(480px, calc(100vw - 36px));
  height: 520px;
  height: min(74dvh, calc(var(--vvh, 100dvh) * 0.74));
  max-height: calc(var(--vvh, 100dvh) - 24px - var(--sat));
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
}
.chatbot-head {
  background: var(--navy); color: #fff; padding: 14px 12px 14px 16px; min-height: 52px;
  display: flex; align-items: center; gap: 10px; font-weight: 600;
}
.chatbot-head-ico { display: inline-flex; opacity: 0.9; }
.chatbot-head-name { flex: 1; font-size: 14.5px; }
.chatbot-head .chatbot-close { color: #fff; }
.chatbot-head .chatbot-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.chatbot-log {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { border-radius: var(--radius); padding: 10px 14px; font-size: 14.5px; max-width: 88%; line-height: 1.55; overflow-wrap: anywhere; }
.msg-bot { background: var(--bg-soft); align-self: flex-start; }
.msg-user { background: var(--cobalt); color: #fff; align-self: flex-end; }
.msg .msg-source { display: block; margin-top: 6px; font-size: 12.5px; }
.msg .msg-source a { color: var(--cobalt); font-weight: 600; }
.chatbot-input-row {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + var(--sab));
  border-top: 1px solid var(--line);
}
#chatbot-input {
  flex: 1; resize: none; border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 12px; font-size: 15px; font-family: inherit; line-height: 1.5;
  min-width: 0; min-height: 46px; max-height: 132px; overflow-y: auto;
  background: #fff; color: var(--ink);
}
#chatbot-input:focus { outline: none; border-color: var(--cobalt); }
#chatbot-send, .chatbot-input-row button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: var(--cobalt); color: #fff; font-weight: 600; font-size: 14px;
  min-height: 46px; min-width: 46px; padding: 0 14px; border-radius: var(--radius);
  cursor: pointer; font-family: inherit; flex-shrink: 0;
}
#chatbot-send:hover, .chatbot-input-row button:hover { background: var(--cobalt-deep); }

/* ---------- 14. Footer ---------- */
.site-footer { background: var(--navy); color: #C9D2E3; margin-top: 48px; border-top: 3px solid var(--cobalt); }
.footer-inner {
  max-width: var(--content-max); margin: 0 auto; padding: 44px 20px calc(40px + var(--sab));
  padding-left: max(20px, var(--sal)); padding-right: max(20px, var(--sar));
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px;
}
.footer-brand .logo { color: #fff; }
.footer-brand .logo-text strong { color: #9DB4F5; }
.footer-tag { font-size: 14px; margin: 14px 0 0; max-width: 340px; line-height: 1.6; }
.footer-note { font-size: 12.5px; color: #8B99B8; margin-top: 14px; line-height: 1.6; max-width: 340px; }
.footer-col-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: #8B99B8; margin: 0 0 12px;
}
.footer-cats a, .footer-meta a {
  display: block; color: #C9D2E3; font-size: 14px; padding: 5px 0;
}
/* Mobile: link footer là mục chạm — đủ cao 44px cho ngón tay */
@media (max-width: 767px) {
  .footer-cats a, .footer-meta a { display: flex; align-items: center; min-height: 44px; padding: 0; }
}
.footer-cats a:hover, .footer-meta a:hover { color: #fff; text-decoration: none; }

/* ---------- 15. Responsive ————
   Mobile 320/360/375/390/430 · Tablet 768/820/1024 · Desktop 1280/1440/1920
   Mỗi dải có bố cục riêng, không chỉ scale. */
@media (max-width: 1023px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-flex; flex-direction: column; justify-content: center; margin-left: auto; }
  .mega-grid { grid-template-columns: repeat(3, 1fr); }
  .cat-tiles { grid-template-columns: repeat(3, 1fr); }
  .latest-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
  /* Article: TOC về chế độ accordion nằm trên cột đọc */
  .article-body { display: block; }
  .article-content { max-width: none; }
  .article-toc { margin-bottom: 20px; }
  .toc { position: static; max-height: none; }
  .toc ol { max-height: 40vh; max-height: 40dvh; }
  /* Featured text-only: xếp 1 cột — nhãn/chuyên mục lên trên, tiêu đề dưới */
  .feat-card { grid-template-columns: 1fr; }
  .feat-side {
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 16px 18px 14px;
  }
}
@media (max-width: 767px) {
  .site-main { padding: 20px 16px 56px; }
  .hero { padding: 32px 0 26px; }
  .hero-search button { padding: 15px 18px; }
  .hero-hint { display: none; } /* gợi ý bàn phím chỉ có nghĩa trên desktop */
  .rental-grid { grid-template-columns: 1fr; }
  .hub-grid { grid-template-columns: 1fr; }
  .latest-grid { grid-template-columns: 1fr; }
  .cat-tiles { grid-template-columns: repeat(2, 1fr); }
  .cat-index { grid-template-columns: 1fr; column-gap: 0; }
  .art-pn { grid-template-columns: 1fr; }
  .pn-card.pn-next { text-align: left; }
  /* Thân bài mobile: 17px, vẫn giữ 65–75 ký tự/dòng */
  .prose { font-size: 17px; line-height: 1.7; max-width: none; }
  .quick-answer, .key-points { padding: 14px 16px; }
  .aside-block { padding: 14px 16px; }
  /* Search: sheet gần full màn hình, lề 12px */
  .search-modal {
    padding: calc(var(--sat) + 12px) max(12px, var(--sar)) calc(var(--sab) + 12px) max(12px, var(--sal));
    align-items: flex-start;
  }
  /* AI: bottom sheet lớn, gần full width, ~88dvh */
  .chatbot-panel {
    left: 0; right: 0; bottom: var(--kb-shift, 0px);
    width: 100%;
    height: 560px;
    height: min(88dvh, calc(var(--vvh, 100dvh) * 0.88));
    max-height: calc(var(--vvh, 100dvh) - 8px - var(--sat));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .chatbot-launcher { right: max(12px, var(--sar)); bottom: max(12px, var(--sab)); padding: 11px 16px; font-size: 14px; min-height: 46px; }
  /* Footer dài trên mobile: chừa khoảng cho launcher cố định không che link cuối */
  .footer-inner { padding-bottom: calc(96px + var(--sab)); }
}
@media (max-width: 479px) {
  .site-main { padding: 16px 14px 48px; }
  .header-inner { padding: 8px 14px; gap: 10px; }
  .logo-text { font-size: 15.5px; }
  .search-open span { display: none; }
  .search-open { padding: 9px 12px; }
  .breadcrumb { font-size: 12.5px; }
  .breadcrumb .crumb-sep { margin: 0 4px; }
  .chatbot-launcher { padding: 10px 14px; font-size: 13.5px; min-height: 44px; }
  .cat-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-tile, .hub-card, .rental-cell { padding: 14px; }
  /* Footer gọn trên điện thoại nhỏ: giữ 2 cột (brand tràn hàng) thay vì dốc dài 1 cột */
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 18px 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .article-byline { font-size: 12.5px; }
  .article-dek { font-size: 16.5px; }
  .toc a { font-size: 13px; }
  .feat-body { padding: 18px 18px 20px; }
  .post-title { font-size: 17px; }
}
@media (max-width: 379px) {
  .site-main { padding: 14px 12px 44px; }
  .hero-title { font-size: 31px; }
  .cat-tile, .hub-card, .rental-cell { padding: 12px; }
  .mega-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { padding: 32px 16px 32px; }
}

/* ---------- 16. Chuyển động & hiệu ứng ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
/* 100dvh fallback cho trình duyệt cũ: đã khai báo song song vh+dvh ở từng quy tắc */
@supports not (height: 100dvh) {
  .chatbot-panel { height: min(74vh, calc(var(--vvh, 100vh) * 0.74)); }
  .toc ol { max-height: 60vh; }
  .search-box { max-height: 100vh; }
}
