/* HIL — style của phiên đóng vai. Bám token theme.css; không ghi đè class app.
 *
 * BA BỀ MẶT trên một màn hình (Cường 2026-08-18): bản đồ · TƯƠNG TÁC (.hil-dock) · TRỢ LÝ
 * (.hil-agent + .hil-sheet). Trước đó cả ba nằm trong đúng một hộp `.hil-sheet` 42vh — nút
 * «Nhận cuốc» đứng cạnh ô nhập chat, và bong bóng chat đè giữa bản đồ.
 */

/* ======================= bề mặt TƯƠNG TÁC (kiểu app gọi xe) ======================= */

/* z 605: trên #bottom-nav (600) — cùng luật `.hil-sheet` đang dùng. Đang đóng vai thì nav
 * không thuộc luồng; «Kết phiên» nằm ngay trên dải trạng thái. */
.hil-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 605;
  background: var(--surface-glass, rgba(255, 255, 255, 0.88));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-specular, rgba(255, 255, 255, 0.6));
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: 0 -8px 32px rgba(0, 30, 20, 0.12);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}

/* Dải trạng thái mỏng — LUÔN hiện (Cường chốt: giờ · tiền · pin). Thẻ đầy đủ chỉ trượt lên
 * khi có việc phải quyết, nên lúc rảnh bản đồ gần như trọn màn hình. */
.hil-dock-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  min-height: 32px;
}

