/* ==========================================================================
   Tra cứu Thông báo – Tập đoàn Minh Trung Việt Nam
   ========================================================================== */

:root {
  /* Palette đỏ/vàng nhận diện Minh Trung (MTG-UI-Red-Gold kit)
     Tên biến --navy-* giữ nguyên để không phải sửa hàng loạt rule — giá trị đã chuyển sang đỏ */
  --navy-950: #6d0c12;
  --navy-900: #8f1018;
  --navy-800: #8f1018;
  --navy-700: #b5121b;
  --navy-600: #d71920;
  --navy-50:  #fdeeea;
  --indigo-600: #d49a1e;
  --red-700:  #b5121b;
  --red-600:  #d71920;
  --red-50:   #fdefef;
  --gold-500: #ffc928;
  --gold-600: #d49a1e;
  --vermilion-500: #f04a23;

  --ink-900: #20263a;
  --ink-800: #2b3044;
  --ink-700: #3d4357;
  --ink-600: #565b6e;
  --ink-500: #667085;
  --ink-400: #98a2b3;
  --ink-300: #d8cebc;
  --ink-200: #e9dfcf;
  --ink-100: #f6efe2;
  --ink-50:  #fdf9f1;

  --bg: #fbf6ec;
  --surface: #fffefb;
  --border: #e9dfcf;
  --text: var(--ink-900);
  --text-soft: var(--ink-600);
  --text-mute: var(--ink-500);
  --primary: var(--navy-700);
  --primary-soft: var(--navy-50);
  --accent: var(--red-600);
  --accent-soft: var(--red-50);

  --nav-gradient: linear-gradient(105deg, #8f1018 0%, #d71920 60%, #b5121b 100%);
  --action-gradient: linear-gradient(110deg, #a80d16 0%, #d71920 58%, #ffc928 115%);
  --brand-stripe: linear-gradient(90deg, #ffe06a, #ffc928 45%, #f4a300 70%, #d49a1e);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(143, 16, 24, .04), 0 2px 6px rgba(143, 16, 24, .06);
  --shadow-md: 0 6px 16px -4px rgba(143, 16, 24, .09), 0 2px 5px -2px rgba(143, 16, 24, .05);
  --shadow-lg: 0 10px 28px rgba(143, 16, 24, .10), 0 18px 44px -12px rgba(143, 16, 24, .18);
  --shadow-focus: 0 12px 34px rgba(215, 25, 32, .20);
  --header-h: 64px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Times New Roman", Times, Georgia, serif;
}

html[data-theme="dark"] {
  --bg: #171010;
  --surface: #221716;
  --border: #3d2a26;
  --text: #f4ece7;
  --text-soft: #cbb8b0;
  --text-mute: #a8938b;
  --primary: #f0827f;
  --primary-soft: #381d1c;
  --accent: #f2686d;
  --accent-soft: #2a1618;
  --gold-500: #eebd4e;
  --ink-100: #2c1e1c;
  --ink-50: #16203200;
  --ink-200: #3d2a26;
  --ink-300: #56403a;
  --nav-gradient: linear-gradient(105deg, #4a080c 0%, #91121a 60%, #650d12 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  --shadow-focus: 0 12px 34px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Ảnh chìm quảng cáo sản phẩm Minh Trung — hoạ tiết 36 ảnh lặp lại, phủ lớp màu nền
   gần như đục (93%) lên trên để chỉ còn thấp thoáng ~7%. Không đặt trên .surface (thẻ,
   card đều nền trắng đục nên tự che luôn) — chỉ lộ ra ở nền trang, khe hở giữa các khối. */
html, body {
  background-image: linear-gradient(rgba(251, 246, 236, .93), rgba(251, 246, 236, .93)), url("/wm/collage.webp");
  background-repeat: no-repeat, repeat;
  background-size: cover, 340px 340px;
}
html[data-theme="dark"], html[data-theme="dark"] body {
  background-image: linear-gradient(rgba(23, 16, 16, .93), rgba(23, 16, 16, .93)), url("/wm/collage.webp");
}

body { overflow-x: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

::selection { background: rgba(215, 25, 32, .18); }

/* ---------- boot ---------- */
.boot {
  min-height: 70vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; color: var(--text-mute);
}
.boot-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--ink-200); border-top-color: var(--navy-800);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.app { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1 0 auto; padding: 26px 0 60px; }

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-gradient);
  color: #fff; box-shadow: 0 6px 24px rgba(109, 12, 18, .28);
}
/* chỉ vàng champagne — sang trọng, không lẫn đỏ */
.hdr::after {
  content: ""; display: block; height: 2px;
  background: var(--brand-stripe);
  opacity: .9;
}
.hdr-in {
  height: var(--header-h); display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 46px; height: 46px; flex: none; border-radius: 12px;
  background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  transition: transform .18s;
}
.brand:hover .brand-mark { transform: scale(1.05); }
.brand-mark img { width: 38px; height: auto; display: block; }
.brand-txt { min-width: 0; }
.brand-t1 { font-weight: 700; font-size: 15px; line-height: 1.2; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-t2 { font-size: 11.5px; opacity: .78; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-btn {
  border: 1px solid transparent; background: transparent; color: rgba(255, 255, 255, .82);
  padding: 9px 15px; border-radius: 12px; font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s, border-color .15s;
}
.nav-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.nav-btn.on {
  background: rgba(255, 255, 255, .15); color: #fff; font-weight: 600;
  border-color: rgba(255, 201, 40, .9);
  box-shadow: 0 2px 10px rgba(109, 12, 18, .35), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.nav-btn svg { width: 17px; height: 17px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 0;
  background: rgba(255, 255, 255, .1); color: #fff;
  display: grid; place-items: center; transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .22); }
.icon-btn svg { width: 18px; height: 18px; }

/* nút Đăng nhập góc menu — site đang ở chế độ công khai (gate tắt) */
.login-corner-btn {
  display: inline-flex; align-items: center; gap: 7px; margin-left: 4px;
  border: 1px solid rgba(255, 201, 40, .55); background: rgba(255, 255, 255, .1); color: #fff;
  padding: 8px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 650;
  transition: background .15s, border-color .15s;
}
.login-corner-btn:hover { background: rgba(255, 255, 255, .2); border-color: var(--gold-500); }
.login-corner-btn svg { width: 15px; height: 15px; }

/* đăng nhập dạng lớp phủ (mở từ nút góc menu) — render qua portal nên đặt selector độc lập */
.login-modal-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(10, 4, 4, .6); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto; animation: pvIn .16s ease-out;
}
.login-modal-overlay .login-wrap { min-height: auto; padding: 0; background: none; width: 100%; }
.login-modal-x {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .16); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s;
}
.login-modal-x:hover { background: rgba(255, 255, 255, .3); }
.login-modal-x svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .login-corner-btn span { display: none; }
  .login-corner-btn { padding: 0; width: 36px; height: 36px; justify-content: center; border-radius: 9px; }
}

/* ---------- lightbox xem ảnh: bấm mở, ✕ để tắt, ảnh co vừa khít màn hình (nhìn 1 lần thấy hết, không cần zoom) ---------- */
.ilb {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(10, 4, 4, .86);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 28px; cursor: zoom-out;
  animation: pvIn .16s ease-out;
}
.ilb img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; display: block; cursor: default;
  border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.ilb-x {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .16); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s, transform .15s;
}
.ilb-x:hover { background: rgba(255, 255, 255, .3); transform: scale(1.06); }
.ilb-x svg { width: 20px; height: 20px; }
@media (max-width: 720px) {
  .ilb { padding: 14px; }
  .ilb-x { top: 10px; right: 10px; width: 38px; height: 38px; }
}

/* ---------- 2 khung slider đầu trang: Sản phẩm | Câu nói hay ---------- */
.kvs-dual {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  max-width: 1040px; margin: 0 auto 30px; align-items: start;
}
.kvs-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  color: var(--navy-700); margin: 0 0 8px 2px;
}
html[data-theme="dark"] .kvs-label { color: var(--primary); }
.kvs-label svg { width: 15px; height: 15px; color: var(--gold-600); flex: none; }
/* Chiều cao cố định (KHÔNG ép aspect-ratio ngang) — nhờ vậy ảnh dọc (áp phích sản phẩm)
   lẫn ảnh ngang (khẩu hiệu, banner) đều tự co theo object-fit:contain để hiện TRỌN VẸN,
   không bị bó hẹp thành 1 dải nhỏ như khi ép khung 16:10. */