.hil-dock-card[hidden] { display: none; }
/* Không có tiêu đề (lúc rảnh) thì không cần vạch ngăn lẫn hiệu ứng trượt — chỉ là hàng nút. */
.hil-dock-card:not(.hil-co-the) { border-top: none; padding-top: 0; margin-top: 6px; animation: none; }
.hil-dock-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-specular, rgba(255, 255, 255, 0.8));
  border-radius: var(--r-card);
  box-shadow: var(--shadow-porcelain);
  animation: hil-truot-len 220ms ease-out;
}
@keyframes hil-truot-len {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.hil-dock-title { font-size: 13px; font-weight: 700; color: var(--text-high, #111827); }
.hil-dock-fact  { font-size: 13px; line-height: 1.45; color: var(--text-high, #111827); }

/* ======================= cột TRỢ LÝ ======================= */

/* Neo vào MÉP TRÊN của dock, không vào đáy màn hình. Nhờ vậy thẻ sự kiện cao bao nhiêu thì bot
 * và bong bóng gợi ý cũng KHÔNG THỂ che nó — bằng cấu trúc, không bằng một hằng số pixel phải
 * chỉnh lại mỗi lần đổi thẻ. Đây là câu trả lời cho yêu cầu "không được che các giao diện
 * khác" (Cường 2026-08-18). */
/* --- 🔴 LUẬT `[hidden]` LÀ BẮT BUỘC CHO MỌI CLASS CÓ `display` ------------------------------
 *
 * Cường 2026-08-22: *"nút mốc điểm bấm 2 lần thì thu gọn lại, còn thưởng theo cuốc (icon dart
 * board) thì bấm không đóng lại được"*.
 *
 * Không phải lỗi JS. Hai handler giống hệt nhau (`bang.hidden = !bang.hidden`). Khác biệt:
 * `.hil-bang-moc[hidden]` **có** luật, `.hil-bang-nv` thì **không** — mà `.hil-bang-nv` đặt
 * `display: flex`, và một luật của tác giả **thắng** `[hidden] { display: none }` của UA
 * stylesheet. Nên `hidden = true` trở thành vô nghĩa.
 *
 * ⚠ Quét chéo "biến JS có set `.hidden`" × "class có `display` mà thiếu `[hidden]`" tìm ra
 * **5** chỗ, không phải một: `.hil-bang-nv` (Cường báo) · `.hil-agent` · `.hil-log` ·
 * `.hil-bento-card` · `.hil-chon-ho-so` (hai cái cuối đến từ redesign của Khánh).
 *
 * ⚠ Cổng cũ `hil-bang-nhiem-vu.mjs` XANH suốt vì nó kiểm **thuộc tính `hidden` trong JS**,
 * còn thứ hỏng là **CSS**. Cổng mới `hil-hidden-css.mjs` quét đúng cặp JS×CSS.
 */
.hil-agent {
  position: absolute;
  right: 14px;
  /* 🔴 `left` là LAN CAN CẤU TRÚC cho bong bóng gợi ý (sửa 2026-08-22, Cường báo lần HAI:
   * *"nút kéo về vị trí tài xế vẫn che mất chat trợ lý bắn ra"*).
   *
   * Lần trước vá bằng `max-width: calc(100vw - 170px)` trên `.hil-peek`. Nó đúng trên điện
   * thoại và **vô hiệu trên desktop**, vì `#shell` là một cột `max-width: 420px` căn giữa —
   * `100vw` đo CỬA SỔ (1280px), không đo khung. Lan can thành `1110px`, tức không có lan can.
   * Đo được: bong bóng x=431..775, nút ⌖ x=445..489 ⇒ **chồng 44px**.
   *
   * `left` neo vào chính dock (cùng hệ toạ độ với `.hil-map-ctl`), nên nó đúng ở MỌI bề rộng
   * cửa sổ mà không cần biết cửa sổ rộng bao nhiêu. 14px lề + 44px nút + 10px thở = 68px. */
  left: 68px;
  bottom: 100%;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;      /* khoảng trống giữa các con không nuốt cú chạm xuống map */
}
.hil-agent[hidden] { display: none; }
.hil-agent > * { pointer-events: auto; }

.hil-fab {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: var(--r-pill);
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  background: var(--accent-kinetic-gradient, linear-gradient(180deg, #00C6EB 0%, #0096C7 100%));
  color: var(--on-accent);
  box-shadow: 0 4px 16px rgba(0, 180, 216, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}

.hil-fab:active {
  transform: scale(0.93);
}

.hil-fab svg {
  display: block;
}

/* Chấm chưa đọc: gợi ý bị hoãn vì màn hình đang bận vẫn phải để lại dấu, nếu không tài xế
 * không bao giờ biết mình đã bỏ lỡ điều gì. */
.hil-fab-cham[hidden] { display: none; }
.hil-fab-cham {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--status-critical);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(208, 59, 59, 0.4);
}

/* Hàng NGANG: bong bóng gợi ý nằm ngang bóng bot chứ không chồng lên trên nó (Cường
 * 2026-08-18). Căn `flex-end` để mũi nhọn của bong bóng chỉ đúng vào giữa bóng bot. */
.hil-agent-hang {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Bong bóng gợi ý chủ động — chỉ bắn khi màn hình rảnh, tự tắt sau ~8s. */
.hil-peek[hidden] { display: none; }
.hil-peek {
  position: relative;
  flex: 1;
  min-width: 0;
  /* Bề rộng do `.hil-agent` (đã neo hai đầu) quyết định — KHÔNG dùng `vw` ở đây nữa: trong
     một shell rộng cố định thì `vw` đo nhầm vật. Xem chú thích `left` ở `.hil-agent`. */
  text-align: left;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-specular, rgba(255, 255, 255, 0.8));
  border-left: 3.5px solid var(--accent, #00AFB9);
  border-radius: var(--r-card);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-high, #111827);
  box-shadow: var(--shadow-porcelain);
  cursor: pointer;
  animation: hil-truot-len 200ms ease-out;
}

/* Mũi nhọn chỉ sang bóng bot: nối LỜI với NGƯỜI NÓI. Không có nó thì một hộp trắng cạnh bản đồ
 * trắng chẳng cho biết ai đang nói — đúng điều Cường bảo phải làm rõ. */
.hil-peek::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  margin-top: -6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid var(--surface, #ffffff);
  filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.06));
}

.hil-peek-dau { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.hil-peek-avatar { display: flex; align-items: center; justify-content: center; }
.hil-peek-ten { font-size: 11px; font-weight: 700; color: var(--accent-hover, #0d9488); }
.hil-peek-goi {
  font-size: 9.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-hover);
}
/* `pre-line` để lời khuyên tách được thành mục. Cường 2026-08-20: *"lời khuyên tách
   thành các mục cho dễ nhìn"*. Một khối bốn câu liền là thứ người ta lướt qua. */
.hil-peek-text { font-weight: 500; white-space: pre-line; }
.hil-peek-nhan { margin-top: 4px; font-size: 10.5px; font-weight: 600; color: var(--accent, #00AFB9); }

/* Bóng bot nhấp nháy nhẹ khi đang có lời khuyên — mắt tài xế bắt được chuyển động ngoại vi
 * nhanh hơn nhiều so với một hộp chữ tĩnh. */
.hil-fab-dang-nhac { animation: hil-nhac 1.6s ease-in-out infinite; }
@keyframes hil-nhac {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 180, 216, 0.4); }
  50% { box-shadow: 0 4px 16px rgba(0, 180, 216, 0.4), 0 0 0 8px rgba(0, 180, 216, 0.22); }
}

@media (prefers-reduced-motion: reduce) {
  .hil-dock-card, .hil-peek { animation: none; }
  .hil-fab-dang-nhac { animation: none; }
}

/* Ô hỏi nhanh — tài xế đang chạy xe KHÔNG gõ phím, nên đây là đường vào chính chứ không phải
 * trang trí. Chỉ đưa câu mà agent trả lời được thật (cổng test_chip_questions_answerable.py). */
.hil-quick[hidden] { display: none; }
.hil-quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 82%;   /* % theo container — `vw` đo cửa sổ, sai trong shell 420px */
}
.hil-sheet .hil-quick { justify-content: flex-start; max-width: none; }
.hil-hoi {
  border: 1px solid var(--border-hairline);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: var(--r-pill);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-float);
}
.hil-sheet .hil-hoi { box-shadow: none; background: var(--surface-subtle); }

/* ======================= bề mặt CHAT ======================= */

/* ⚠ BẮT BUỘC đứng trước khối .hil-sheet: thuộc tính `hidden` chỉ là UA-style
 * `display:none`, và `display:flex` của author ĐÈ nó ⇒ không có dòng này, sheet rỗng
 * hiển thị từ lúc tải trang, phủ nửa màn hình và nuốt mọi cú bấm (bug V-47 Cường bắt
 * 2026-08-14, tái hiện bằng Chromium headless). */
.hil-sheet[hidden] { display: none; }

.hil-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* 40vh base (Cường chốt 2026-08-18) + min-height mở rộng toàn khung nhìn shell */
  height: 40vh;
  min-height: calc(100% - 14px);
  max-height: calc(100% - 14px);
  /* Trên .hil-dock (605) và #bottom-nav (600): mở chat thì chat là bề mặt trên cùng. */
  z-index: 610;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface-liquid-glass, rgba(255, 255, 255, 0.94));
  backdrop-filter: blur(24px) saturate(180%) contrast(1.05);
  -webkit-backdrop-filter: blur(24px) saturate(180%) contrast(1.05);
  border-top: 1px solid var(--border-specular, rgba(255, 255, 255, 0.65));
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-liquid-glass), 0 -12px 40px rgba(0, 30, 20, 0.15);
  transition: height 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* Thu gọn: chỉ còn header — bấm ▾/▴ trên head để liếc bản đồ.
 *
 * 🔴 MERGE 2026-08-22 — `.hil-collapsed` SỐNG LẠI, và lý do nó từng bị xoá đã được sửa ở
 * đúng chỗ gây lỗi.
 *
 * Em xoá nó ngày 2026-08-21 (`5.2` `R3`) vì đo được: các luật dưới đây ẩn `.hil-feed`/
 * `.hil-quick`/`.hil-chat-row`, nhưng `sheetDangMo()` chỉ đọc `sheet.hidden` nên vẫn trả
 * `true` ⇒ `manHinhRanh()` vẫn `false` ⇒ lời khuyên **xếp hàng thay vì pop**. Thu gọn xong
 * thì tài xế vừa mất feed vừa mất bong bóng.
 *
 * Nhưng bẫy ấy nằm ở **JS**, không nằm ở CSS. Xoá trạng thái thu gọn là bỏ một cử chỉ đúng
 * (liếc bản đồ mà không mất mạch hội thoại) để né một lỗi ở chỗ khác. Nay `sheetDangMo()`
 * biết tới `.hil-collapsed`, nên thu gọn = màn hình rảnh = lời khuyên POP.
 */
/* Thu gọn: chỉ còn header — bấm ▾/▴ trên head để liếc bản đồ. */
.hil-sheet.hil-collapsed { height: auto; min-height: 0; }
.hil-sheet.hil-collapsed .hil-feed,
.hil-sheet.hil-collapsed .hil-quick,
.hil-sheet.hil-collapsed .hil-chat-row,
.hil-sheet.hil-collapsed .hil-sheet-offer,
.hil-sheet.hil-collapsed .hil-note { display: none; }


.hil-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0 8px 0;
  border-bottom: 1px solid rgba(0, 180, 216, 0.15);
  flex-shrink: 0;
}
.hil-head-ten {
  flex: 1;
  font-weight: 700;
  color: var(--text-high, #111827);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
.hil-head .hil-collapse-btn,
.hil-head .hil-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border-specular, rgba(255, 255, 255, 0.8));
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}
.hil-head .hil-collapse-btn:hover {
  background: #ffffff;
  color: var(--accent-kinetic);
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}
.hil-head .hil-close-btn:hover {
  background: #ffffff;
  color: var(--status-critical, #e63946);
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(230, 57, 70, 0.35);
}

/* Thẻ cuốc ưu tiên trong màn hình Chat (Priority Dispatch Overlay) */
.hil-sheet-offer {
  background: var(--surface, #ffffff);
  border: 1.5px solid var(--accent-kinetic, #00B4D8);
  border-radius: var(--r-card);
  box-shadow: 0 8px 24px rgba(0, 180, 216, 0.25);
  padding: 12px 14px;
  margin-bottom: 4px;
  animation: hil-offer-glow 2s infinite ease-in-out;
}
@keyframes hil-offer-glow {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 180, 216, 0.25); }
  50% { box-shadow: 0 6px 24px rgba(0, 180, 216, 0.45); }
}
.hil-sheet-offer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.hil-sheet-offer-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent-kinetic);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.hil-sheet-offer-fare {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-kinetic);
  font-variant-numeric: tabular-nums;
}
.hil-sheet-offer-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.hil-sheet-offer-btns {
  display: flex;
  gap: 8px;
}

/* Bubble theo vai + giờ SIM (QĐ-1.d) */
.hil-bubble-meta {
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.hil-stamp { font-variant-numeric: tabular-nums; font-weight: 600; }
.hil-role-user {
  align-self: flex-end;
  background: var(--accent-soft, rgba(0, 175, 185, 0.12));
  border-color: rgba(0, 175, 185, 0.35);
  border-radius: 18px 18px 4px 18px;
}
.hil-role-agent {
  border-left: 3.5px solid var(--accent-kinetic, #00B4D8);
  border-radius: 18px 18px 18px 4px;
}

/* Chat với trợ lý (QĐ-1.c) */
.hil-chat-row { display: flex; gap: 8px; align-items: center; }
.hil-chat-input {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid var(--border-specular);
  border-radius: var(--r-pill);
  background: var(--surface, #ffffff);
  font-size: 13.5px;
  font-family: inherit;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.hil-chat-input:focus {
  outline: none;
  border-color: var(--accent-kinetic);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.18);
}

/* Nút Gửi tinh chỉnh màu Teal dịu mắt (không bị chói lóa neon) */
.hil-chat-row .hil-btn-primary {
  background: linear-gradient(135deg, #0096C7 0%, #0077B6 100%);
  border-color: transparent;
  color: #ffffff;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 12px rgba(0, 150, 199, 0.3);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, background 0.18s ease;
}
.hil-chat-row .hil-btn-primary:hover {
  background: linear-gradient(135deg, #00B4D8 0%, #0096C7 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-cyan);
}
.hil-chat-row .hil-btn-primary:active {
  transform: scale(0.96);
}

.hil-clock { font-weight: 600; color: var(--text-primary); }
.hil-pills {
  flex: 1;
  text-align: center;
  font-weight: 600;
  color: var(--accent-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hil-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.hil-dock > .hil-chips:not(:empty) { margin-top: 6px; }
.hil-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.hil-sev-low { color: var(--text-secondary); }
.hil-sev-medium { color: #7a5a00; background: #fff7e0; border-color: #f2d98c; }
.hil-sev-high { color: #fff; background: var(--status-critical); border-color: transparent; }

.hil-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
}

.hil-bubble {
  max-width: 92%;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-specular, rgba(255, 255, 255, 0.8));
  border-radius: var(--r-card);
  box-shadow: var(--shadow-porcelain);
  padding: 12px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
}
.hil-bubble-text { white-space: normal; }
.hil-bubble-text p { margin: 0 0 6px 0; }
.hil-bubble-text p:last-child { margin-bottom: 0; }
.hil-bubble-text strong, .hil-bubble-text b { font-weight: 700; color: var(--text-high); }
.hil-bubble-text em, .hil-bubble-text i { font-style: italic; }
.hil-bubble-text ul { margin: 4px 0 6px 18px; padding: 0; list-style-type: disc; }
.hil-bubble-text ol { margin: 4px 0 6px 18px; padding: 0; list-style-type: decimal; }
.hil-bubble-text li { margin-bottom: 3px; line-height: 1.45; }

/* Trích dẫn dạng Badge Pill phát sáng [1], [2] */
.hil-cite-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  margin: 0 2px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(0, 180, 216, 0.15);
  color: var(--accent-kinetic, #00B4D8);
  border: 1px solid rgba(0, 180, 216, 0.38);
  cursor: pointer;
  vertical-align: 1px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.hil-cite-pill:hover {
  transform: scale(1.1);
  background: var(--accent-kinetic, #00B4D8);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 180, 216, 0.45);
}

/* Modal Popup Chi tiết Nguồn Trích Dẫn */
.hil-cite-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* `fixed` nên `vw` đúng về kỹ thuật, nhưng modal phải nằm gọn trong khung điện
   * thoại (`#shell` 420px) chứ không tràn ra nền desktop. */
  width: min(340px, 90vw, 92%);
  background: var(--surface);
  border: 1px solid var(--border-specular);
  border-radius: var(--r-card);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 180, 216, 0.25);
  padding: 16px;
  z-index: 700;
  animation: card-in 0.25s ease-out;
}
.hil-cite-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  z-index: 699;
}
.hil-cite-modal-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent-kinetic);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hil-cite-modal-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border-radius: var(--r-chip);
  padding: 10px 12px;
  border: 1px solid var(--border-hairline);
}
.hil-cite-modal-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
}

.hil-bubble-badge {
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--viz-rest);
}

/* Ô chọn giờ vào ca — chỉ hiện ở thẻ TRƯỚC CA. `input[type=time]` là điều khiển NATIVE:
 * trên điện thoại nó mở đúng bánh xe chọn giờ của hệ điều hành, không cần ta dựng slider. */
.hil-gio-row[hidden] { display: none; }
/* 🔴 GRID, không phải flex-wrap (sửa lần hai 2026-08-22 — Cường gửi ảnh).
 *
 * Hàng có BỐN con phẳng: nhãn · ô giờ · nhãn · ô giờ. Hai bản trước đều hỏng, mỗi bản một kiểu:
 *
 *   · `flex` + `flex:1` trên ô giờ  ⇒ ô nuốt hết chỗ, nhãn *"dự định nghỉ"* vỡ **ba dòng**;
 *   · `flex-wrap: wrap` thêm vào    ⇒ nhãn ở lại dòng trên, ô giờ CỦA NÓ rơi xuống dòng dưới —
 *     tức cặp bị **tách đôi**, đúng cái ảnh Cường gửi. Wrap không biết con nào thuộc về con nào.
 *
 * Grid `auto 1fr` biết: mỗi hàng đúng một cặp (nhãn, ô). Cặp **không thể** tách vì lưới định
 * nghĩa chúng cùng hàng. Hai cặp thành hai hàng — cao thêm một dòng, đổi lại không bao giờ vỡ,
 * ở mọi bề rộng. Với mobile-first thì xếp dọc vốn là bố cục đúng.
 */
.hil-gio-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 10px;
}
.hil-gio-nhan { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.hil-gio-input {
  min-width: 0; padding: 10px 12px; font-size: 16px; font-weight: 700;
  font-family: inherit; color: var(--text-primary);
  border: 1px solid var(--border-hairline); border-radius: var(--r-chip);
  background: var(--surface-subtle);
}

/* Bảng chọn màn — thay thanh nav 5 tab đã gỡ. Nằm trên dải trạng thái nên không bao giờ bị
 * thẻ sự kiện che, khác hẳn nav cũ ở đáy màn hình. */
.hil-menu-btn { padding: 6px 10px; font-size: 15px; }
.hil-chon-man[hidden] { display: none; }
.hil-chon-man { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hil-man-ket { color: var(--status-critical); }
.hil-man-btn {
  flex: 1 1 46%; padding: 9px 10px; font-size: 12.5px; font-weight: 600; text-align: left;
  border: 1px solid var(--border-hairline); border-radius: var(--r-chip);
  background: var(--surface-subtle); color: var(--text-primary); cursor: pointer;
}

/* Màn TỔNG KẾT ca — chiếm phần lớn màn hình vì đây là lúc tài xế muốn biết mình làm được gì. */
.hil-tong-ket[hidden] { display: none; }
.hil-tong-ket { display: flex; flex-direction: column; gap: 2px; }
.hil-tk-dong {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border-hairline);
}
.hil-tk-dong:last-of-type { border-bottom: none; }
.hil-tk-nhan { font-size: 13px; color: var(--text-secondary); }
.hil-tk-gia { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hil-tk-moi { margin-top: 8px; font-size: 12px; color: var(--viz-rest); font-weight: 600; }

.hil-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Nút quyết định trong thẻ sự kiện phải TO — tài xế bấm lúc đang vội, không lúc đang rảnh. */
.hil-dock-card.hil-co-the .hil-actions .hil-btn { flex: 1; padding: 12px 14px; font-size: 14px; }

.hil-btn {
  border: 1px solid var(--border-hairline);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: var(--r-pill);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}
.hil-btn:active {
  transform: scale(0.96);
}
.hil-btn-primary {
  background: var(--accent-kinetic-gradient, linear-gradient(180deg, #00C6EB 0%, #0096C7 100%));
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: 0 4px 14px rgba(0, 180, 216, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}
.hil-btn-ghost {
  background: transparent;
  font-size: 12px;
  border-color: transparent;
  box-shadow: none;
}

.hil-note { font-size: 10.5px; color: var(--text-muted); }

.hil-form-row { display: flex; gap: 8px; margin-top: 8px; }
.hil-input {
  width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-chip);
  font-size: 13px;
}

.hil-toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-float);
}

/* Ô ngoài tầm quan sát của tài xế (#1 — Cường 2026-08-18). Bản đồ vẽ λ mô hình toàn cục, còn
 * quyết định đổi chỗ chỉ đọc niềm tin trong bán kính 2 ô. Không phân biệt hai thứ đó thì một ô
 * đậm-mà-không-được-gợi-ý trông y như hệ thống hỏng. Viền đứt = "bạn chưa biết ô này". */
.heat-ngoai-tam { stroke-dasharray: 4 4; }

/* Điểm đón / điểm trả của cuốc đang được chào. Nhãn dính (permanent tooltip) chứ không phải
 * popup: tài xế phải thấy NGAY hai đầu cuốc để quyết, không phải bấm từng chấm mới biết. */
.diem-nhan {
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: var(--r-pill); border: none;
  background: var(--ink); color: #fff;
  box-shadow: var(--shadow-float);
}
.diem-nhan::before { display: none; }

/* Bảng "khung giờ đáng thử" ở màn mở — mọi số đọc từ `/khung-gio`, không viết tay trong UI. */
.hil-khung-gio[hidden] { display: none; }
.hil-khung-gio {
  margin-top: 4px; padding: 10px 12px;
  background: var(--surface-subtle); border-radius: var(--r-card);
  border: 1px solid var(--border-hairline);
}
.hil-khung-tieu-de { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.hil-khung-dong { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.hil-khung-nhan { color: var(--text-secondary, #4b5563); font-weight: 500; }
.hil-khung-gia { font-weight: 700; color: var(--text-high, #111827); text-align: right; }

/* ======================= MÀN CHỌN HỒ SƠ TÀI XẾ (ONBOARDING 1-SCREEN) ======================= */
.hil-chon-ho-so {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 16px;
}
.hil-chon-ho-so[hidden] { display: none; }

/* 1. Header tinh gọn */
.hil-ho-so-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.hil-hero-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hil-hero-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 180, 216, 0.25);
}
.hil-hero-titles {
  display: flex;
  flex-direction: column;
}
.hil-hero-brand-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-high, #111827);
  letter-spacing: 0.02em;
}
.hil-hero-brand-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-kinetic, #00b4d8);
}

/* 2. Bento Grid 2x2 Thời gian đáng chú ý */
.hil-khung-gio {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hil-time-bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.hil-bento-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.hil-bento-card[hidden] { display: none; }
.hil-bento-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hil-bento-title {
  font-size: 11.5px;
  font-weight: 750;
  color: var(--text-high, #111827);
}
.hil-bento-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: #d97706;
  background: rgba(217, 119, 6, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
}
.hil-bento-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #0284c7;
  letter-spacing: 0.01em;
}
.hil-bento-desc {
  font-size: 10px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.25;
}

/* 3. Danh sách 4 thẻ Hồ sơ (1-Tap Entry) */
.hil-persona-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 0;
}
.hil-persona {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.hil-persona:hover {
  background: rgba(0, 180, 216, 0.04);
  border-color: #00b4d8;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 180, 216, 0.18);
}
.hil-persona:active {
  transform: scale(0.98);
}
.hil-persona-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.hil-persona-ten {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--text-high, #111827);
}
.hil-persona-mo-ta {
  font-size: 11.5px;
  color: var(--text-secondary, #4b5563);
  line-height: 1.35;
}
.hil-persona-support {
  font-size: 10.5px;
  font-weight: 600;
  color: #0284c7;
  margin-top: 2px;
}
.hil-persona-action {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hil-persona-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 180, 216, 0.1);
  color: #00b4d8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.15s ease, transform 0.15s ease;
}
.hil-persona:hover .hil-persona-arrow {
  background: #00b4d8;
  color: #ffffff;
  transform: translateX(2px);
}

/* ======================= điều khiển BẢN ĐỒ ======================= */

/* Cùng cách neo với `.hil-agent` (mép trên dock) nhưng bên TRÁI — nên nút này không thể che
 * thẻ sự kiện, và cũng không đụng bóng bot ở phải. Cấu trúc chứ không phải hằng số pixel. */
.hil-map-ctl {
  position: absolute;
  left: 14px;
  bottom: 100%;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.hil-map-ctl > * { pointer-events: auto; }

/* Bản đồ nay ĐỨNG IM (Cường 2026-08-19). Nút này là một trong hai cửa duy nhất còn đổi được
 * khung nhìn — cửa kia là «Xem trọn cuốc» trên thẻ cuốc. */
.hil-map-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--surface-glass, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-specular, rgba(255, 255, 255, 0.6));
  color: var(--text-high, #111827);
  font-size: 19px;
  line-height: 1;
  box-shadow: var(--shadow-porcelain);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hil-map-btn:active { transform: scale(0.93); }

/* ======================= trạm đổi pin + thang mốc thưởng ======================= */

/* Icon trạm mới (Cường 2026-08-19: "tôi cũng muốn đổi icon điểm sạc"). Cùng màu với chặng
 * «đi đổi pin» nên mắt nối được đường đi với đích của nó mà không cần chú thích. */
.tram-cham {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--viz-charge);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.hil-pill-moc[hidden] { display: none; }
.hil-pill-moc { white-space: nowrap; }

.hil-bang-moc[hidden], .hil-bang-tram[hidden] { display: none; }
.hil-bang-moc, .hil-bang-tram {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
  background: var(--surface-2, var(--surface));
  max-height: 40vh;
  overflow-y: auto;
}
.hil-bang-tieu { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.hil-bang-trong { font-size: 12.5px; color: var(--text-secondary); }
.hil-bang-nguon { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }

.hil-moc {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 13px;
}
.hil-moc-diem { flex: 0 0 70px; }
.hil-moc-tien { flex: 1; font-variant-numeric: tabular-nums; }
.hil-moc-dau { flex: 0 0 16px; text-align: right; }
.hil-moc-dat { color: var(--text-secondary); }
.hil-moc-ke { background: var(--viz-idle); font-weight: 600; }
/* Mỗi ràng buộc MỘT DÒNG có cột, không phải một câu chạy dài: tài xế phải thấy ngay cái nào
   đang hụt, chứ không phải đọc hết câu mới biết. Cường 2026-08-19: *"UI cho việc xem các
   thưởng đang có cũng khó nhìn và hiểu"*. */
.hil-moc-dk {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.hil-moc-dk-ten { flex: 1 1 auto; }
.hil-moc-dk-so { font-variant-numeric: tabular-nums; }
.hil-moc-dk-dau { width: 1em; text-align: center; font-weight: 700; }
.hil-moc-dk-hut { color: var(--status-warn, #b8860b); }
/* Dòng phụ dưới tiêu đề bảng — điểm hiện có, không phải tiền. */
.hil-bang-phu { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

.hil-tram-hang {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 6px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.hil-tram-ten { flex: 0 0 90px; font-weight: 600; }
.hil-tram-xa { flex: 1; color: var(--text-secondary); }
.hil-tram-cho { flex: 0 0 auto; color: var(--text-secondary); font-size: 12px; }

/* Nút «Làm ngay» trong bong bóng lời khuyên. Chỉ có mặt khi lời khuyên MANG một hành động —
 * dựng nút cho một câu chỉ-để-biết là hứa suông. */
.hil-lam-ngay {
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ======================= hai VAI trên bong bóng nổi ======================= */

/* Cường 2026-08-20: *"tôi muốn lời của hệ thống cũng pop out ra như của trợ lý cho dễ nhìn,
 * tuy nhiên phải highlight text của trợ lý lên"*.
 *
 * Cùng khung, KHÁC hẳn về hình. Trợ lý: viền nhấn + chữ đậm hơn — nó là thứ giúp tài xế quyết.
 * Hệ thống: nhạt, mảnh, không viền — nó chỉ thuật lại chuyện vừa xảy ra. Cho hai vai giống nhau
 * là xoá đúng ranh giới ba bề mặt đã dựng. */
.hil-peek:not(.hil-peek-he-thong) {
  border-left: 3px solid var(--accent);
}
.hil-peek:not(.hil-peek-he-thong) .hil-peek-text {
  font-weight: 650;
  color: var(--text-primary);
}
.hil-peek-he-thong {
  opacity: 0.94;
  border-left: 3px solid var(--border);
}
.hil-peek-he-thong .hil-peek-text {
  font-weight: 400;
  color: var(--text-secondary);
}
.hil-peek-he-thong .hil-peek-ten { color: var(--text-secondary); }

/* Chữ của TRỢ LÝ trong feed cũng nổi hơn chữ hệ thống — cùng lý do. */
.hil-bubble.hil-role-agent .hil-bubble-text { font-weight: 600; color: var(--text-primary); }
.hil-bubble.hil-role-system .hil-bubble-text { font-weight: 400; color: var(--text-secondary); }

/* --- DẢI NHẬT KÝ (`5.1` `R2`, Cường chốt phương án 2) --------------------------------------
 *
 * Log là thứ LIẾC, chat là thứ ĐỌC — hai nhịp đọc khác nhau nên hai bề mặt khác nhau.
 * Một dòng, cuộn ngang, tự mờ sau 6s. Tốn ~22px và đó là toàn bộ cái giá.
 */
.hil-log {
  /* `min-height` chứ không `height`: giữ chỗ để dock KHÔNG NHẢY khi dòng cuối mờ đi. Một dải
   * thỉnh thoảng biến mất làm mọi thứ dưới nó dịch lên, và mắt đọc thành "giao diện giật". */
  min-height: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* KHONG `overflow-x: auto` nua (sua 2026-08-22 — Cuong: "cau dai ma khong xem het duoc").
   * Do duoc: cau 117 ky tu cho `scrollWidth 673px` trong hop `clientWidth 362px`, va loi vao
   * phan con lai la keo ngang mot dai cao 22px bang ngon tay — khong phai mot loi vao, ma la
   * mot cai bay. Nay cat bang `…` (noi ra rang con chu) va cham de mo. */
  overflow: hidden;
  cursor: pointer;
  /* Ẩn thanh cuộn: dải này cuộn bằng ngón tay, và một thanh cuộn 6px trên dải 22px thì chiếm
   * hơn một phần tư chiều cao. */
  scrollbar-width: none;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-secondary);
  transition: opacity 600ms ease;
}
.hil-log[hidden] { display: none; }
.hil-log::-webkit-scrollbar { display: none; }

/* Trang thai MO: chu xuong dong day du, hien nhieu dong gan nhat, cuon DOC (cu chi tu nhien
 * tren dien thoai) thay vi cuon ngang. */
.hil-log.hil-log-rong {
  max-height: 34vh;
  overflow-y: auto;
  justify-content: flex-start;
  gap: 4px;
  padding: 4px 6px;
  background: var(--surface-subtle, rgba(0, 0, 0, 0.03));
  border-radius: 8px;
}
.hil-log.hil-log-rong .hil-log-dong { align-items: flex-start; }
.hil-log.hil-log-rong .hil-log-text { white-space: normal; overflow: visible; }

/* Mờ ĐI, không `display:none` — xem ghi chú `min-height` ở trên. */
.hil-log.hil-log-mo { opacity: 0.28; }

.hil-log-dong { display: flex; gap: 6px; align-items: baseline; min-width: 0; }

/* Giờ dùng chữ số đều bề ngang (`tabular-nums`) để dòng không nhích ngang khi đồng hồ đổi. */
.hil-log-gio {
  flex: 0 0 auto;                  /* gio khong duoc co lai nhuong cho cho chu */
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary, var(--text-secondary));
  opacity: 0.75;
}

/* Mot dong + `…`: dau ba cham NOI RA rang con chu; mot thanh cuon an thi khong. */
.hil-log-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* --- BẢNG NHIỆM VỤ (`5.4` `R8`) ------------------------------------------------------------
 *
 * Cùng khuôn với `.hil-bang-moc`: đây là hai câu trả lời cho cùng một câu hỏi *"tôi đang tiến
 * tới cái gì"*, nên chúng phải nhìn như một họ.
 */
.hil-bang-nv {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
}
.hil-bang-nv[hidden] { display: none; }

.hil-nv-hang {
  display: grid;
  /* Tên co giãn; ba cột còn lại rộng cố định để mắt quét THEO CỘT thay vì đọc từng dòng. */
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: baseline;
  padding: 3px 0;
  border-top: 1px solid var(--border-hairline);
}
.hil-nv-hang:first-of-type { border-top: 0; }

.hil-nv-ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hil-nv-tien { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.hil-nv-thuong { font-variant-numeric: tabular-nums; }
.hil-nv-trang { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

/* Trạng thái phân biệt bằng ĐỘ ĐẬM + màu viền trái, KHÔNG chỉ bằng màu chữ: nhìn dưới nắng
 * trên điện thoại thì chênh lệch màu chữ 12px gần như không thấy. */
.hil-nv-mo { border-left: 3px solid var(--viz-work, currentColor); padding-left: 6px; }
.hil-nv-cho { opacity: 0.72; }
.hil-nv-het { opacity: 0.5; text-decoration: line-through; }
.hil-nv-xong { opacity: 0.85; }
.hil-nv-xong .hil-nv-tien { font-weight: 600; }

/* ======================= MÀN HÌNH KHỞI ĐỘNG (SPLASH SCREEN 3S) ======================= */
.gsm-splash {
  position: absolute;
  inset: 0;
  z-index: 9999;
  background: #07121e;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.gsm-splash.gsm-splash-out {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.gsm-splash-skip {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 50;
  background: rgba(0, 30, 45, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 180, 216, 0.45);
  border-radius: 999px;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 10px rgba(0, 180, 216, 0.3);
  transition: background 0.18s ease, transform 0.15s ease;
}
.gsm-splash-skip:hover {
  background: rgba(0, 180, 216, 0.4);
  transform: scale(1.06);
}

.gsm-splash-stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gsm-splash-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  animation: gsm-splash-zoom 3.5s ease-out forwards;
}
@keyframes gsm-splash-zoom {
  0% { transform: scale(1.04); }
  100% { transform: scale(1.0); }
}

/* Lớp hào quang phát sáng quanh đầu Bot */
.gsm-splash-bot-glow {
  position: absolute;
  top: 9%;
  left: 50%;
  transform: translateX(-50%);
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 180, 216, 0.4) 0%, rgba(16, 185, 129, 0.25) 45%, transparent 70%);
  pointer-events: none;
  animation: gsm-bot-pulse 2.2s infinite ease-in-out;
  mix-blend-mode: screen;
}
@keyframes gsm-bot-pulse {
  0%, 100% { transform: translateX(-50%) scale(0.92); opacity: 0.55; }
  50% { transform: translateX(-50%) scale(1.12); opacity: 0.95; }
}

/* Tia sáng quét ngang qua tòa nhà và bầu trời */
.gsm-splash-light-ray {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65%);
  background-size: 250% 250%;
  pointer-events: none;
  animation: gsm-ray-sweep 3s ease-in-out infinite;
  mix-blend-mode: overlay;
}
@keyframes gsm-ray-sweep {
  0% { background-position: 150% 150%; }
  100% { background-position: -50% -50%; }
}

/* Luồng ánh sáng phát xung trên dải đường năng lượng */
.gsm-splash-road-beam {
  position: absolute;
  bottom: 12%;
  left: 0;
  right: 0;
  height: 90px;
  background: radial-gradient(ellipse at 50% 80%, rgba(0, 180, 216, 0.35), transparent 75%);
  pointer-events: none;
  animation: gsm-road-pulse 1.8s infinite ease-in-out;
}
@keyframes gsm-road-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.85; }
}

/* Vùng hiển thị thanh tiến trình & trạng thái khởi động ở đáy */
.gsm-splash-live-loader {
  position: absolute;
  bottom: 24px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(3, 15, 26, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0, 180, 216, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 180, 216, 0.2);
}

.gsm-splash-bar-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gsm-splash-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00b4d8 0%, #10b981 100%);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(0, 180, 216, 0.8);
  transition: width 0.3s ease-out;
}

.gsm-splash-status {
  font-size: 13px;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  min-height: 20px;
  text-align: center;
  transition: opacity 0.2s ease;
}



/* =============================================================================================
   MỤC 16 — bong bóng "đang nghĩ"
   =============================================================================================
   Trước đây bong bóng chờ là ba dấu chấm ĐỨNG IM. Một lượt mất 2–6 giây (router + tool + viết
   câu), nên một "…" bất động đọc lên như CÂU TRẢ LỜI: tài xế tưởng trợ lý vừa đáp cụt lủn.

   Ba chấm chạy sau chữ "Đang tra cứu" làm hai việc cùng lúc: nói ĐANG LÀM GÌ, và phân biệt
   "đang chạy" với "đã treo" — thứ một dòng chữ tĩnh không làm được.

   ⚠ `prefers-reduced-motion`: người tắt hiệu ứng vẫn phải thấy ba chấm, chỉ là không nhấp nháy.
   Bỏ hẳn `content` ở đó thì họ mất luôn tín hiệu, không phải mất hiệu ứng. */
.hil-bubble.hil-dang-nghi .hil-bubble-text::after {
  content: "…";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: hil-dang-nghi-cham 1.2s steps(4, end) infinite;
}
@keyframes hil-dang-nghi-cham {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: "..."; }
}
.hil-bubble.hil-dang-nghi .hil-bubble-text { opacity: .72; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .hil-bubble.hil-dang-nghi .hil-bubble-text::after { animation: none; content: "…"; }
}