.kvs-box {
  position: relative; height: 400px; overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eaf3fe 0%, #fdf6e8 100%);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
html[data-theme="dark"] .kvs-box { background: linear-gradient(135deg, #1c2333 0%, #2c2214 100%); }
/* flex (KHÔNG dùng grid+place-items) — grid row track "auto" khiến height:100% của ảnh con
   không tính đúng theo container, ảnh dọc bị tràn khung. Flex resolve % height đúng theo
   chiều cao đã định của .kvs-slide (position:absolute;inset:0). */
.kvs-slide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .55s ease; pointer-events: none;
  cursor: zoom-in; border: 0; padding: 10px; background: transparent;
}
.kvs-slide.on { opacity: 1; pointer-events: auto; }
.kvs-slide img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; border-radius: 6px; }
.kvs-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 32px; height: 40px; border: 0; border-radius: 10px;
  background: rgba(20, 10, 8, .3); color: #fff; font-size: 24px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; transition: opacity .18s, background .15s;
}
.kvs-prev { left: 8px; }
.kvs-next { right: 8px; }
.kvs-box:hover .kvs-nav, .kvs-nav:focus-visible { opacity: 1; }
.kvs-nav:hover { background: rgba(20, 10, 8, .55); }
.kvs-toggle {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: rgba(20, 10, 8, .38); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  opacity: .85; transition: opacity .15s, background .15s;
}
.kvs-toggle:hover { opacity: 1; background: rgba(20, 10, 8, .58); }
.kvs-toggle svg { width: 14px; height: 14px; }
.kvs-count {
  position: absolute; right: 9px; bottom: 8px; z-index: 2;
  background: rgba(20, 10, 8, .45); color: #fff;
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 8px;
  pointer-events: none;
}
.kvs-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 8px; }
.kvs-dot {
  width: 7px; height: 7px; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
  background: var(--ink-300); transition: all .18s;
}
.kvs-dot:hover { background: var(--text-mute); }
.kvs-dot.on { width: 17px; background: var(--gold-600); }
@media (max-width: 1024px) {
  .kvs-box { height: 340px; }
}
@media (max-width: 760px) {
  .kvs-dual { grid-template-columns: 1fr; gap: 22px; margin-bottom: 20px; }
  .kvs-box { height: 380px; }
  .kvs-nav { opacity: 1; width: 30px; height: 38px; font-size: 22px; }
  .kvs-toggle { opacity: 1; }
}
@media (max-width: 380px) {
  .kvs-box { height: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  .kvs-slide { transition: none; }
}

/* ---------- hero: full-bleed lụa navy–gold + watermark logo vàng ---------- */
.hero {
  /* tràn hết chiều ngang màn hình, thoát khỏi .wrap */
  margin: -26px calc(50% - 50vw) 22px;
  padding: 34px max(20px, calc(50vw - 600px)) 28px;
  background: #fff9ef url("/hero-bg.webp") center right / cover no-repeat;
  position: relative; overflow: hidden;
  border-bottom: 1px solid rgba(233, 223, 207, .8);
}
/* lớp phủ sáng bên trái bảo đảm tương phản chữ trên ảnh */
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(95deg, rgba(255, 250, 240, .93) 0%, rgba(255, 250, 240, .8) 46%, rgba(255, 250, 240, 0) 78%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
html[data-theme="dark"] .hero {
  background-color: #201312;
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .hero::before {
  background: linear-gradient(95deg, rgba(23, 12, 11, .93) 0%, rgba(23, 12, 11, .82) 46%, rgba(23, 12, 11, .4) 100%);
}
.hero-grid { display: flex; align-items: center; gap: 34px; }
.hero-txt { flex: 1; min-width: 0; }
.hero h1 {
  margin: 0 0 8px; font-size: 28px; line-height: 1.25; letter-spacing: -.4px;
  font-weight: 700; color: var(--navy-800);
}
html[data-theme="dark"] .hero h1 { color: #eef3fb; }
.hero p { margin: 0; color: var(--text-soft); font-size: 15px; max-width: 700px; }

/* thẻ thống kê: icon màu + sparkline */
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.stat {
  flex: 1; min-width: 168px; max-width: 240px;
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  column-gap: 12px; row-gap: 6px;
  background: rgba(255, 254, 250, .9); border: 1px solid rgba(233, 223, 207, .9);
  border-radius: var(--radius);
  padding: 13px 16px 11px; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
html[data-theme="dark"] .stat { background: rgba(18, 29, 49, .85); border-color: var(--border); }
.stat-ico {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--st-soft, var(--navy-50)); color: var(--st-color, var(--navy-600));
}
.stat-ico svg { width: 22px; height: 22px; }
.stat-tx { min-width: 0; }
.stat-tx b { display: block; font-size: 22px; line-height: 1.15; color: var(--ink-900); font-weight: 750; }
html[data-theme="dark"] .stat-tx b { color: #eef3fb; }
.stat-tx span { font-size: 12.5px; color: var(--text-mute); white-space: nowrap; }
.stat-spark { grid-column: 1 / -1; width: 64px; height: 12px; color: var(--st-color, var(--navy-600)); opacity: .8; }
/* tên class giữ nguyên từ bản navy — giá trị đã chuyển sang bộ đỏ/vàng */
.st-blue   { --st-color: #d71920; --st-soft: #fdeaea; }
.st-gold   { --st-color: #e08a00; --st-soft: #fff3d9; }
.st-purple { --st-color: #f04a23; --st-soft: #ffece4; }
.st-green  { --st-color: #c2921a; --st-soft: #fbf1d7; }
html[data-theme="dark"] .st-blue   { --st-soft: #3d1719; --st-color: #f0827f; }
html[data-theme="dark"] .st-gold   { --st-soft: #3a2a10; --st-color: #eeb453; }
html[data-theme="dark"] .st-purple { --st-soft: #3c1d13; --st-color: #f58e6e; }
html[data-theme="dark"] .st-green  { --st-soft: #362b10; --st-color: #e5c05a; }

/* ---------- search bar ---------- */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 6px 8px 6px 16px;
  box-shadow: var(--shadow-md); transition: border-color .15s, box-shadow .15s;
}
.searchbar:focus-within { border-color: var(--navy-600); box-shadow: 0 0 0 4px rgba(215, 25, 32, .11), var(--shadow-focus); }
.searchbar svg { width: 20px; height: 20px; color: var(--text-mute); flex: none; }
.searchbar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  padding: 13px 0; font-size: 15.5px;
}
.searchbar input::placeholder { color: var(--text-mute); }
.sb-keys { flex: none; display: inline-flex; align-items: center; gap: 4px; user-select: none; }
.sb-keys kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  color: var(--text-mute); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 8px; background: var(--ink-100);
}
.sb-keys i { font-style: normal; font-size: 12px; color: var(--text-mute); }
.searchbar:focus-within .sb-keys { display: none; }
.sb-go svg { width: 17px; height: 17px; }
.sb-clear {
  border: 0; background: var(--ink-100); color: var(--text-soft);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
}
.sb-clear:hover { background: var(--ink-200); }
.sb-go {
  border: 0; background: var(--action-gradient); color: #fff; font-weight: 650;
  padding: 12px 22px; border-radius: 999px; flex: none; font-size: 14.5px;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 18px rgba(215, 25, 32, .3);
  transition: filter .16s, transform .16s, box-shadow .16s;
}
.sb-go:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); box-shadow: var(--shadow-focus); }
.sb-go:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- filters ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 18px 0 6px;
}
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  padding: 6px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  transition: all .14s; white-space: nowrap;
}
.chip:hover { border-color: var(--navy-600); color: var(--primary); }
.chip.on {
  background: linear-gradient(110deg, var(--navy-950), var(--navy-600) 80%);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 12px rgba(215, 25, 32, .28);
}
html[data-theme="dark"] .chip.on { color: #fff; }
.chip small { opacity: .7; margin-left: 5px; font-size: 12px; }

.selectbox {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 9px; padding: 7px 11px; font-size: 13.5px; outline: 0;
}
.selectbox:focus { border-color: var(--navy-600); }

/* ---------- thanh bộ lọc dropdown ---------- */
.filterbar {
  margin: 16px 0 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 10px 14px;
}
.fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fb-toggle {
  display: none; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 600;
}
.fb-toggle svg { width: 16px; height: 16px; color: var(--navy-600); }
.fb-n {
  background: var(--navy-600); color: #fff; font-size: 11.5px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 999px;
  display: inline-grid; place-items: center; padding: 0 6px;
}
.fb-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fsel {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  padding: 0 10px; height: 40px; transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.fsel:hover { border-color: var(--navy-600); }
.fsel:focus-within { border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(215, 25, 32, .1); }
.fsel > svg { width: 16px; height: 16px; color: var(--navy-600); flex: none; }
.fsel select {
  appearance: none; -webkit-appearance: none;
  border: 0; outline: 0; background: transparent; color: var(--text);
  font-size: 13.5px; font-weight: 550; padding-right: 20px; height: 100%;
  max-width: 200px; cursor: pointer;
}
.fsel select:disabled { opacity: .5; cursor: not-allowed; }
.fsel-caret {
  position: absolute; right: 8px; pointer-events: none;
  display: grid; place-items: center; color: var(--text-mute);
}
.fsel-caret svg { width: 13px; height: 13px; }
.fb-reset {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 10px; height: 40px; padding: 0 14px; font-size: 13.5px; font-weight: 600;
  transition: all .15s;
}
.fb-reset:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.fb-reset svg { width: 15px; height: 15px; }
.fb-applied {
  margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-mute);
}
.fb-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(212, 154, 30, .55); background: #fff6dd; color: var(--navy-700);
  border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600;
  transition: all .14s;
}
.fb-chip i { font-style: normal; font-size: 14px; line-height: 1; opacity: .7; }
.fb-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
html[data-theme="dark"] .fb-chip { background: #362b10; color: var(--gold-500); border-color: rgba(238, 189, 78, .45); }

/* ---------- dòng kết quả + toggle hiển thị ---------- */
.result-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 16px 0 12px; color: var(--text-mute); font-size: 13.5px;
}
.rl-count {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding-left: 12px; border-left: 3px solid var(--gold-500);
}
.result-line b { color: var(--text); font-size: 19px; font-weight: 750; }
.rl-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.view-toggle {
  display: inline-flex; gap: 4px; padding: 4px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface);
}
.vt-btn {
  width: 34px; height: 32px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--text-mute);
  display: grid; place-items: center; transition: all .14s;
}
.vt-btn svg { width: 16px; height: 16px; }
.vt-btn:hover { color: var(--text); background: var(--ink-100); }
.vt-btn.on {
  color: var(--navy-600); background: #fff6dd;
  border-color: rgba(244, 163, 0, .8);
}
html[data-theme="dark"] .vt-btn.on { background: #362b10; }
html[data-theme="dark"] .vt-btn.on { color: var(--primary); background: var(--primary-soft); }
.rl-sort { height: 38px; }
.link-btn { border: 0; background: none; color: var(--primary); font-size: 13.5px; padding: 0; text-decoration: underline; }

/* ---------- card ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.grid.list { grid-template-columns: 1fr; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px 18px 15px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--ink-300); }

.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-num {
  font-size: 14px; font-weight: 700; letter-spacing: -.1px;
  color: var(--navy-600); white-space: nowrap;
}
html[data-theme="dark"] .tag-num { color: var(--primary); }
.tag-dv {
  font-size: 11.5px; font-weight: 600; letter-spacing: .3px;
  background: var(--accent-soft); color: var(--accent);
  padding: 3px 8px; border-radius: 6px;
}
.tag-date { margin-left: auto; font-size: 12.5px; color: var(--text-mute); white-space: nowrap; }

.card h3 { margin: 0; font-size: 16.5px; line-height: 1.4; font-weight: 650; letter-spacing: -.1px; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--primary); text-decoration: none; }
.card .sum {
  margin: 0; font-size: 14px; color: var(--text-soft); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .snip {
  font-size: 13.5px; color: var(--text-soft); background: var(--ink-100);
  border-left: 3px solid var(--ink-300); padding: 8px 11px; border-radius: 0 8px 8px 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-bot {
  margin-top: auto; padding-top: 11px; border-top: 1px dashed var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.pill {
  font-size: 12px; color: var(--text-mute); background: var(--ink-100);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.card-links { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.mini {
  font-size: 13px; font-weight: 600; color: var(--primary);
  display: inline-flex; align-items: center; gap: 4px;
}
.mini:hover { text-decoration: none; opacity: .78; }
.mini svg { width: 14px; height: 14px; }
.mini.pdf { color: var(--accent); border-left: 1px solid var(--border); padding-left: 10px; }

mark { background: #fde68a; color: inherit; padding: 0 2px; border-radius: 3px; }
html[data-theme="dark"] mark { background: #7a5c00; color: #fff8dc; }

/* ---------- empty ---------- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--text-mute);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg);
}
.empty svg { width: 44px; height: 44px; opacity: .4; margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }

/* ---------- detail ---------- */
.crumb { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-mute); margin-bottom: 16px; flex-wrap: wrap; }
.crumb svg { width: 14px; height: 14px; }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 20px; align-items: start; }

.doc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.doc-hd {
  padding: 22px 26px 18px;
  border-bottom: 3px double rgba(212, 154, 30, .55);
  background: linear-gradient(180deg, var(--primary-soft), transparent);
}
.doc-hd-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 4px;
}
.doc-hd-left { display: flex; align-items: center; gap: 12px; min-width: 0; max-width: 38%; }
.doc-logo { width: 54px; height: auto; flex: none; filter: drop-shadow(0 2px 5px rgba(0,0,0,.14)); }
.doc-org { font-size: 12.5px; font-weight: 700; letter-spacing: .3px; color: var(--primary); text-transform: uppercase; line-height: 1.45; }
.doc-hd-right { text-align: center; flex: none; max-width: 44%; }

/* chân dung Chủ tịch ở góc văn bản — nhỏ, viền vàng kiểu author-brand, bấm để phóng to */
.ct-corner {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px;
  max-width: 112px; border: 0; background: transparent; padding: 0; cursor: zoom-in;
  transition: transform .15s;
}
.ct-corner:hover { transform: translateY(-1px); }
.ct-corner img {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; display: block;
  border: 2.5px solid var(--gold-600);
  outline: 3px solid rgba(255, 201, 40, .35); outline-offset: 2px;
  box-shadow: 0 6px 16px rgba(143, 16, 24, .18);
  background: #dceafd;
}
.ct-name {
  font-family: var(--serif); font-style: italic; font-size: 11px;
  text-align: center; color: var(--text-soft); line-height: 1.35;
}
.ct-name b {
  display: block; font-style: normal; font-size: 12.5px; letter-spacing: .2px;
  color: var(--navy-700); font-weight: 700; white-space: nowrap;
}
html[data-theme="dark"] .ct-name b { color: var(--primary); }
.doc-nation { font-size: 12.5px; font-weight: 700; letter-spacing: .3px; line-height: 1.45; }
.doc-motto {
  font-size: 12.5px; font-weight: 650; margin-top: 2px; display: inline-block;
  border-bottom: 1.5px solid var(--text); padding-bottom: 3px;
}
.doc-kind { text-align: center; margin: 16px 0 4px; font-family: var(--serif); font-size: 25px; font-weight: 700; letter-spacing: 1.5px; }
.doc-kind::after {
  content: ""; display: block; width: 64px; height: 3px;
  margin: 10px auto 0; border-radius: 2px;
  background: var(--brand-stripe);
}
.doc-vv { text-align: center; font-style: italic; color: var(--text-soft); font-size: 15px; margin-bottom: 12px; }
.doc-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px;
}
.doc-body { padding: 22px 26px 26px; position: relative; }
/* logo chìm mờ giữa trang, kiểu công văn */
.doc-body::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("/logo.png") no-repeat center 260px;
  background-size: 330px auto; opacity: .05;
}
.doc-body > * { position: relative; }
.doc-body h4 {
  margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-mute); font-weight: 700;
}
.kg { margin: 0 0 20px; padding: 13px 16px; background: var(--ink-100); border-radius: var(--radius-sm); }
.kg ul { margin: 0; padding-left: 19px; }
.kg li { margin: 2px 0; font-weight: 550; }

.fulltext {
  white-space: pre-wrap; font-size: 15.3px; line-height: 1.85; color: var(--text);
  font-family: var(--serif);
}
.fulltext .num { font-weight: 700; }

.tbl-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.tbl { border-collapse: collapse; width: 100%; min-width: 460px; font-size: 14px; font-family: var(--font); }
table.tbl th, table.tbl td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
table.tbl th { background: var(--ink-100); font-weight: 650; font-size: 13px; }
table.tbl tbody tr:nth-child(even) { background: var(--ink-50); }
html[data-theme="dark"] table.tbl tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }

.sign { margin-top: 26px; display: flex; justify-content: flex-end; }
.sign-in { text-align: center; min-width: 210px; }
.sign-role { font-weight: 700; letter-spacing: .5px; }
.sign-name { margin-top: 44px; font-weight: 700; font-size: 16px; }

.recv { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-soft); }
.recv ul { margin: 6px 0 0; padding-left: 18px; }

.note {
  margin-top: 18px; padding: 12px 15px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent); font-size: 13px; line-height: 1.6;
  border: 1px solid rgba(196, 22, 28, .18);
}

/* sidebar */
.side { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 14px; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
}
.panel h4 {
  margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-mute); font-weight: 700;
}
.kv { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv dt { flex: none; width: 104px; color: var(--text-mute); }
.kv dd { margin: 0; flex: 1; font-weight: 550; min-width: 0; word-break: break-word; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
  transition: all .15s;
}
.btn:hover { border-color: var(--navy-600); color: var(--primary); text-decoration: none; }
.btn svg { width: 17px; height: 17px; }
.btn.prim { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.prim:hover { background: var(--red-700); border-color: var(--red-700); color: #fff; }
.btn + .btn { margin-top: 9px; }

.rel a {
  display: block; padding: 9px 0; border-bottom: 1px dashed var(--border);
  font-size: 13.8px; color: var(--text); line-height: 1.5;
}
.rel a:last-child { border-bottom: 0; }
.rel a:hover { color: var(--primary); text-decoration: none; }
.rel .rn {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px;
  color: var(--primary); display: block;
}

/* ---------- PDF viewer (xem bản gốc không cần tải) ---------- */
.pv-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 15, 28, .72);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: stretch; justify-content: center;
  padding: 18px; animation: pvIn .18s ease-out;
}
@keyframes pvIn { from { opacity: 0; } to { opacity: 1; } }
.pv {
  width: 100%; max-width: 1040px; display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.pv-bar {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--nav-gradient);
  color: #fff; flex: none; flex-wrap: wrap;
}
.pv-logo { width: 30px; height: auto; flex: none; background: #fff; border-radius: 7px; padding: 2px; }
.pv-title {
  font-weight: 650; font-size: 14px; min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.pv-btn {
  border: 0; border-radius: 8px; background: rgba(255, 255, 255, .14); color: #fff;
  min-width: 32px; height: 32px; padding: 0 10px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .14s; text-decoration: none;
}
.pv-btn:hover { background: rgba(255, 255, 255, .28); text-decoration: none; color: #fff; }
.pv-zoom { font-size: 12.5px; min-width: 44px; text-align: center; opacity: .9; }
.pv-x { background: rgba(196, 22, 28, .85); }
.pv-x:hover { background: var(--red-600); }
.pv-body {
  flex: 1; overflow: auto; padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.pv-page { max-width: 100%; }
.pv-page canvas {
  display: block; max-width: none; background: #fff;
  border-radius: 4px; box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}
.pv-pagenum { text-align: center; font-size: 12px; color: var(--text-mute); margin-top: 7px; }
.pv-load {
  min-height: 40vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--text-mute); text-align: center; line-height: 1.7;
}

/* ---------- ask ---------- */
.ask-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.chat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  min-height: 62vh; overflow: hidden;
}
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 11px; max-width: 100%; }
.msg .av {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #fff; background: var(--primary);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.msg .av img { width: 28px; height: auto; display: block; }
.msg:not(.me) .av { background: #fff; border: 1px solid var(--border); }
.msg.me { flex-direction: row-reverse; }
.msg.me .av { background: var(--ink-500); }
.bubble {
  padding: 12px 15px; border-radius: 14px; background: var(--ink-100);
  font-size: 14.8px; line-height: 1.72; min-width: 0; max-width: 78%;
  overflow-wrap: anywhere;
}
.msg.me .bubble { background: var(--primary); color: #fff; }
html[data-theme="dark"] .msg.me .bubble { color: #eaf2ff; }
.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 20px; }
.bubble li { margin: 3px 0; }
.bubble strong { font-weight: 700; }

.cites { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.cite {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; font-size: 13.2px;
  line-height: 1.5;
}
.cite:hover { border-color: var(--navy-600); text-decoration: none; }
.cite .cn {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; font-weight: 700;
  color: #fff; background: var(--primary); padding: 2px 7px; border-radius: 5px; flex: none; margin-top: 1px;
}
.cite .ct { color: var(--text); }
.cite .cs { color: var(--text-mute); font-size: 12px; display: block; }
.cite-hb .cn, .cbot-cite.cite-hb .cbot-cite-no { background: var(--gold-600); color: #fff; }

/* mục Sổ tay được cuộn tới từ trích dẫn Hỏi đáp — nháy nhẹ để dễ nhận ra */
.hb-sec:target { animation: hb-target-flash 1.8s ease-out; }
@keyframes hb-target-flash {
  0% { box-shadow: 0 0 0 3px rgba(212, 154, 30, .55); }
  100% { box-shadow: 0 0 0 3px rgba(212, 154, 30, 0); }
}

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-mute);
  animation: bounce 1.2s infinite; display: block;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.chat-in { border-top: 1px solid var(--border); padding: 12px 14px; background: var(--surface); }
.chat-in form { display: flex; gap: 10px; align-items: flex-end; }
.chat-in textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 13px; font-size: 14.8px; outline: 0; background: var(--bg);
  max-height: 140px; line-height: 1.55;
}
.chat-in textarea:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(215, 25, 32, .1); }
.send {
  border: 0; background: var(--primary); color: #fff; width: 44px; height: 44px;
  border-radius: 12px; display: grid; place-items: center; flex: none;
}
.send:hover:not(:disabled) { background: var(--navy-700); }
.send:disabled { opacity: .45; cursor: not-allowed; }
.send svg { width: 19px; height: 19px; }

.sugg { display: flex; flex-direction: column; gap: 8px; }
.sugg button {
  text-align: left; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 10px 12px; font-size: 13.4px; color: var(--text-soft);
  line-height: 1.5; transition: all .15s;
}
.sugg button:hover { border-color: var(--navy-600); color: var(--primary); }

.ai-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  color: var(--text-mute); background: var(--ink-100); padding: 2px 8px; border-radius: 999px;
  margin-top: 10px;
}

/* ---------- đăng nhập ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 460px at 85% -10%, rgba(255, 201, 40, .2), transparent 60%),
    radial-gradient(760px 440px at 0% 110%, rgba(215, 25, 32, .1), transparent 55%),
    radial-gradient(600px 380px at 100% 100%, rgba(240, 74, 35, .1), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 34px 30px 26px;
  box-shadow: var(--shadow-lg); text-align: center;
  border-top: 4px solid transparent;
  background-clip: padding-box; position: relative;
}
.login-card::before {
  content: ""; position: absolute; top: -4px; left: -1px; right: -1px; height: 4px;
  border-radius: 20px 20px 0 0;
  background: var(--brand-stripe);
}
.login-logo { width: 120px; height: auto; margin: 0 auto 12px; display: block; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.3px; }
.login-sub { margin: 0 0 22px; font-size: 13.5px; color: var(--text-soft); line-height: 1.6; }
.login-label {
  display: block; text-align: left; font-size: 12.5px; font-weight: 650;
  color: var(--text-soft); margin: 13px 0 5px;
}
.login-input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; font-size: 15px; outline: 0; background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(215, 25, 32, .11); }
.login-err {
  margin-top: 14px; padding: 10px 12px; border-radius: 9px; font-size: 13.5px;
  background: var(--accent-soft); color: var(--accent); text-align: left;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(196, 22, 28, .2);
}
.login-err svg { width: 16px; height: 16px; flex: none; }
.login-btn {
  width: 100%; margin-top: 18px; border: 0; border-radius: 11px;
  background: var(--action-gradient); color: #fff; font-weight: 700; font-size: 15.5px;
  padding: 13px; transition: filter .15s, box-shadow .15s;
  box-shadow: 0 6px 18px rgba(215, 25, 32, .28);
}
.login-btn:hover:not(:disabled) { filter: brightness(1.07); box-shadow: var(--shadow-focus); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; }
.login-help { margin: 18px 0 0; font-size: 12px; color: var(--text-mute); line-height: 1.7; }

/* ---------- user chip ---------- */
.user-chip {
  display: flex; align-items: center; gap: 8px; max-width: 190px;
  background: rgba(255, 255, 255, .12); border-radius: 999px;
  padding: 5px 13px 5px 6px; margin-left: 4px;
}
.user-ava {
  width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--navy-800);
  display: grid; place-items: center; flex: none;
}
.user-ava svg { width: 15px; height: 15px; }
.user-name {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-caret { display: grid; place-items: center; flex: none; opacity: .75; }
.user-caret svg { width: 13px; height: 13px; }

/* ---------- quản trị ---------- */
.admin-bar { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.admin-count { color: var(--text-mute); font-size: 13.5px; }
.admin-flash {
  margin: 0 0 14px; padding: 11px 15px; border-radius: 10px; font-size: 14px; font-weight: 550;
}
.admin-flash.ok { background: #e7f6ec; color: #15803d; border: 1px solid #bbe5c8; }
html[data-theme="dark"] .admin-flash.ok { background: #10291a; color: #6fd394; border-color: #1e4d30; }
.admin-flash.bad { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(196, 22, 28, .25); }
.admin-form { margin-bottom: 18px; }
.admin-form h4 { margin-bottom: 14px; }
.af-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 13px; margin-bottom: 13px; }
.af-field label {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--text-soft); margin-bottom: 5px;
}
.af-select { width: 100%; padding: 10px 11px; }
.af-groups { display: flex; flex-wrap: wrap; gap: 8px; }
.af-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--text-mute); }
.af-actions { display: flex; gap: 10px; margin-top: 16px; }
.af-actions .btn { width: auto; padding: 11px 22px; }
.af-actions .btn + .btn { margin-top: 0; }
.admin-tbl { background: var(--surface); }
.admin-tbl .pill { margin: 1px 2px 1px 0; display: inline-block; }
.admin-acts { white-space: nowrap; }
.admin-acts .link-btn { margin-right: 12px; }
.link-btn.danger { color: var(--accent); }

/* ---------- tải lên + cấu hình ---------- */
.tag-scan {
  font-size: 11px; font-weight: 700; letter-spacing: .4px;
  background: linear-gradient(90deg, #ffe06a, #ffc928);
  color: #6d4a00; padding: 3px 8px; border-radius: 6px;
}
.dropzone {
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  border: 2px dashed var(--ink-300); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--navy-600); background: var(--primary-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--navy-600); background: var(--primary-soft); }
.dropzone input { display: none; }
.dropzone svg { width: 30px; height: 30px; color: var(--primary); flex: none; }
.dropzone b { display: block; font-size: 14.5px; }
.dropzone span { font-size: 12.5px; color: var(--text-mute); }
.af-ta { resize: vertical; font-family: inherit; line-height: 1.6; }
.af-field em { color: var(--accent); font-style: normal; }
.af-grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.af-check {
  display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 12px;
  font-size: 13.5px; color: var(--text-soft); line-height: 1.55; cursor: pointer;
}
.af-check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--navy-700); flex: none; }
.btn-danger { color: var(--accent); border-color: rgba(196, 22, 28, .35); }
.btn-danger:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.scan-only {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--primary-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.scan-only > svg { width: 38px; height: 38px; color: var(--accent); flex: none; }
.scan-only b { font-size: 15.5px; }
.scan-only p { margin: 6px 0 12px; color: var(--text-soft); }
.up-ok { background: #e7f6ec; color: #15803d; }
html[data-theme="dark"] .up-ok { background: #10291a; color: #6fd394; }

.tabbar { display: flex; gap: 8px; margin: 2px 0 18px; border-bottom: 1px solid var(--border); }
.tab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: none; color: var(--text-mute);
  font-size: 14.5px; font-weight: 600; padding: 10px 14px 12px;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tab-btn svg { width: 17px; height: 17px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.on { color: var(--primary); border-bottom-color: var(--primary); }

.cfg-row { display: flex; gap: 9px; align-items: center; margin-bottom: 9px; }
.cfg-row .login-input { flex: 1; }
.cfg-row-3 { flex-wrap: wrap; }
.cfg-row-3 .login-input:first-child { flex: 1.2; min-width: 160px; }
.cfg-row-3 .login-input:nth-child(2) { flex: 2; min-width: 200px; }
.cfg-id {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px;
  color: var(--text-mute); background: var(--ink-100); border-radius: 6px;
  padding: 4px 8px; flex: none;
}
.cfg-del {
  width: 38px; height: 38px; flex: none; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-mute); display: grid; place-items: center;
}
.cfg-del:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.cfg-del svg { width: 16px; height: 16px; }
.cfg-lock { width: 38px; height: 38px; flex: none; display: grid; place-items: center; color: var(--text-mute); }
.cfg-lock svg { width: 16px; height: 16px; }
.cfg-add { width: auto; padding: 10px 18px; flex: none; }

/* ---------- footer ---------- */
.ftr {
  flex: none; border-top: 1px solid var(--border); background: var(--surface);
  padding: 22px 0; font-size: 13px; color: var(--text-mute);
  position: relative;
}
.ftr::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px;
  background: var(--brand-stripe);
}
.ftr-in { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.ftr-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ftr-brand img { width: 46px; height: auto; flex: none; }
.ftr-brand b { display: block; color: var(--text-soft); font-size: 12.5px; letter-spacing: .2px; }
.ftr-brand span { font-size: 12px; font-style: italic; color: var(--red-600); }
html[data-theme="dark"] .ftr-brand span { color: var(--accent); }
.ftr-contact { text-align: right; display: flex; flex-direction: column; gap: 2px; }

/* ---------- back to top ---------- */
.backtop {
  position: fixed; right: 22px; bottom: 108px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-lg);
  animation: fadeUp .22s ease-out;
  transition: transform .15s, background .15s;
}
.backtop:hover { transform: translateY(-3px); background: var(--navy-700); }
.backtop svg { width: 20px; height: 20px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- page transition ---------- */
.fade-in { animation: pageIn .28s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .fade-in, .backtop { animation: none; }
}

/* ---------- utilities ---------- */
.h4-gap { margin-top: 22px !important; }
.dl-flush { margin: 0; }
.tagwrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tagwrap .pill { cursor: pointer; }
.tagwrap .pill:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.hero-tight { padding-bottom: 14px; }
.panel-note { margin: 0; font-size: 13.2px; color: var(--text-soft); line-height: 1.65; }

/* ---------- bottom nav (mobile) ---------- */
.mnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
  background: var(--nav-gradient);
  border-top: 1px solid rgba(255, 201, 40, .4);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  gap: 6px;
  box-shadow: 0 -8px 24px rgba(109, 12, 18, .32);
}
.mnav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px solid transparent; border-radius: 12px; background: transparent;
  color: rgba(255, 255, 255, .78); padding: 7px 4px 6px;
  font-size: 11.5px; font-weight: 600; text-decoration: none;
  transition: all .15s; min-width: 0;
}
.mnav-btn svg { width: 21px; height: 21px; }
.mnav-btn:hover { text-decoration: none; color: #fff; }
.mnav-btn.on {
  color: #ffc928;
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 201, 40, .75);
}
.mnav-veil {
  position: fixed; inset: 0; z-index: 74;
  background: rgba(8, 15, 28, .45);
  animation: pvIn .16s ease-out;
}
.mnav-sheet {
  position: fixed; left: 12px; right: 12px; z-index: 76;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 8px;
  animation: pwa-in .22s ease-out;
}
.mnav-user {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.mnav-ava {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--navy-50); color: var(--navy-600);
  display: grid; place-items: center;
}
.mnav-ava svg { width: 20px; height: 20px; }
.mnav-uinf { min-width: 0; }
.mnav-uinf b { display: block; font-size: 14.5px; }
.mnav-uinf span { font-size: 12.5px; color: var(--text-mute); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mnav-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: none; color: var(--text);
  padding: 11px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 550;
  text-align: left;
}
.mnav-item svg { width: 18px; height: 18px; color: var(--navy-600); }
.mnav-item:hover { background: var(--ink-100); }
.mnav-item.danger { color: var(--accent); }
.mnav-item.danger svg { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .doc-layout, .ask-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .side-hide-mobile { display: none; }
  .fb-applied { margin-left: 0; width: 100%; }
}
@media (max-width: 720px) {
  html, body { font-size: 14.5px; }
  .wrap { padding: 0 14px; }
  .brand-t2 { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-mark img { width: 33px; }
  /* điều hướng chuyển xuống bottom nav — header chỉ giữ logo + đổi giao diện */
  .nav-btn, .user-chip, .nav > .icon-btn[title="Đăng xuất"], .login-corner-btn { display: none; }
  .main { padding-bottom: 96px; }
  .hero { padding-top: 24px; padding-bottom: 18px; }
  .hero h1 { font-size: 22px; }
  /* thẻ thống kê vuốt ngang */
  .hero-stats {
    flex-wrap: nowrap; overflow-x: auto; margin-inline: -14px; padding: 2px 14px 8px;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hero-stats::-webkit-scrollbar { display: none; }
  .stat { flex: none; width: 172px; scroll-snap-align: start; }
  .sb-keys { display: none; }
  .sb-go span { display: inline; }
  .sb-go { padding: 11px 16px; }
  /* bộ lọc thu gọn sau nút "Bộ lọc" */
  .fb-toggle { display: inline-flex; }
  .fb-fields { display: none; width: 100%; }
  .fb-fields.open { display: flex; }
  .fsel { width: 100%; }
  .fsel select { width: 100%; max-width: none; flex: 1; }
  .fb-reset { width: 100%; justify-content: center; }
  .fb-applied { margin-left: 0; width: 100%; }
  .result-line b { font-size: 17px; }
  .rl-sort select { max-width: 130px; }
  .mnav { display: flex; }
  .doc-hd-top { flex-direction: column; align-items: center; text-align: center; }
  .doc-hd-left { max-width: 100%; flex-direction: column; gap: 6px; }
  .doc-hd-right { max-width: 100%; }
  .ct-corner img { width: 70px; height: 70px; }
  .ftr { padding-bottom: 88px; }
  .ftr-contact { text-align: left; }
  .backtop { right: 14px; bottom: 168px; }
  .pv-overlay { padding: 0; }
  .pv { border-radius: 0; max-width: none; }
  .pv-fit { display: none; }
  .pv-title { font-size: 12.5px; }
  .pv-body { padding: 10px; }
  .grid { grid-template-columns: 1fr; }
  .doc-hd, .doc-body { padding-left: 16px; padding-right: 16px; }
  .doc-kind { font-size: 21px; }
  .fulltext { font-size: 15px; }
  .bubble { max-width: 88%; }
  .kv dt { width: 92px; }
}
/* ---------- kiểm tra trùng (admin) ---------- */
.dup-parsed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; }
.dup-results { margin-top: 14px; }
.dup-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.dup-card {
  border: 1px solid var(--ink-200); border-radius: var(--radius);
  padding: 12px 14px; background: var(--surface);
}
.dup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.dup-title { font-weight: 600; margin: 4px 0 6px; color: var(--ink-900); }
.dup-reason { font-size: 12.5px; color: var(--ink-600); margin: 4px 0 8px; }
.dup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; }
.dup-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  padding: 2px 6px; border-radius: 4px; background: var(--ink-100); color: var(--ink-700);
}
.dup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--ink-200); font-size: 13px; }
.dup-row:first-of-type { border-top: 0; }
.dup-badge {
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; color: #fff;
}
.dup-badge.dup-ok  { background: #16a34a; }
.dup-badge.dup-mid { background: #d97706; }
.dup-badge.dup-low { background: #64748b; }
.dup-scan-block { margin-top: 14px; }
.ai-sub { font-style: normal; opacity: .75; font-size: 12px; }
.cbot-cursor { display: inline-block; color: var(--primary); animation: cbot-blink 1s steps(1) infinite; margin-left: 1px; font-weight: 700; }
@keyframes cbot-blink { 50% { opacity: 0; } }

/* Markdown trong câu trả lời AI */
.mkh { font-weight: 700; margin: 8px 0 4px; color: var(--ink-900); }
.mkh-1 { font-size: 16px; }
.mkh-2 { font-size: 15px; }
.mkh-3, .mkh-4 { font-size: 14px; opacity: .9; }
.mkl { margin: 6px 0; padding-left: 20px; }
.mkl li { margin: 3px 0; }
.cbot-bubble strong, .bubble strong { color: var(--primary); font-weight: 700; }
.cbot-bubble code, .bubble code {
  background: var(--ink-100); padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}
.cbot-bubble p, .bubble p { margin: 4px 0; }

/* ---------- PWA install banner ---------- */
.pwa-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 20px; z-index: 80;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px; border-radius: 14px;
  background: var(--surface); color: var(--ink-900);
  box-shadow: 0 12px 28px rgba(0,0,0,.22), 0 4px 10px rgba(0,0,0,.1);
  max-width: min(560px, calc(100vw - 24px));
  animation: pwa-in .3s ease-out;
  border: 1px solid var(--ink-200);
}
@keyframes pwa-in { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.pwa-ico { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.pwa-txt { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; }
.pwa-txt b { display: block; font-size: 14px; color: var(--ink-900); margin-bottom: 2px; }
.pwa-txt span { color: var(--ink-600); }
.pwa-btn {
  flex: none; padding: 8px 14px; border-radius: 10px; border: 0;
  background: var(--primary); color: #fff; font-weight: 600; cursor: pointer; font-size: 13px;
}
.pwa-btn:hover { background: var(--navy-600); }
.pwa-x {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent;
  color: var(--ink-500); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pwa-x svg { width: 16px; height: 16px; }
.pwa-x:hover { background: var(--ink-100); }
@media (max-width: 720px) {
  .pwa-banner { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); padding: 8px 10px; }
  .pwa-ico { width: 38px; height: 38px; }
}

/* ---------- chatbot nổi ---------- */
.cbot-launcher {
  position: fixed; right: 22px; bottom: 24px; z-index: 70;
  width: 68px; height: 68px; border-radius: 50%; border: 0; padding: 0;
  background: transparent; cursor: pointer;
  box-shadow: 0 12px 28px rgba(215, 25, 32, .4), 0 4px 10px rgba(0,0,0,.15);
  transition: transform .18s ease, box-shadow .18s ease;
  animation: cbot-pulse 2.4s ease-in-out infinite;
}
.cbot-launcher:hover { transform: translateY(-3px) scale(1.04); }
.cbot-launcher.on { animation: none; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.cbot-launcher img { width: 100%; height: 100%; border-radius: 50%; display: block; object-fit: cover; }
.cbot-dot {
  position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid var(--surface);
}
@keyframes cbot-pulse {
  0%,100% { box-shadow: 0 12px 28px rgba(215, 25, 32, .4), 0 0 0 0 rgba(255, 201, 40, .6); }
  50%     { box-shadow: 0 12px 28px rgba(215, 25, 32, .4), 0 0 0 14px rgba(255, 201, 40, 0); }
}

.cbot-box {
  position: fixed; right: 22px; bottom: 104px; z-index: 71;
  width: 400px; max-width: calc(100vw - 32px); height: min(560px, calc(100vh - 160px));
  background: var(--surface); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 48px rgba(0,0,0,.28), 0 8px 20px rgba(0,0,0,.15);
  display: flex; flex-direction: column;
  animation: cbot-in .22s ease-out;
}
@keyframes cbot-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.cbot-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--nav-gradient);
  color: #fff;
  border-bottom: 2px solid var(--gold-500);
}
.cbot-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #fff; }
.cbot-title { font-weight: 700; font-size: 14.5px; line-height: 1.2; }
.cbot-sub { font-size: 11.5px; opacity: .85; margin-top: 2px; }
.cbot-head > div:nth-child(2) { flex: 1; min-width: 0; }
.cbot-icon {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: rgba(255,255,255,.14);
  color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex: none; padding: 0;
}
.cbot-icon svg { width: 16px; height: 16px; }
.cbot-icon:hover { background: rgba(255,255,255,.24); }
.cbot-close { background: rgba(255,255,255,.2); }

.cbot-log {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}
.cbot-welcome { font-size: 13.5px; color: var(--ink-700); background: var(--surface); padding: 12px; border-radius: 12px; }
.cbot-tips { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cbot-tip {
  text-align: left; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--ink-200);
  background: var(--surface); color: var(--primary); font-size: 13px; cursor: pointer;
}
.cbot-tip:hover { background: var(--primary-soft); border-color: var(--primary); }
.cbot-hint { margin-top: 10px; font-size: 12.5px; color: var(--ink-600); }

.cbot-msg { display: flex; }
.cbot-msg.me { justify-content: flex-end; }
.cbot-bubble {
  max-width: 84%; padding: 9px 12px; border-radius: 14px; background: var(--surface);
  font-size: 14px; line-height: 1.55; color: var(--ink-900);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  white-space: pre-wrap; word-wrap: break-word;
}
.cbot-msg.me .cbot-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.cbot-msg.bot .cbot-bubble { border-bottom-left-radius: 4px; }

.cbot-cites { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cbot-cite {
  display: flex; flex-direction: column; padding: 6px 10px; border-radius: 8px;
  background: var(--primary-soft); text-decoration: none; color: var(--primary);
  border: 1px solid transparent;
}
.cbot-cite:hover { border-color: var(--primary); }
.cbot-cite-no { font-weight: 700; font-size: 12.5px; }
.cbot-cite-ty { font-size: 12px; color: var(--ink-700); }

.cbot-input {
  display: flex; align-items: flex-end; gap: 6px; padding: 10px; background: var(--surface);
  border-top: 1px solid var(--ink-200);
}
.cbot-ta {
  flex: 1; border: 1px solid var(--ink-300); border-radius: 12px; padding: 10px 12px;
  font-size: 14px; background: var(--bg); color: var(--ink-900); resize: none;
  max-height: 100px; min-height: 42px; font-family: inherit;
}
.cbot-ta:focus { outline: none; border-color: var(--primary); }
.cbot-mic, .cbot-send {
  width: 42px; height: 42px; flex: none; border-radius: 12px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.cbot-mic { background: var(--ink-100); color: var(--ink-700); }
.cbot-mic:hover { background: var(--ink-200); }
.cbot-mic.rec { background: #dc2626; color: #fff; animation: cbot-pulse-red 1s ease-in-out infinite; }
@keyframes cbot-pulse-red {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.6); }
  50%     { box-shadow: 0 0 0 10px rgba(220,38,38,0); }
}
.cbot-send { background: var(--primary); color: #fff; }
.cbot-send:disabled { opacity: .4; cursor: not-allowed; }
.cbot-mic svg, .cbot-send svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
  .cbot-launcher { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 58px; height: 58px; }
  .cbot-box { right: 14px; bottom: calc(152px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 28px); height: min(62vh, calc(100vh - 190px)); }
}
.dup-mt-8 { margin-top: 8px; }
.dup-mt-12 { margin-top: 12px; }

/* ================= Sổ tay Nội quy Lao động ================= */

.hb-progress-line { display: flex; align-items: center; gap: 12px; margin-top: 16px; max-width: 520px; }
.hb-progress-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--ink-200); overflow: hidden; }
.hb-progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-600), var(--gold-500)); transition: width .4s ease; }
.hb-progress-line span { font-size: 13px; font-weight: 650; color: var(--text-soft); white-space: nowrap; }
.hb-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.hb-meta-it {
  background: rgba(255, 254, 250, .85); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 12px; font-size: 12.5px;
}
.hb-meta-it b { display: block; color: var(--navy-700); font-weight: 700; }
.hb-meta-it span { color: var(--text-soft); }

.hb-toc-toggle {
  display: none; align-items: center; gap: 8px; margin: 4px 0 14px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 9px 14px; font-size: 14px; font-weight: 600; color: var(--navy-700);
}
.hb-toc-toggle svg { width: 16px; height: 16px; }

.hb-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; align-items: start; }
.hb-toc {
  position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow-sm);
}
.hb-toc-head { display: none; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hb-toc-group { margin-bottom: 14px; }
.hb-toc-gname {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .3px; color: var(--text-mute); padding: 0 8px 6px; border-bottom: 1px solid var(--border); margin-bottom: 5px;
}
.hb-toc-gname svg { width: 13px; height: 13px; color: var(--gold-600); }
.hb-toc-link {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  padding: 7px 8px; border-radius: 8px; font-size: 13.5px; line-height: 1.4;
}
.hb-toc-link:hover { background: var(--ink-100); }
.hb-toc-link.on { background: var(--navy-50); color: var(--navy-700); font-weight: 650; }
html[data-theme="dark"] .hb-toc-link.on { background: var(--primary-soft); color: var(--primary); }
.hb-toc-veil { display: none; }

.hb-sec { padding: 22px 24px; margin-bottom: 16px; }
.hb-sec-kicker { font-size: 12px; font-weight: 700; color: var(--gold-600); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.hb-sec h2 { margin: 0 0 14px; font-size: 19px; color: var(--navy-800); }
html[data-theme="dark"] .hb-sec h2 { color: var(--text); }
.hb-body { font-size: 14.5px; line-height: 1.7; color: var(--text); }
.hb-body .rule-list { margin: 0 0 14px; padding-left: 20px; }
.hb-body .rule-list li { margin: 7px 0; }
.hb-body .sub-title { font-size: 14.5px; font-weight: 700; margin: 18px 0 8px; color: var(--navy-700); }
html[data-theme="dark"] .hb-body .sub-title { color: var(--primary); }
.hb-body .ref-table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 13.3px; }
.hb-body .ref-table th, .hb-body .ref-table td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; vertical-align: top; }
.hb-body .ref-table th { background: var(--ink-100); font-weight: 700; }
.hb-body .fine, .hb-body .fine-cell { color: var(--accent); font-weight: 700; }
.hb-body .note { margin: 14px 0; padding: 11px 15px; border-radius: var(--radius-sm); background: var(--ink-100); font-size: 13.5px; }
.hb-body .note.warn { background: var(--accent-soft); border: 1px solid rgba(215, 25, 32, .2); }
.hb-body .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.hb-body p { margin: 0 0 10px; }
.hb-group { margin-bottom: 8px; }
.hb-footer { margin: 26px 0 10px; padding: 18px 22px; text-align: center; color: var(--text-mute); font-size: 13px; }
.hb-seal { font-style: italic; margin: 0 0 8px; }

/* ---- trắc nghiệm cuối mỗi nhóm chương ---- */
.hbq {
  margin: 4px 0 22px; padding: 20px 24px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #fff6dd 0%, #fdf0e4 100%);
  border: 1px solid rgba(212, 154, 30, .4); box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .hbq { background: linear-gradient(135deg, #2c2214 0%, #241a12 100%); border-color: rgba(238, 189, 78, .3); }
.hbq.hbq-ok { background: #e4f7ec; border-color: rgba(23, 128, 61, .35); }
html[data-theme="dark"] .hbq.hbq-ok { background: #0f3322; border-color: rgba(79, 206, 139, .3); }
.hbq-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; color: var(--navy-700); }
html[data-theme="dark"] .hbq-head { color: var(--gold-500); }
.hbq.hbq-ok .hbq-head { color: #17803d; }
html[data-theme="dark"] .hbq.hbq-ok .hbq-head { color: #4fce8b; }
.hbq-head svg { width: 19px; height: 19px; color: var(--gold-600); flex: none; }
.hbq.hbq-ok .hbq-head svg { color: #17803d; }
html[data-theme="dark"] .hbq.hbq-ok .hbq-head svg { color: #4fce8b; }
.hbq-head b { font-size: 14.5px; }
.hbq-q { margin-bottom: 16px; }
.hbq-qtext { margin: 0 0 9px; font-weight: 650; font-size: 14px; }
.hbq-opts { display: flex; flex-direction: column; gap: 7px; }
.hbq-opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 10px 13px; font-size: 13.8px; transition: all .14s;
}
.hbq-opt:hover { border-color: var(--navy-600); }
.hbq-opt-mark { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-300); flex: none; transition: all .14s; }
.hbq-opt.sel { border-color: var(--navy-600); background: var(--navy-50); }
html[data-theme="dark"] .hbq-opt.sel { background: var(--primary-soft); }
.hbq-opt.sel .hbq-opt-mark { border-color: var(--navy-600); background: var(--navy-600); }
.hbq-opt.good { border-color: #17803d; background: #e4f7ec; }
.hbq-opt.good .hbq-opt-mark { border-color: #17803d; background: #17803d; }
.hbq-opt.bad { border-color: var(--accent); background: var(--accent-soft); }
.hbq-opt.bad .hbq-opt-mark { border-color: var(--accent); background: var(--accent); }
.hbq-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.hbq-fail { color: var(--accent); font-size: 13px; font-weight: 600; }
.hbq-passed-note { margin: 0; font-size: 13.5px; color: #17803d; font-weight: 600; }
html[data-theme="dark"] .hbq-passed-note { color: #4fce8b; }

/* ---- quản trị sổ tay ---- */
.hb-subtabs { margin-bottom: 16px; }
.hb-secform { margin-bottom: 14px; }
.hb-body-ta { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.hb-savebar { border: 0; background: transparent; padding: 12px 0; justify-content: flex-end; }
.hb-quizgroup { margin-bottom: 14px; }
.hb-quizgroup h4 { margin: 0 0 12px; }
.hb-qedit { padding: 12px 0; border-top: 1px dashed var(--border); }
.hb-qedit:first-of-type { border-top: 0; padding-top: 0; }
.hb-optedit { display: flex; flex-direction: column; gap: 7px; margin: 8px 0; }
.hb-optrow { display: flex; align-items: center; gap: 8px; }
.hb-optrow input[type="radio"] { width: 16px; height: 16px; flex: none; accent-color: var(--navy-700); }
.hb-optrow .login-input { flex: 1; padding: 8px 10px; }
.hb-quizgroup-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.hb-progress-summary { display: flex; gap: 26px; padding: 16px 22px; margin-bottom: 14px; }
.hb-progress-summary div { text-align: center; }
.hb-progress-summary b { display: block; font-size: 22px; font-weight: 750; }
.hb-progress-summary span { font-size: 12px; color: var(--text-mute); }
.pill-toggle-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-soft); cursor: pointer; }
.pill-toggle-wrap input { width: 16px; height: 16px; accent-color: var(--navy-700); }

@media (max-width: 1000px) {
  .hb-layout { grid-template-columns: 1fr; }
  .hb-toc-toggle { display: inline-flex; }
  .hb-toc {
    display: none; position: fixed; z-index: 95; inset: 0 18% 0 0; top: 0; height: 100vh;
    max-height: 100vh; border-radius: 0; box-shadow: 0 0 40px rgba(0, 0, 0, .3);
  }
  .hb-toc.open { display: block; }
  .hb-toc-head { display: flex; }
  .hb-toc-veil { display: block; position: fixed; inset: 0; z-index: 94; background: rgba(8, 15, 28, .5); }
}
@media (max-width: 640px) {
  .hb-toc { inset: 0 8% 0 0; }
  .hb-sec { padding: 18px 16px; }
  .hb-body .two-col { grid-template-columns: 1fr; }
  .hb-progress-summary { gap: 16px; padding: 14px; }
  .hbq { padding: 16px; }
}

@media print {
  .hdr, .ftr, .side, .toolbar, .crumb, .note, .pv-overlay, .backtop, .ct-corner, .kvs, .mnav { display: none !important; }
  .doc { border: 0; box-shadow: none; }
  .doc-layout { display: block; }
}

/* ================= Gửi email cho nhân sự ================= */

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-ghost:hover:not(:disabled) { background: var(--ink-100); border-color: var(--accent); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost.sm { padding: 5px 10px; font-size: 13px; }
.btn-ghost.sm svg { width: 15px; height: 15px; }
.btn-ghost.danger:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }

.muted { color: var(--text-soft); }
.sm { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.ta-right { text-align: right; white-space: nowrap; }
.ok-txt { color: #17803d; font-weight: 650; }
.bad-txt { color: var(--accent); font-weight: 650; }
html[data-theme="dark"] .ok-txt { color: #4ade80; }
table.tbl tbody tr.row-off td { opacity: .5; }

.pill-toggle {
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--ink-100); color: var(--text-soft);
  cursor: pointer; font-family: inherit;
}
.pill-toggle.on { background: rgba(23,128,61,.12); border-color: rgba(23,128,61,.35); color: #17803d; }
html[data-theme="dark"] .pill-toggle.on { color: #4ade80; }

.mail-wrap { display: flex; flex-direction: column; gap: 16px; }
.mail-panel { padding: 18px 20px; }
.mail-panel h4 {
  margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px;
}
.mail-panel h4 svg { width: 17px; height: 17px; color: var(--accent); }
.mail-panel .af-field { margin-bottom: 12px; }

.mail-badge {
  margin-left: auto; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 650;
}

.mail-doc-picked {
  display: flex; align-items: flex-start; gap: 12px; justify-content: space-between;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid rgba(230,76,25,.25);
}
.mail-doc-hits { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.mail-doc-hit {
  text-align: left; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
  font: inherit; font-size: 13.5px; line-height: 1.5;
}
.mail-doc-hit:hover { border-color: var(--accent); background: var(--ink-100); }
.mail-doc-hit b { color: var(--accent); margin-right: 6px; }

.mail-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; cursor: pointer; }
.mail-check input { width: 16px; height: 16px; accent-color: var(--accent); }

.mail-recip-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.mail-recip-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px;
  max-height: 280px; overflow-y: auto; padding: 4px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.mail-recip {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px;
}
.mail-recip:hover { background: var(--ink-100); }
.mail-recip.on { background: var(--accent-soft); }
.mail-recip input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.mail-recip span { display: flex; flex-direction: column; min-width: 0; }
.mail-recip small { color: var(--text-soft); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mail-ta {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; resize: vertical; box-sizing: border-box;
}
.mail-ta:focus { outline: none; border-color: var(--accent); }

.mail-import { padding: 16px 20px; margin: 16px 0; }
.mail-import h4 { margin: 0 0 6px; font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.mail-import h4 svg { width: 16px; height: 16px; color: var(--accent); }
.mail-import p { margin: 0 0 10px; font-size: 13px; }
.mail-import code { background: var(--ink-100); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.mail-import .mail-ta { margin-bottom: 10px; }

.mail-prev { margin-top: 10px; }
.mail-prev summary { cursor: pointer; font-size: 13.5px; color: var(--accent); font-weight: 600; }
.mail-prev-body {
  margin-top: 10px; padding: 14px 16px; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); background: var(--ink-50); font-size: 14px; line-height: 1.65;
}
.mail-prev-body p { margin: 0 0 10px; }
.mail-prev-body a { color: var(--accent); }

.mail-send-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mail-send-bar .sb-go { display: inline-flex; align-items: center; gap: 8px; }
.mail-send-bar .sb-go svg { width: 17px; height: 17px; }

@media (max-width: 640px) {
  .mail-recip-list { grid-template-columns: 1fr; max-height: 320px; }
  .mail-doc-picked { flex-direction: column; }
}
.mail-search { max-width: 320px; }
.mail-select { max-width: 220px; }
.mail-extra { margin-top: 10px; }

/* ---------- sửa thông báo (admin) ---------- */
body.no-scroll { overflow: hidden; }
.ded-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(28, 10, 10, .55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; animation: pvIn .18s ease-out;
}
.ded {
  width: 100%; max-width: 760px; max-height: calc(100vh - 36px);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; overflow: hidden;
}
.ded-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--nav-gradient); color: #fff;
  border-bottom: 2px solid var(--gold-500);
}
.ded-title { flex: 1; min-width: 0; }
.ded-title b { display: block; font-size: 15.5px; }
.ded-title span { font-size: 12.5px; opacity: .85; }
.ded-x { background: rgba(255, 255, 255, .18); }
.ded-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.ded-body .af-field { margin-bottom: 13px; }
.ded-body .af-field label {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--text-soft); margin-bottom: 5px;
}
.ded-body .af-field em { color: var(--accent); font-style: normal; }
.ded-fulltext { font-family: var(--serif); font-size: 14.5px; line-height: 1.7; }
.ded-pub {
  margin-top: 4px; padding: 13px 15px; border-radius: var(--radius-sm);
  background: #fff6dd; border: 1px solid rgba(212, 154, 30, .45);
}
html[data-theme="dark"] .ded-pub { background: #362b10; border-color: rgba(238, 189, 78, .4); }
.ded-pub .af-check { margin: 0; }
.ded-pub-link {
  margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.ded-pub-link code {
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 10px; font-size: 12px; word-break: break-all;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.ded-pub-hint { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.ded-foot {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--border); background: var(--ink-50);
}
html[data-theme="dark"] .ded-foot { background: var(--ink-100); }
.ded-foot-sp { flex: 1; }
.ded-foot .sb-go { padding: 10px 20px; }
.ded-search { max-width: 420px; }
.pill-pub {
  background: #e4f7ec; color: #147a42; font-weight: 650;
}
html[data-theme="dark"] .pill-pub { background: #0f3322; color: #4fce8b; }
.pub-on { color: #147a42 !important; }
html[data-theme="dark"] .pub-on { color: #4fce8b !important; }

/* ---------- chế độ truy cập (gate đăng nhập) ---------- */
.gate-panel h4 { display: flex; align-items: center; gap: 8px; }
.gate-panel h4 svg { width: 16px; height: 16px; color: var(--accent); }
.gate-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.gate-opt {
  text-align: left; display: flex; flex-direction: column; gap: 6px;
  border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 14px 16px; cursor: pointer; transition: all .15s;
}
.gate-opt:hover { border-color: var(--navy-600); }
.gate-opt:disabled { opacity: .6; cursor: not-allowed; }
.gate-opt.on { border-color: var(--navy-600); background: var(--navy-50); box-shadow: 0 0 0 3px rgba(215, 25, 32, .08); }
html[data-theme="dark"] .gate-opt.on { background: var(--primary-soft); }
.gate-opt-t { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14.5px; color: var(--text); }
.gate-opt-t svg { width: 16px; height: 16px; color: var(--navy-600); flex: none; }
.gate-opt.on .gate-opt-t svg { color: var(--accent); }
.gate-opt-d { font-size: 12.8px; color: var(--text-soft); line-height: 1.5; }

/* ---------- công khai hàng loạt ---------- */
.bulk-pub-panel { margin-bottom: 14px; }
.bulk-pub-panel h4 { display: flex; align-items: center; gap: 8px; }
.bulk-pub-panel h4 svg { width: 16px; height: 16px; color: var(--accent); }
.bulk-pub-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.bulk-selbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 0 0 12px; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--navy-50); border: 1px solid rgba(215, 25, 32, .25);
}
html[data-theme="dark"] .bulk-selbar { background: var(--primary-soft); }
.bulk-selbar span { font-size: 13.5px; color: var(--text-soft); }
tr.row-sel { background: var(--navy-50); }
html[data-theme="dark"] tr.row-sel { background: var(--primary-soft); }
.admin-tbl thead input[type="checkbox"], .admin-tbl tbody input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--navy-700); cursor: pointer;
}

/* banner xem công khai (chưa đăng nhập) */
.pub-note {
  margin: 0 0 16px; padding: 11px 15px; border-radius: var(--radius-sm);
  background: #fff6dd; border: 1px solid rgba(212, 154, 30, .5);
  color: var(--ink-800); font-size: 13.5px;
}
html[data-theme="dark"] .pub-note { background: #362b10; color: var(--text); border-color: rgba(238, 189, 78, .4); }
.pub-note a { font-weight: 650; }
@media (max-width: 720px) {
  .ded-overlay { padding: 0; }
  .ded { max-width: none; max-height: 100vh; border-radius: 0; }
}

/* ---- Gửi Zalo: thanh tiến độ + chi tiết người nhận trong nhật ký ---- */
.zprog {
  height: 10px; border-radius: 999px; background: var(--ink-50);
  border: 1px solid var(--border); overflow: hidden; margin: 10px 0 8px;
}
.zprog-fill {
  height: 100%; border-radius: 999px; background: var(--accent);
  transition: width .6s ease; min-width: 4px;
}
.zlog-detail td { background: var(--ink-50); }
.zlog-people { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.zlog-person {
  font-size: 12.5px; padding: 3px 10px; border-radius: 999px;
  background: var(--card, #fff); border: 1px solid var(--border); white-space: nowrap;
}
.zlog-person.bad { color: #c0392b; border-color: #c0392b55; }
.zlog-person.wait { opacity: .65; font-style: italic; }
