    /* ==========================================================================
       Display OS — Buồng Đọc Hội Thoại & Trang Dự Phòng (du-phong.html)
       Tự chứa 100% — Không phụ thuộc tệp ngoài — Chuẩn ngón tay >= 44px — Bản vá AP 2026-09-07
       Hỗ trợ Z Fold 5 (mở/gập), iPad Safari, Desktop
       ========================================================================== */
    :root {
      /* ========================================================================
         HỢP ĐỒNG 5 TẦNG CÓ TÊN (THEO 62-THIET-KE-HAI-MAN-TREN-DIEN-THOAI)
         Tầng 0 · Nền: 0–9 (bức tranh, danh sách, dòng chảy trang; KHÔNG position: fixed)
         Tầng 1 · Thanh neo: 10–19 (thanh đỉnh, thanh đáy; tối đa 2 phần tử, tổng cao <=25% màn)
         Tầng 2 · Lớp phủ: 20–29 (ngăn kéo, bảng chọn mở đè; phải có nút đóng >=44px)
         Tầng 3 · Nút nổi: 30–39 (nút Góp ý; TỐI ĐA 1 phần tử ở khổ <=639px)
         Tầng 4 · Báo động: 40–49 (hộp lỗi, hỏi xác nhận; chỉ 1 lúc, tự tắt)
         CẤM MỌI Z-INDEX NGOÀI NĂM DẢI TRÊN (XOÁ TOÀN BỘ SỐ 950, 600, 650, ETC.)
         ======================================================================== */
      --z-tang0-nen: 1;              /* 0–9: Nền, watermark, dòng trang */
      --z-tang1-neo: 10;             /* 10–19: Thanh neo đỉnh, thanh neo đáy */
      --z-tang2-phu: 25;             /* 20–29: Ngăn kéo, backdrop, bảng lệnh slash */
      --z-tang3-noi: 30;             /* 30–39: Nút nổi FAB duy nhất (Góp ý) */
      --z-tang4-bao-dong: 40;        /* 40–49: Thông báo toast, chuông báo khẩn */

      /* Ánh xạ biến tương thích chuẩn 5 tầng */
      --z-nen: 1;                    /* Tầng 0 */
      --z-noi-dung: 5;               /* Tầng 0 */
      --z-thanh-dinh: 10;            /* Tầng 1 */
      --z-day-tabs: 12;              /* Tầng 1 */
      --z-hop-noi: 30;               /* Tầng 3 */
      --z-ngan-keo: 25;              /* Tầng 2 */
      --z-lop-phu: 20;               /* Tầng 2 */
      --z-hop-thoai: 25;             /* Tầng 2 */
      --z-chuong-bao: 40;            /* Tầng 4 */
      --z-dau-ban: 15;               /* Tầng 1 */

      --bg: #f8fafc;
      --card-bg: #ffffff;
      --card-border: #cbd5e1;
      --card-border-active: #0284c7;
      --text: #0f172a;
      --text-muted: #334155;
      --text-dim: #475569;
      --primary: #0284c7;
      --primary-hover: #0369a1;
      --primary-bg: #e0f2fe;
      --green: #16a34a;
      --green-bg: #dcfce7;
      --yellow: #d97706;
      --yellow-bg: #fef3c7;
      --red: #dc2626;
      --red-bg: #fee2e2;
      --gray: #475569;
      --gray-bg: #f1f5f9;
      --bubble-jack: #e0f2fe;
      --bubble-agent: #ffffff;
      --radius: 10px;
      --bg-card: #ffffff;
      --bg-input: #f8fafc;
      --border-color: #cbd5e1;
      --border-hover: #94a3b8;
      --text-main: #0f172a;
      --radius-sm: 6px;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      background-color: var(--bg);
      color: var(--text);
      line-height: 1.5;
      padding: 12px 16px;
      width: 100%;
      max-width: 100%;
      margin: 0 auto;
      -webkit-font-smoothing: antialiased;
      box-sizing: border-box;
      transition: padding-right 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @media (max-width: 639px), (pointer: coarse) {
      body {
        padding: 6px 4px;
      }
    }

    @media (min-width: 640px) and (pointer: fine) {
      body {
        padding: 12px 16px;
      }
    }

    @media (min-width: 1367px) and (pointer: fine) {
      body.ke-phai-mo:not(.ke-phai-toan-man) {
        padding-right: 0 !important;
      }
      body.ke-phai-mo .ke-phai-backdrop {
        display: block !important;
      }
    }

    body.dang-keo-ke-phai {
      transition: none !important;
    }

    /* §5.7 Tạm ẩn khối Giao việc nhanh dưới đáy theo lệnh Jack 16:38 (có cờ bật/tắt) */
    body:not(.hien-giao-viec-nhanh-day) .grid-layout {
      display: none !important;
    }

    /* §5.6 Chip Lọc nhân vật nằm gọn trong hàng của nó, không nổi đè lên danh sách */
    #hang-chip-loc-nhan-vat #dosCrewFilterRoot,
    #dosCrewFilterRoot {
      position: static !important;
      top: auto !important;
      left: auto !important;
      z-index: var(--z-nen, 1) !important;
      box-shadow:  none !important;
      display: inline-flex !important;
      margin: 4px 0 !important;
    }

    /* Header */
    header {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: var(--radius);
      padding: 14px 18px;
      margin-bottom: 16px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .brand-group {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .badge-du-phong {
      background: #e0f2fe;
      color: #0369a1;
      border: 1px solid #bae6fd;
      font-size: 12px;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 6px;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }

    .badge-live-chat {
      background: #dcfce7;
      color: #15803d;
      border: 1px solid #86efac;
      font-size: 12px;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 6px;
    }

    h1 {
      font-size: 18px;
      font-weight: 700;
      color: var(--text);
    }

    .meta-bar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 12px;
      font-size: 14px;
    }

    .tuoi-hop {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: transparent;
      border: 1px solid #e2e8f0;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 12px;
      color: var(--text-dim);
    }

    .tuoi-label {
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 500;
    }

    .tuoi-value {
      font-weight: 600;
      color: var(--text-dim);
      font-size: 12px;
    }

    /* RÀNG BUỘC JACK: Mọi thứ bấm được có cạnh ngắn >= 44px */
    button, input, select, textarea, .nut-bam-duoc {
      min-height: 44px;
      min-width: 44px;
      font-family: inherit;
      font-size: 15px;
      box-sizing: border-box;
      border-radius: 8px;
      outline: none;
    }

    button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-weight: 600;
      border: none;
      padding: 0 16px;
      transition: all 0.12s ease;
      touch-action: manipulation;
      user-select: none;
    }

    button:active {
      transform: scale(0.98);
    }

    .btn-primary {
      background: var(--primary);
      color: #ffffff;
    }

    .btn-primary:hover {
      background: var(--primary-hover);
      color: #ffffff;
    }

    .btn-secondary {
      background: #ffffff;
      color: var(--text);
      border: 1px solid var(--card-border);
    }

    .btn-secondary:hover {
      background: #f1f5f9;
      border-color: #94a3b8;
    }

    .btn-sm {
      min-height: 44px;
      min-width: 44px;
      padding: 0 12px;
      font-size: 13px;
    }

    .btn-icon {
      padding: 0 12px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    /* ==========================================================================
       KHUNG ĐỌC HỘI THOẠI AI (CONVERSATION WORKSPACE) — ƯU TIÊN SỐ 1
       ========================================================================== */
    .buong-hoi-thoai {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: var(--radius);
      margin-bottom: 20px;
      overflow: hidden;
    }

    .buong-tieu-de-bar {
      padding: 14px 18px;
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .buong-tieu-de {
      font-size: 16px;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .buong-stats {
      font-size: 13px;
      color: var(--text-muted);
    }

    /* Bảng chuyển nhanh qua lại (Quick Switch Board) */
    .bang-chuyen-nhanh-khung {
      background: #f1f5f9;
      padding: 10px 14px;
      border-bottom: 1px solid var(--card-border);
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .bang-chuyen-nhanh-label {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .bang-chuyen-nhanh-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      padding-bottom: 4px;
    }

    .chip-chuyen-nhanh {
      flex: 0 0 auto;
      min-height: 44px;
      min-width: 44px;
      padding: 6px 14px;
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.12s ease;
      white-space: nowrap;
    }

    .chip-chuyen-nhanh:hover {
      background: #f8fafc;
      border-color: #94a3b8;
    }

    .chip-chuyen-nhanh.dang-chon {
      background: #0284c7;
      border-color: #0369a1;
      color: #ffffff;
      box-shadow:  var(--bong-5);
    }

    .chip-unread-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 20px;
      height: 20px;
      padding: 0 5px;
      background: #ef4444;
      color: #ffffff;
      border-radius: 10px;
      font-size: 11px;
      font-weight: 700;
      line-height: 1;
      flex-shrink: 0;
    }

    .chip-chuyen-nhanh .cham-trang-thai-dot,
    .the-trang-item .cham-trang-thai-dot {
      width: 9px;
      height: 9px;
      min-width: 9px;
      min-height: 9px;
      border-radius: 50%;
      display: inline-block;
      flex-shrink: 0;
    }

    /* Ngăn phần tử con bên trong chip và thẻ cuộc kế thừa cursor pointer */
    .chip-chuyen-nhanh *,
    .the-cuoc * {
      cursor: default;
      pointer-events: none;
    }

    /* Nút gấp/mở cây và thư mục là điều khiển thật, không được bị rule
       pointer-events của nội dung thẻ cha vô hiệu hóa. */
    .the-cuoc .btn-gap-cay,
    .btn-gap-mo-nhom {
      cursor: pointer !important;
      pointer-events: auto !important;
    }

    .chip-app {
      font-size: 12px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      text-transform: uppercase;
    }

    .chip-app-codex {
      background: #e0e7ff;
      color: #3730a3;
      border: 1px solid #818cf8;
    }

    .chip-app-claude {
      background: #ffedd5;
      color: #9a3412;
      border: 1px solid #fb923c;
    }

    .chip-draft-icon {
      color: #f59e0b;
      font-size: 14px;
      animation: none;
    }

    @keyframes nhap-nhay {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.4; }
    }

    /* Bố cục cho Khung đọc (Master-Detail) — Ngưỡng 640px (Z Fold 5 mở ≥640px, gập <640px) */
    .khung-hoi-thoai-grid {
      display: grid;
      grid-template-columns: minmax(320px, 1fr);
      min-height: 520px;
      position: relative;
      width: 100%;
    }

    @media (min-width: 640px) and (pointer: fine) {
      .khung-hoi-thoai-grid {
        grid-template-columns: var(--sidebar-chieu-rong, 280px) 6px minmax(320px, 1fr) !important;
        transition: grid-template-columns 0.05s ease;
      }
      .khung-hoi-thoai-grid.sidebar-gap {
        grid-template-columns: 68px 6px minmax(320px, 1fr) !important;
      }
      /* Mép kéo co giãn tấm ghế trái (§5.6) */
      .mep-keo-sidebar {
        display: block !important;
        width: 6px;
        background: var(--card-border, #e2e8f0);
        cursor: col-resize;
        position: relative;
        touch-action: none;
        user-select: none;
        transition: background 0.15s ease;
        z-index: var(--z-thanh-dinh, 20);
      }
      .mep-keo-sidebar::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: -10px;
        right: -10px;
        min-width: 26px;
        cursor: col-resize;
      }
      .mep-keo-sidebar:hover,
      .mep-keo-sidebar.dang-keo-mep {
        background: var(--primary, #2563eb) !important;
      }
    }

    @media (max-width: 639px), (pointer: coarse) {
      .mep-keo-sidebar {
        display: none !important;
      }
    }

    /* Cột trái: Danh sách cuộc trò chuyện */
    .cot-danh-sach {
      background: #ffffff;
      border-right: none;
      display: flex;
      flex-direction: column;
      max-height: 780px;
      transition: transform 0.2s ease;
    }

    @media (min-width: 640px) and (pointer: fine) {
      .cot-danh-sach {
        border-right: 1px solid var(--card-border);
        display: flex !important;
        position: static !important;
        width: auto !important;
        box-shadow:  none !important;
        z-index: auto !important;
      }
      .btn-mo-drawer-ghe,
      #cot-danh-sach-header,
      #backdrop-danh-sach-ghe {
        display: none !important;
      }
    }

    @media (max-width: 639px), (pointer: coarse) {
      /* §5.3: Tấm ghế phải phủ hết bề ngang */
      .cot-danh-sach {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        background: #ffffff !important;
        z-index: var(--z-ngan-keo, 200) !important;
        box-shadow:  none !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-right: none !important;
      }
      .cot-danh-sach.drawer-mo {
        display: flex !important;
      }
      #backdrop-danh-sach-ghe {
        display: none;
      }
      #backdrop-danh-sach-ghe.drawer-mo {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.4);
        z-index: var(--z-lop-phu, 400);
      }
      #cot-danh-sach-header {
        display: flex !important;
      }
      /* §5.6: Ẩn header desktop và buồng tiêu đề trên máy hẹp để thanh đầu 56px dính đỉnh */
      header {
        display: none !important;
      }
      .buong-tieu-de-bar {
        display: none !important;
      }
      /* §5.6: Ẩn 4 hàng nút công cụ cũ, thay bằng thanh đầu 56px */
      .thanh-dieu-khien-cuoc {
        display: none !important;
      }
      .thanh-tim-va-loc {
        display: none !important;
      }
      /* §5.2: Bảng chuyển nhanh dính ở mép dưới trong tầm ngón cái */
      .bang-chuyen-nhanh-khung {
        display: flex !important;
        padding: 4px 6px;
        background: #f8fafc;
        border-top: 1px solid var(--card-border);
        border-bottom: none;
        order: 10;
        z-index: var(--z-thanh-dinh, 20);
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        box-sizing: border-box;
      }
      .bang-chuyen-nhanh-label {
        display: none !important;
      }
      .bang-chuyen-nhanh-strip {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        gap: 6px !important;
        padding: 2px 0 !important;
        width: 100%;
      }
      .chip-chuyen-nhanh {
        flex: 0 0 auto !important;
        min-height: 44px !important;
        padding: 4px 10px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
      }
      .cot-noi-dung {
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        height: calc(100vh - 56px) !important;
        max-height: calc(100vh - 56px) !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow: hidden !important;
      }
      .khung-hoi-thoai-grid {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: minmax(320px, 1fr) !important;
        height: calc(100vh - 56px) !important;
        min-height: 0 !important;
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        box-sizing: border-box;
      }
      .buong-hoi-thoai {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        height: calc(100vh - 56px) !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100vw !important;
      }
      body {
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
      }
      .dong-tin {
        max-width: 98% !important;
      }
      .khung-tin-nhan {
        padding: 6px 8px !important;
        gap: 8px !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        padding-bottom: 205px !important;
      }
      .hang-the-trang-doc {
        position: sticky !important;
        top: 56px !important;
        z-index: var(--z-thanh-dinh, 20) !important;
        background: #f8fafc !important;
      }
      .bong-tin {
        padding: 10px 12px !important;
        border-radius: 10px !important;
      }
      .khung-nhap-tin {
        padding: 6px 8px !important;
        order: 20;
        flex: 0 0 auto !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        box-sizing: border-box !important;
        z-index: var(--z-thanh-dinh, 20) !important;
        max-height: 45dvh !important;
      }
      .thanh-hanh-dong-nhap {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
        min-height: 44px !important;
      }
      .cong-cu-nhap-nhom {
        flex: 1 1 auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        overflow-x: auto !important;
        scrollbar-width: none !important;
      }
      .btn-cong-cu {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 10px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
        border-radius: 9999px !important;
      }
      .nut-gui-nhom {
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
      }
      #btn-huy-giao-viec {
        min-width: 44px !important;
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 12px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        color: #475569 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        box-sizing: border-box !important;
      }
      #btn-gui-tin-nhan {
        min-width: 44px !important;
        min-height: 44px !important;
        width: auto !important;
        height: 44px !important;
        border-radius: 6px !important;
      }

      /* Màn hẹp chỉ giữ một đường gửi trong buồng chat; form giao việc nhanh
         bên dưới là đường gửi thứ hai và làm đáy trang bị đẩy khỏi tầm mắt. */
      .grid-layout { display: none !important; }

      /* Robot nổi và các ô nổi không được phủ lên vùng nhập hoặc chữ đang đọc. */
      .la-ban-nut-noi { display: none !important; }
      .tay-nam-mo-drawer { display: none !important; }
      body.dos-dang-cho .la-ban-nut-noi { opacity: 0 !important; pointer-events: none !important; }
      body.dos-dang-cho .danh-sach-trang-thai-duoi-tin { display:none !important; }
      #dosCrewFilterRoot {
        top: 60px !important;
        left: 8px !important;
        z-index: var(--z-hop-noi, 100) !important;
        background: #ffffff !important;
        border-radius: 8px !important;
      }
      #ban-do-noi-nut {
        position: fixed !important;
        right: 10px !important;
        bottom: 220px !important;
        top: auto !important;
        left: auto !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        z-index: var(--z-hop-noi, 100) !important;
      }

      /* Dùng 100dvh khi trình duyệt hỗ trợ: chiều cao đúng phần nhìn thấy
         khi thanh địa chỉ hoặc bàn phím điện thoại đang mở. 100vh giữ vai trò
         dự phòng cho máy cũ. */
      .cot-noi-dung,
      .cot-danh-sach,
      .khung-hoi-thoai-grid,
      .buong-hoi-thoai {
        height: 100dvh !important;
        max-height: 100dvh !important;
      }
      .khung-hoi-thoai-grid { height: calc(100dvh - 56px) !important; }
      .cot-noi-dung { height: calc(100dvh - 56px) !important; max-height: calc(100dvh - 56px) !important; }
    }

    /* Gỡ bỏ triệt để dải bấm để nạp theo lệnh Jack (tự động cập nhật vào cuối) */
    .dai-tin-moi {
      display: none !important;
    }

    /* Cảnh báo nhịp tim mất kết nối */
    .canh-bao-nhip-tim {
      background: rgba(239, 68, 68, 0.15);
      border-bottom: 1px solid rgba(239, 68, 68, 0.4);
      color: #fca5a5;
      font-size: 13px;
      padding: 10px 16px;
      text-align: center;
    }

    /* Thanh tìm kiếm và lọc trong cuộc */
    .thanh-tim-va-loc {
      padding: 8px 12px;
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      justify-content: space-between;
    }
    .o-tim-kiem-trong-cuoc-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      flex: 1 1 200px;
    }
    .o-tim-trong-cuoc {
      width: 100%;
      min-height: 44px;
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 6px;
      padding: 8px 12px;
      color: var(--text);
      font-size: 13px;
    }
    .dem-khop-tim {
      font-size: 12px;
      color: var(--text-muted);
      white-space: nowrap;
    }
    .nhom-nut-loc {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .btn-loc {
      min-height: 44px;
      padding: 0 10px;
      font-size: 12px;
      background: #ffffff;
      color: var(--text-muted);
      border: 1px solid var(--card-border);
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      touch-action: manipulation;
    }
    .btn-loc.dang-chon {
      background: #0284c7;
      color: #ffffff;
      border-color: #0369a1;
    }

    /* Huy hiệu tự đo & tuổi số liệu góc trên (nhỏ gọn, mờ, chú thích chuẩn) */
    .huy-hieu-tu-do-wrap {
      display: inline-flex;
      align-items: center;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 12px;
      color: var(--text-dim);
      font-weight: 500;
      transition: all 0.2s ease;
    }

    .huy-hieu-tu-do-wrap.canh-bao-do,
    .tuoi-hop.canh-bao-do {
      background: #fee2e2 !important;
      border-color: #f87171 !important;
      color: #dc2626 !important;
      font-weight: 700 !important;
      animation: none;
    }

    @keyframes nhe-nhap-nhay {
      from { opacity: 1; }
      to { opacity: 0.8; }
    }

    .thanh-loc-gom-nhom {
      padding: 10px 10px;
      border-bottom: 1px solid var(--card-border);
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .tabs-gom-nhom {
      display: flex;
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      gap: 6px;
      background: #f1f5f9;
      padding: 4px;
      border-radius: 8px;
      border: 1px solid var(--card-border);
      scrollbar-width: none;
    }
    .tabs-gom-nhom::-webkit-scrollbar {
      display: none;
    }

    .tab-gom {
      min-height: 44px;
      min-width: 44px;
      padding: 6px 14px;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
      background: transparent;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      text-align: center;
      white-space: nowrap;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .tab-gom.dang-chon {
      background: #ffffff;
      color: var(--primary);
      box-shadow:  var(--bong-2);
    }

    .o-tim-kiem-cuoc {
      width: 100%;
      background: #ffffff;
      border: 1px solid var(--card-border);
      color: var(--text);
      padding: 8px 12px;
      font-size: 16px;
      min-height: 44px;
      box-sizing: border-box;
    }

    .o-tim-kiem-cuoc:focus {
      border-color: var(--primary);
    }

    .danh-sach-the-cuoc,
    #danh-sach-the-cuoc {
      flex: 1;
      overflow-y: auto;
      padding: 10px 10px 120px 10px !important;
      padding-bottom: 120px !important;
      display: flex;
      flex-direction: column;
      gap: 8px;
      -webkit-overflow-scrolling: touch;
    }

    /* Cấu trúc nhóm có mũi tên gấp/mở chuẩn ngón tay >= 44px */
    .nhom-cuoc-wrapper {
      margin-bottom: 10px;
    }

    .nhom-tieu-de-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 2px 4px;
      background: #f1f5f9;
      border: 1px solid var(--card-border);
      border-radius: 6px;
      margin-bottom: 6px;
    }

    .btn-gap-mo-nhom {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: transparent;
      border: none;
      padding: 6px 8px;
      min-height: 44px;
      min-width: 44px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 700;
      color: var(--text);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      border-radius: 4px;
      touch-action: manipulation;
    }

    .btn-gap-mo-nhom:hover {
      background: rgba(0, 0, 0, 0.05);
    }

    .btn-gap-mo-nhom * {
      cursor: default;
      pointer-events: none;
    }

    .mui-ten-gap-mo {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      font-size: 15px;
      color: var(--primary);
      font-weight: 800;
      user-select: none;
      transition: transform 0.15s ease;
    }

    .nhom-so-phien {
      font-size: 12px;
      color: var(--text-muted);
      font-weight: 600;
      padding-right: 8px;
      white-space: nowrap;
    }

    .nhom-cuoc-body {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    /* Thẻ cuộc trò chuyện (the-cuoc) - Mục 5.1: tên tự đặt + tên gốc, đổi tên tại chỗ, đánh dấu, cây cha con */
    .the-cuoc {
      min-height: 60px;
      height: auto;
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 6px 10px;
      cursor: pointer;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      transition: background 0.12s ease, border-color 0.12s ease;
      touch-action: manipulation;
      box-sizing: border-box;
      width: 100%;
      overflow: hidden;
      margin-bottom: 2px;
    }

    .the-cuoc:hover {
      background: #f8fafc;
      border-color: #94a3b8;
    }

    .the-cuoc.dang-chon {
      background: #e0f2fe;
      border-color: var(--primary);
      box-shadow:  none;
      position: relative;
      z-index: var(--z-noi-dung, 5);
    }

    .the-cuoc-hang-chinh {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      min-width: 0;
    }

    .btn-avatar-ghe {
      background: none;
      border: none;
      padding: 0;
      margin: 0;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      min-width: 44px !important;
      min-height: 44px !important;
      width: 44px;
      height: 44px;
    }

    .the-cuoc-ten-cot {
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-width: 0;
      flex: 1 1 auto;
      overflow: hidden;
      gap: 2px;
    }

    .the-cuoc-ten-dong-1 {
      display: flex;
      align-items: center;
      gap: 4px;
      min-width: 0;
    }

    .the-cuoc-ten-wrap {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      flex: 1 1 auto;
      overflow: hidden;
    }

    .the-cuoc-ten-chu {
      font-size: 13.5px;
      font-weight: 700;
      color: var(--text, #0f172a);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 80px;
      flex: 1 1 auto;
      letter-spacing: -0.01em;
    }

    .the-cuoc-ten-goc {
      font-size: 11.5px;
      color: var(--text-muted, #475569);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.3;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .the-cuoc-duoi {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      flex-shrink: 0;
    }

    /* §5.5: Luật thẻ ghế: Tên ghế được chỗ trước, biểu tượng ăn phần còn lại.
       Trên màn rộng: ẩn bớt nút phụ (✏️, ⭐, 🎨), chỉ hiện khi hover hoặc khi kéo rộng.
       Trên điện thoại: ngăn kéo phủ rộng (446px) đủ chỗ với min 44px chuẩn ngón tay. */
    .the-cuoc-actions-hover {
      display: inline-flex;
      align-items: center;
      gap: 2px;
    }
    .the-cuoc-actions-menu-btn { display: none; }
    @media (min-width: 640px) and (pointer: fine) {
      .the-cuoc .the-cuoc-actions-hover {
        display: none;
      }
      .the-cuoc:hover .the-cuoc-actions-hover {
        display: inline-flex;
      }
    }

    .btn-the-action {
      min-width: 44px !important;
      min-height: 44px !important;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      font-size: 15px;
      color: #64748b;
      touch-action: manipulation;
      transition: all 0.15s ease;
      padding: 0;
    }
    .btn-the-action:hover {
      background: #f1f5f9;
      color: #0f172a;
    }
    .btn-danh-dau-phien.da-danh-dau {
      color: #f59e0b;
    }
    .the-cuoc-drag-handle {
      min-width: 44px;
      width: 44px;
      height: 44px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: grab;
      font-size: 16px;
      color: #94a3b8;
      user-select: none;
      touch-action: none;
      flex-shrink: 0;
    }
    .the-cuoc-drag-handle:active {
      cursor: grabbing;
    }

    .cham-trang-thai-dot {
      width: 12px;
      height: 12px;
      min-width: 12px;
      min-height: 12px;
      border-radius: 50%;
      display: inline-block;
      flex-shrink: 0;
    }
    .cham-trang-thai-dot.btn-trang-thai {
      border: 0;
      padding: 0;
      cursor: pointer;
      touch-action: manipulation;
    }
    .the-cuoc-cho-jack {
      display: block;
      max-width: 100%;
      color: #9a3412;
      font-size: 14px;
      font-weight: 700;
      line-height: 1.25;
      white-space: normal;
    }
    .the-cuoc-cho-jack-bao {
      margin-top: 6px;
      padding: 8px 10px;
      border: 2px solid #f59e0b;
      border-radius: 8px;
      background: #fff7ed;
      color: #7c2d12;
    }
    .the-cuoc-cho-jack-nhan {
      display: block;
      font-size: 16px;
      font-weight: 900;
      letter-spacing: .2px;
    }
    .the-cuoc-cho-jack-cau-hoi {
      display: block;
      margin-top: 4px;
      font-size: 14px;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
    }
    .the-cuoc-cho-jack-lua-chon {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 7px;
    }
    .the-cuoc-cho-jack-lua-chon button {
      min-width: 44px;
      min-height: 44px;
      padding: 8px 10px;
      border: 1px solid #c2410c;
      border-radius: 7px;
      background: #fff;
      color: #7c2d12;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      touch-action: manipulation;
    }
    .cham-trang-thai-dot.status-dang-cho-jack {
      width: 44px;
      height: 44px;
      min-width: 44px;
      min-height: 44px;
      background: #f59e0b !important;
      box-shadow:  var(--bong-5) !important;
      position: relative;
    }
    .cham-trang-thai-dot.status-dang-cho-jack::after {
      content: "!";
      color: #fff;
      font-size: 22px;
      font-weight: 900;
    }
    /* 4 trạng thái ghế (§5.1 - §5.4): đang trả lời, đang chờ Jack, đang làm việc khác, không rõ */
    .cham-trang-thai-dot.status-dang-tra-loi,
    .the-cuoc-badge-dot-gap.status-dang-tra-loi {
      background: #16a34a !important;
      box-shadow:  var(--bong-5) !important;
      animation: none;
    }
    .cham-trang-thai-dot.status-dang-lam,
    .cham-trang-thai-dot.tt-dang-lam {
      background: #16a34a;
      box-shadow:  var(--bong-5);
    }
    .cham-trang-thai-dot.status-dang-cho,
    .cham-trang-thai-dot.status-dang-cho-jack,
    .cham-trang-thai-dot.tt-dang-cho,
    .the-cuoc-badge-dot-gap.status-dang-cho,
    .the-cuoc-badge-dot-gap.status-dang-cho-jack {
      background: #d97706 !important;
      box-shadow:  none !important;
      animation: none !important;
    }
    .cham-trang-thai-dot.status-dang-lam-khac,
    .the-cuoc-badge-dot-gap.status-dang-lam-khac {
      background: #7c3aed !important;
      box-shadow:  var(--bong-5) !important;
      animation: none !important;
    }
    .cham-trang-thai-dot.status-chua-ro,
    .cham-trang-thai-dot.status-khong-ro,
    .cham-trang-thai-dot.tt-chua-ro,
    .the-cuoc-badge-dot-gap.status-khong-ro {
      background: #94a3b8 !important;
      box-shadow:  none !important;
      animation: none !important;
    }

    @keyframes chamNhipTho {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.25); opacity: 0.7; }
    }

    /* Thanh trạng thái trả lời ngay dưới tin cuối (§5.1 - §5.4) */
    .thanh-trang-thai-tra-loi {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-height: 32px;
      height: auto;
      max-height: none;
      padding: 4px 8px;
      margin: 2px 8px 4px;
      border-radius: 6px;
      font-size: 12px;
      line-height: 1.4;
      border: 1px solid transparent;
      box-sizing: border-box;
      transition: background .2s ease,color .2s ease,border-color .2s ease;
      overflow: visible;
      flex-wrap: wrap;
    }
    .thanh-trang-thai-tra-loi.status-dang-tra-loi {
      background: #f8fafc;
      border-color: #cbd5e1;
      color: #475569;
    }
    .thanh-trang-thai-tra-loi.status-lau-hon-thuong-le {
      background: #fff7ed;
      border-color: #fdba74;
      color: #9a3412;
    }
    .thanh-trang-thai-tra-loi.status-dang-tra-loi .cham-tra-loi-nhap-nhay { background:#64748b; }
    .thanh-trang-thai-tra-loi.status-lau-hon-thuong-le .cham-tra-loi-nhap-nhay { background:#d97706; }
    .thanh-trang-thai-tra-loi.status-dang-cho,
    .thanh-trang-thai-tra-loi.status-dang-cho-jack {
      background: #f8fafc;
      border-color: #e2e8f0;
      color: #64748b;
    }
    .thanh-trang-thai-tra-loi.status-dang-lam-khac {
      background: #f5f3ff;
      border-color: #c4b5fd;
      color: #6d28d9;
    }
    .thanh-trang-thai-tra-loi.status-khong-ro {
      background: #fef2f2;
      border-color: #fca5a5;
      color: #b91c1c;
    }
    .trang-thai-dot-wrap {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-right: 8px;
    }
    .cham-tra-loi-nhap-nhay {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #16a34a;
      display: inline-block;
      animation: none;
    }
    .cham-tra-loi-nhap-nhay:nth-child(1) { animation-delay: -0.32s; }
    .cham-tra-loi-nhap-nhay:nth-child(2) { animation-delay: -0.16s; }
    @keyframes dotPulsing {
      0%, 80%, 100% { transform: scale(0.6); opacity: 0.35; }
      40% { transform: scale(1.15); opacity: 1; }
    }
    .trang-thai-nut-tac-vu {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      flex: 0 0 auto;
    }
    .trang-thai-nut-tac-vu .btn-tac-vu-trang-thai {
      min-width: 44px;
      min-height: 44px;
      padding: 0 5px;
      border: 0;
      background: transparent;
      color: inherit;
      font-size: 11px;
      line-height: 1;
    }
    .trang-thai-tra-loi-trai { min-width: 0; display:flex; align-items:center; gap:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .trang-thai-tra-loi-trai > span:last-child, .trang-thai-tra-loi-trai > strong { overflow:hidden; text-overflow:ellipsis; }

    .btn-tac-vu-trang-thai {
      min-height: 44px !important;
      min-width: 80px !important;
      padding: 6px 14px;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      touch-action: manipulation;
    }
    .btn-hoi-lai-ghe {
      background: #0284c7;
      color: #ffffff;
      border: 1px solid #0284c7;
    }
    .btn-hoi-lai-ghe:hover {
      background: #0369a1;
    }
    .btn-bo-cho-ghe {
      background: #ffffff;
      color: #64748b;
      border: 1px solid #cbd5e1;
    }
    .btn-bo-cho-ghe:hover {
      background: #f1f5f9;
      color: #0f172a;
    }

    /* Ký hiệu phân biệt màu thẻ cho người khó nhìn màu (§5.9) */
    .badge-dau-hieu-gap {
      position: absolute;
      top: 2px;
      right: 2px;
      border-radius: 3px;
      font-size: 10px;
      line-height: 1;
      padding: 2px 3px;
      font-weight: 700;
      z-index: var(--z-noi-dung, 5);
    }
    .the-cuoc-dau-hieu-mau {
      font-weight: 700;
      font-size: 12px;
      margin-right: 4px;
      display: inline-block;
      pointer-events: none;
      opacity: .7;
    }

    .cham-bao-tin-moi {
      width: 8px;
      height: 8px;
      min-width: 8px;
      min-height: 8px;
      border-radius: 50%;
      background: #ef4444;
      display: inline-block;
      margin-left: 4px;
      box-shadow:  var(--bong-5);
      animation: none;
    }
    @keyframes nhapNhayCham {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.4; transform: scale(0.85); }
    }

    .chip-draft-icon, .chip-ghim-icon {
      font-size: 13px;
      line-height: 1;
      flex-shrink: 0;
    }

    /* Ẩn các hàng phụ rườm rà chiếm diện tích ở thẻ (5.1) */
    .the-cuoc-hang-phu,
    .the-cuoc-hang-id,
    .btn-doi-ten-phien {
      display: none !important;
    }

    /* 5.6 Màu theo mức ưu tiên (CHỈ TÔ VIỀN TRÁI, KHÔNG TÔ CẢ THẺ) */
    .the-cuoc.priority-nong {
      border-left: 5px solid #ef4444 !important;
    }
    .the-cuoc.priority-thuong {
      border-left: 5px solid #f59e0b !important;
    }
    .the-cuoc.priority-de-sau {
      border-left: 5px solid #64748b !important;
    }

    .btn-priority-pill {
      min-width: 44px !important;
      min-height: 44px !important;
      padding: 4px 8px;
      font-size: 12px;
      font-weight: 700;
      border-radius: 6px;
      border: 1px solid #cbd5e1;
      background: #f8fafc;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      touch-action: manipulation;
      transition: all 0.12s ease;
    }
    .btn-priority-pill.p-nong {
      color: #b91c1c;
      border-color: #fca5a5;
      background: #fef2f2;
    }
    .btn-priority-pill.p-thuong {
      color: #b45309;
      border-color: #fde68a;
      background: #fffbeb;
    }
    .btn-priority-pill.p-de-sau {
      color: #475569;
      border-color: #cbd5e1;
      background: #f1f5f9;
    }

    /* 5.1 Nút Ghim lên đầu */
    .btn-ghim-phien {
      min-width: 44px !important;
      min-height: 44px !important;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 6px;
      cursor: pointer;
      font-size: 16px;
      color: #64748b;
      padding: 4px;
      touch-action: manipulation;
      transition: all 0.15s ease;
    }
    .btn-ghim-phien:hover {
      background: #f1f5f9;
      border-color: #cbd5e1;
      color: #0f172a;
    }
    .btn-ghim-phien.da-ghim {
      color: #e11d48;
      background: #ffe4e6;
      border-color: #fecdd3;
    }
    .nhom-cuoc-wrapper.nhom-da-ghim .nhom-tieu-de-bar {
      background: #fff1f2;
      border-color: #fecdd3;
    }
    .nhom-cuoc-wrapper.nhom-da-ghim .nhom-ten-chu {
      color: #be123c;
    }

    /* 5.2 Đổi tên tại chỗ */
    .o-doi-ten-phien {
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
      background: #ffffff;
      border: 2px solid var(--primary);
      border-radius: 4px;
      padding: 4px 6px;
      width: 100%;
      min-height: 36px;
      box-sizing: border-box;
    }
    .btn-sua-ten-phien {
      min-width: 44px !important;
      min-height: 44px !important;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 6px;
      cursor: pointer;
      font-size: 13px;
      color: #64748b;
      touch-action: manipulation;
      transition: all 0.15s ease;
    }
    .btn-sua-ten-phien:hover {
      background: #f1f5f9;
      border-color: #cbd5e1;
      color: #0f172a;
    }

    /* 5.3 Cây cha con & Kéo thả */
    .the-cuoc.tree-level-1 {
      margin-left: 0;
    }
    .the-cuoc.tree-level-2 {
      margin-left: 20px;
      width: calc(100% - 20px);
      position: relative;
      background: rgba(0, 0, 0, 0.02);
    }
    .the-cuoc.tree-level-2::before {
      content: '↳';
      position: absolute;
      left: -16px;
      top: 14px;
      font-size: 15px;
      font-weight: 700;
      color: #0284c7;
    }
    .the-cuoc.tree-level-3 {
      margin-left: 38px;
      width: calc(100% - 38px);
      position: relative;
      background: rgba(0, 0, 0, 0.04);
    }
    .the-cuoc.tree-level-3::before {
      content: '↳↳';
      position: absolute;
      left: -20px;
      top: 14px;
      font-size: 13px;
      font-weight: 700;
      color: #0284c7;
    }
    .the-cuoc.drag-over-target {
      outline: 2px dashed #0284c7 !important;
      background: #f0f9ff !important;
    }
    .the-cuoc.dang-keo {
      opacity: 0.45;
    }
    .btn-gap-cay {
      min-width: 44px !important;
      min-height: 44px !important;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 4px;
      cursor: pointer;
      font-size: 15px;
      color: #0284c7;
      font-weight: 800;
      padding: 0;
      touch-action: manipulation;
    }
    .btn-gap-cay:hover {
      background: #e0f2fe;
      border-color: #bae6fd;
    }
    .vung-tach-cay {
      border: 2px dashed #94a3b8;
      background: #f8fafc;
      border-radius: 8px;
      padding: 10px;
      text-align: center;
      font-size: 13px;
      font-weight: 600;
      color: #475569;
      margin: 6px 0;
      display: none;
      cursor: pointer;
      transition: all 0.15s ease;
      touch-action: manipulation;
    }
    .vung-tach-cay.drag-over {
      border-color: #0284c7;
      background: #e0f2fe;
      color: #0369a1;
    }

    /* ==========================================================================
       GẤP MỞ SIDEBAR & TAY NẮM MÀN HẸP & CÁC THẺ TRANG (TABS) - §5.2, §5.4
       ========================================================================== */
    .cot-danh-sach-top-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px;
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      min-height: 48px;
      box-sizing: border-box;
    }
    .top-bar-tieu-de {
      font-size: 14px;
      font-weight: 700;
      color: var(--text);
      /* nowrap + overflow:hidden cũ làm ô đếm dài bị CẮT CỤT: màn hình chỉ hiện
         "(1 gõ vào được ·" rồi hết. Cho xuống dòng để đọc trọn con số. */
      white-space: normal;
      overflow: visible;
      flex: 1 1 auto;
      min-width: 0;
    }
    /* Ô đếm "👥 Đội ngũ trợ lý" — hai số, hai nghĩa: gõ vào được / chỉ đọc.
       Đứng riêng một dòng dưới tiêu đề để không bao giờ bị cắt. */
    .dem-so-ghe-badge {
      display: block;
      margin-top: 2px;
      font-size: 12.5px;
      font-weight: 700;
      color: var(--text-dim);
      white-space: normal;
    }
    .btn-toggle-sidebar {
      min-width: 44px !important;
      min-height: 44px !important;
      width: 44px;
      height: 44px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 6px;
      font-size: 16px;
      font-weight: 700;
      color: var(--text);
      cursor: pointer;
      touch-action: manipulation;
      transition: all 0.15s ease;
      padding: 0;
    }
    .btn-toggle-sidebar:hover {
      background: #f1f5f9;
      border-color: #cbd5e1;
    }

    /* Tay nắm kéo mở danh sách ghế trên màn hình hẹp */
    .tay-nam-mo-drawer {
      display: none;
      position: fixed;
      left: 0;
      top: 130px;
      min-width: 44px !important;
      min-height: 48px !important;
      width: 44px;
      height: 48px;
      background: #0284c7;
      color: #ffffff;
      border: none;
      border-radius: 0 8px 8px 0;
      box-shadow:  var(--bong-1);
      z-index: var(--z-hop-noi, 100);
      cursor: pointer;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 700;
      touch-action: manipulation;
    }
    .tay-nam-mo-drawer * {
      pointer-events: none;
      cursor: default;
    }
    @media (max-width: 639px), (pointer: coarse) {
      .the-cuoc-actions-hover { display: none !important; }
      .the-cuoc-actions-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
        padding: 0 !important;
        border: 1px solid var(--card-border);
        border-radius: 6px;
        background: #fff;
        color: var(--text);
        font-size: 13px !important;
        cursor: pointer;
        touch-action: manipulation;
      }
      .the-cuoc-drag-handle { min-width: 24px !important; width: 24px !important; height: 24px !important; }
      .tay-nam-mo-drawer {
        display: flex;
      }
      .cot-danh-sach.drawer-mo ~ .tay-nam-mo-drawer,
      body.drawer-dang-mo .tay-nam-mo-drawer {
        display: none !important;
      }
    }

    /* Gấp sidebar thành dải rô-bốt hẹp trên màn rộng */
    @media (min-width: 640px) and (pointer: fine) {
      .cot-danh-sach.da-gap {
        width: 68px !important;
        min-width: 68px !important;
        max-width: 68px !important;
        overflow-x: hidden;
      }
      .cot-danh-sach.da-gap .top-bar-tieu-de,
      .cot-danh-sach.da-gap .thanh-loc-gom-nhom,
      .cot-danh-sach.da-gap #vung-tach-cay,
      .cot-danh-sach.da-gap .nhom-tieu-de-bar,
      .cot-danh-sach.da-gap .the-cuoc-ten-cot,
      .cot-danh-sach.da-gap .the-cuoc-ten-wrap,
      .cot-danh-sach.da-gap .the-cuoc-duoi,
      .cot-danh-sach.da-gap .btn-gap-cay,
      .cot-danh-sach.da-gap .the-cuoc-drag-handle {
        display: none !important;
      }
      .cot-danh-sach.da-gap .cot-danh-sach-top-bar {
        justify-content: center;
        padding: 4px 2px;
      }
      .cot-danh-sach.da-gap .danh-sach-the-cuoc {
        padding: 6px 2px;
        align-items: center;
      }
      .cot-danh-sach.da-gap .nhom-cuoc-body {
        align-items: center;
      }
      .cot-danh-sach.da-gap .the-cuoc {
        width: 56px !important;
        min-width: 56px !important;
        max-width: 56px !important;
        height: 56px !important;
        min-height: 56px !important;
        margin-left: 0 !important;
        padding: 4px !important;
        justify-content: center;
        align-items: center;
        border-radius: 8px;
        position: relative;
      }
      .cot-danh-sach.da-gap .the-cuoc::before {
        display: none !important;
      }
      .cot-danh-sach.da-gap .the-cuoc-hang-chinh {
        justify-content: center;
        width: 100%;
        position: relative;
      }
      .cot-danh-sach.da-gap .the-cuoc .the-cuoc-badge-dot-gap {
        position: absolute;
        bottom: 2px;
        right: 4px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        border: 2px solid #ffffff;
        display: block !important;
      }
      .cot-danh-sach.da-gap .the-cuoc .the-cuoc-symbol-gap {
        position: absolute;
        top: 2px;
        right: 2px;
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
        padding: 1px 3px;
        border-radius: 4px;
        background: #ffffff;
        box-shadow:  var(--bong-2);
        display: block !important;
        z-index: var(--z-noi-dung, 5);
      }
    }

    /* Hàng thẻ trang (Tabs) & khung bọc (§5.1, §5.2, §5.3) */
    .khung-doc-va-the-wrap {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow: hidden;
      width: 100%;
    }
    .khung-than-doc {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow: hidden;
      width: 100%;
    }
    .hang-the-trang-doc {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px;
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      overflow-x: auto;
      overflow-y: hidden;
      white-space: nowrap;
      flex-wrap: nowrap;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      min-height: 52px;
      box-sizing: border-box;
      width: 100%;
      flex-shrink: 0;
    }
    .hang-the-trang-doc::-webkit-scrollbar {
      display: none;
    }

    /* Bố cục dựng đứng trên màn hình rộng (≥640px, §5.3) */
    @media (min-width: 640px) and (pointer: fine) {
      .khung-doc-va-the-wrap.the-trang-dung-dung {
        flex-direction: row;
      }
      .khung-doc-va-the-wrap.the-trang-dung-dung .hang-the-trang-doc {
        flex-direction: column;
        align-items: stretch;
        width: 180px;
        min-width: 160px;
        max-width: 220px;
        height: 100%;
        border-bottom: none;
        border-right: 1px solid var(--card-border);
        overflow-x: hidden;
        overflow-y: auto;
        white-space: normal;
        padding: 8px 6px;
      }
      .khung-doc-va-the-wrap.the-trang-dung-dung .the-trang-item {
        width: 100%;
        min-height: 44px;
        justify-content: space-between;
      }
    }

    /* Màn hẹp (Z Fold 5 gập 446px hoặc ngón tay): LUÔN NẰM NGANG VÀ VUỐT ĐƯỢC (§5.3) */
    @media (max-width: 639px), (pointer: coarse) {
      .khung-doc-va-the-wrap {
        flex-direction: column !important;
      }
      .hang-the-trang-doc {
        flex-direction: row !important;
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--card-border) !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
      }
    }

    .the-trang-item {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 6px 4px 10px;
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 6px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      min-height: 44px;
      flex-shrink: 0;
      box-sizing: border-box;
      touch-action: manipulation;
      user-select: none;
      transition: all 0.15s ease;
    }
    .the-trang-item.the-drop-target {
      border: 2px dashed #0284c7 !important;
      background: #e0f2fe !important;
      transform: scale(1.02);
    }
    .the-trang-item > *:not(.the-trang-dong-btn):not(.o-doi-ten-the):not(.btn-nhom-toggle):not(.btn-nhom-color) {
      pointer-events: none;
      cursor: default;
    }
    .the-trang-item.dang-chon {
      background: #e0f2fe;
      border-color: #0284c7;
      color: #0369a1;
      box-shadow:  var(--bong-2);
    }
    /* WO-GHE-DA-XOA-NOI-THAT: Đánh dấu mờ thẻ ghế đã xoá/không hợp lệ */
    .the-trang-item.the-trang-da-xoa {
      opacity: 0.5;
      background: #fef2f2 !important;
      border-color: #fca5a5 !important;
      pointer-events: auto;
      cursor: not-allowed;
    }
    .the-trang-item.the-trang-da-xoa .the-trang-ten {
      text-decoration: line-through;
      color: #991b1b;
    }
    .the-trang-item.the-trang-da-xoa::after {
      content: "⚠️";
      position: absolute;
      top: 2px;
      right: 2px;
      font-size: 10px;
    }
    .the-trang-item .the-trang-ten {
      font-size: 13px;
      max-width: 140px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .o-doi-ten-the {
      pointer-events: auto !important;
      cursor: text !important;
      min-height: 36px;
      padding: 4px 8px;
      font-size: 13px;
      font-weight: 600;
      border: 1px solid #0284c7;
      border-radius: 4px;
      outline: none;
      background: #ffffff;
      max-width: 130px;
      box-sizing: border-box;
    }

    /* Gom nhóm thẻ trang (§5.1) */
    .nhom-the-trang-wrap {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 6px;
      background: rgba(0, 0, 0, 0.03);
      border: 1px dashed var(--card-border);
      border-radius: 8px;
      flex-shrink: 0;
      box-sizing: border-box;
    }
    .the-trang-dung-dung .nhom-the-trang-wrap {
      display: flex;
      flex-direction: column;
      width: 100%;
      align-items: stretch;
    }
    .nhom-the-header {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 12px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      cursor: pointer;
      user-select: none;
      background: #ffffff;
      border: 1px solid var(--card-border);
      min-height: 40px;
      box-sizing: border-box;
    }
    .nhom-the-header .btn-nhom-toggle,
    .the-trang-item .btn-nhom-toggle {
      width: 32px;
      height: 32px;
      min-width: 32px;
      min-height: 32px;
      border: none;
      background: transparent;
      cursor: pointer;
      font-size: 12px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
      color: var(--text-dim);
    }
    .nhom-the-header .btn-nhom-toggle:hover,
    .the-trang-item .btn-nhom-toggle:hover {
      background: rgba(0, 0, 0, 0.08);
    }
    .btn-nhom-color {
      width: 32px;
      height: 32px;
      min-width: 32px;
      min-height: 32px;
      border: none;
      background: transparent;
      cursor: pointer;
      font-size: 12px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
    }
    .the-trang-nhom.da-thu-lai {
      font-weight: 700;
    }
    .the-trang-dong-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 44px;
      height: 44px;
      min-width: 44px;
      min-height: 44px;
      background: transparent;
      border: none;
      border-radius: 4px;
      color: #94a3b8;
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      touch-action: manipulation;
      padding: 0;
    }
    .the-trang-dong-btn:hover {
      color: #ef4444;
      background: rgba(239, 68, 68, 0.1);
    }
    .toast-the-trang {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 14px;
      background: #0f172a;
      color: #ffffff;
      font-size: 13px;
      font-weight: 600;
      border-bottom: 1px solid #334155;
      box-sizing: border-box;
    }
    .toast-the-trang button {
      min-width: 44px;
      min-height: 44px;
      background: transparent;
      border: none;
      color: #94a3b8;
      font-size: 16px;
      cursor: pointer;
      padding: 0;
    }

    /* 5.4 Hàng nút tuỳ biến & Về như cũ */
    .hang-nut-tuy-bien {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 6px;
      width: 100%;
    }
    .btn-ve-nhu-cu, .btn-them-nhom {
      min-height: 44px !important;
      min-width: 44px !important;
      padding: 0 10px;
      font-size: 12px;
      font-weight: 700;
      border-radius: 6px;
      border: 1px solid var(--card-border);
      background: #ffffff;
      color: #334155;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      touch-action: manipulation;
      transition: all 0.15s ease;
      white-space: nowrap;
    }
    .btn-ve-nhu-cu:hover, .btn-them-nhom:hover {
      background: #f1f5f9;
      border-color: #94a3b8;
      color: #0f172a;
    }

    /* 5.7 Avatar từng ghế */
    .agent-avatar-wrap {
      min-width: 44px !important;
      min-height: 44px !important;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      position: relative;
      cursor: pointer;
      flex-shrink: 0;
      touch-action: manipulation;
    }
    .btn-avatar-ghe {
      min-width: 44px !important;
      min-height: 44px !important;
      width: 44px !important;
      height: 44px !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      background: transparent !important;
      border: none !important;
      padding: 0 !important;
      cursor: pointer;
      touch-action: manipulation;
      flex-shrink: 0;
    }
    .agent-avatar-circle {
      width: 32px;
      height: 32px;
      pointer-events: none;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 800;
      color: #ffffff;
      text-transform: uppercase;
      user-select: none;
      overflow: hidden;
      box-shadow:  var(--bong-2);
      transition: transform 0.12s ease;
      box-sizing: border-box;
    }
    .agent-avatar-circle:hover {
      transform: scale(1.1);
    }
    .agent-avatar-circle.tt-dang-lam {
      border: 2px solid #10b981 !important;
    }
    .agent-avatar-circle.tt-dang-cho {
      border: 2px solid #f59e0b !important;
    }
    .agent-avatar-circle.tt-chua-ro {
      border: 2px solid #94a3b8 !important;
    }
    .agent-avatar-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 50%;
    }
    .agent-avatar-that {
      background-color: #ffffff;
      object-fit: contain;
    }
    .agent-avatar-cho {
      background-color: #ffffff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }
    .agent-avatar-cho svg {
      width: 100%;
      height: 100%;
      display: block;
    }
    .agent-avatar-ban-tam {
      border: 1px dashed rgba(255, 255, 255, 0.65) !important;
    }
    .avatar-in-dong-tin {
      display: inline-block;
      vertical-align: middle;
      margin-right: 6px;
    }
    #audioUnlockReminder {
      display: none !important;
    }

    /* 5.8 Khung kéo thả tệp vào chat */
    .dropzone-overlay-chat {
      position: absolute;
      inset: 0;
      background: rgba(240, 249, 255, 0.94);
      border: 3px dashed #0284c7;
      border-radius: 8px;
      z-index: var(--z-lop-phu, 400);
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      
    }
    .dropzone-overlay-content {
      text-align: center;
      color: #0369a1;
      padding: 16px;
    }
    .dropzone-icon {
      font-size: 40px;
      margin-bottom: 4px;
    }
    .dropzone-text {
      font-size: 18px;
      font-weight: 700;
    }
    .dropzone-sub {
      font-size: 13px;
      color: #0284c7;
      margin-top: 4px;
    }

    /* Cột phải: Nội dung cuộc trò chuyện & Khung nhập */
    .cot-noi-dung {
      display: flex;
      flex-direction: column;
      background: var(--card-bg);
      min-height: 520px;
      width: 100%;
      max-width: 100%;
      flex: 1 1 auto;
    }

    /* ==========================================================================
       MỤC 5.6: THANH ĐẦU 56 ĐIỂM CÓ TÊN GHẾ + MŨI TÊN QUA LẠI + NÚT THÊM
       ========================================================================== */
    .thanh-dau-doc-cuoc {
      height: 56px;
      min-height: 56px;
      max-height: 56px;
      background: #ffffff;
      border-bottom: 1px solid var(--card-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 8px;
      gap: 6px;
      box-sizing: border-box;
      position: sticky;
      top: 0;
      z-index: var(--z-thanh-dinh, 20);
      width: 100%;
    }

    .thanh-dau-trai {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 48px;
      min-height: 48px;
      flex: 1 1 auto;
      cursor: default;
      pointer-events: none;
      padding: 4px 6px;
      border-radius: 6px;
      touch-action: manipulation;
      box-sizing: border-box;
    }
    .thanh-dau-ten-wrap * {
      cursor: default;
    }
    .thanh-dau-trai button,
    .thanh-dau-trai a,
    #btn-ve-the-gioi-top,
    #btn-mo-drawer-tro-ly {
      pointer-events: auto !important;
      cursor: pointer !important;
    }

    .thanh-dau-avatar {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      width: 32px;
      height: 32px;
    }

    .thanh-dau-ten-wrap {
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-width: 0;
      overflow: hidden;
      gap: 2px;
    }

    .thanh-dau-dong-ten {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      overflow: hidden;
    }

    .thanh-dau-ten-ghe {
      font-size: 14px;
      font-weight: 700;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 18px;
    }

    .thanh-dau-lan-cuoi {
      font-size: 12px;
      line-height: 14px;
      color: #64748b;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-weight: 500;
    }
    .thanh-dau-lan-cuoi.mat-ket-noi {
      color: #dc2626;
      font-weight: 700;
    }

    .thanh-dau-phai {
      display: flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
    }

    .btn-dieu-huong-ghe {
      min-width: 44px;
      min-height: 44px;
      height: 44px;
      padding: 0 10px;
      background: #f8fafc;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      font-size: 15px;
      font-weight: 700;
      color: #334155;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: all 0.12s ease;
      touch-action: manipulation;
      box-sizing: border-box;
    }
    .btn-dieu-huong-ghe:hover {
      background: #e2e8f0;
      border-color: #94a3b8;
      color: #0f172a;
    }
    .btn-dieu-huong-ghe:active {
      transform: scale(0.96);
    }

    .khung-tim-dropdown {
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      padding: 8px 10px;
      display: flex;
      align-items: center;
      gap: 8px;
      box-sizing: border-box;
      animation: slideDownQuick 0.15s ease;
    }
    @keyframes slideDownQuick {
      from { opacity: 0; transform: translateY(-8px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .dropdown-section-label {
      padding: 6px 10px 2px;
      font-size: 12px;
      font-weight: 700;
      color: var(--text-dim);
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }

    /* MỤC 5.5 & 5.2: Mất kết nối thì mọi con số trên trang phải mờ đi và kèm tuổi của số */
    body.mat-ket-noi-dang-bat .buong-stats,
    body.mat-ket-noi-dang-bat #thong-ke-hoi-thoai,
    body.mat-ket-noi-dang-bat #chi-bao-tong-phien,
    body.mat-ket-noi-dang-bat .the-cuoc-gio,
    body.mat-ket-noi-dang-bat .dem-khop-tim,
    body.mat-ket-noi-dang-bat #dem-so-ghe,
    body.mat-ket-noi-dang-bat #khung-tin-nhan .dong-tin-gio,
    body.mat-ket-noi-dang-bat #khung-tin-nhan .dong-song-trang-thai {
      opacity: 0.45 !important;
      filter: grayscale(0.8) !important;
    }
    /* KV-008: BẢO VỆ TUỔI DỮ LIỆU BẢN TIN (STALE FEED GUARD & HONEST QUEUE) */
    /* Quá 5 phút: Phủ sương mờ grayscale(40%) toàn buồng trò chuyện & dải trợ lý */
    body.du-lieu-chet-vua #khung-tin-nhan,
    body.du-lieu-chet-vua .cot-danh-sach,
    body.du-lieu-chet-vua .bang-chuyen-nhanh-strip,
    body.du-lieu-chet-vua .hang-the-trang-doc {
      filter: grayscale(40%) !important;
      transition: filter 0.3s ease;
    }
    /* Quá 30 phút: Báo đỏ tê liệt, phủ xám grayscale(80%) opacity(0.6) */
    body.du-lieu-te-liet #khung-tin-nhan,
    body.du-lieu-te-liet .cot-danh-sach,
    body.du-lieu-te-liet .bang-chuyen-nhanh-strip,
    body.du-lieu-te-liet .hang-the-trang-doc {
      filter: grayscale(80%) opacity(0.6) !important;
      transition: filter 0.3s ease;
    }
    .status-chet-vua {
      background: rgba(234, 88, 12, 0.12) !important;
      color: #ea580c !important;
      border: 1px solid rgba(234, 88, 12, 0.35) !important;
    }
    .status-te-liet {
      background: rgba(220, 38, 38, 0.12) !important;
      color: #dc2626 !important;
      border: 1px solid rgba(220, 38, 38, 0.4) !important;
    }
    .cham-trang-thai-dot.status-chet-vua {
      background: #ea580c !important;
      box-shadow:  var(--bong-5) !important;
    }
    .cham-trang-thai-dot.status-te-liet {
      background: #dc2626 !important;
      box-shadow:  var(--bong-5) !important;
    }
    .btn-tai-lai-nut {
      flex: 0 0 auto;
      min-height: 44px;
      min-width: 44px;
      padding: 6px 12px;
      background: #f1f5f9;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      color: var(--text);
      font-weight: 600;
      font-size: 13px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      cursor: pointer;
      z-index: var(--z-thanh-dinh, 20);
      transition: all 0.15s ease;
    }
    .btn-tai-lai-nut:hover {
      background: #e2e8f0;
      border-color: #cbd5e1;
    }
    .tuoi-so-cu {
      display: inline-block;
      font-size: 12px;
      color: #dc2626;
      font-weight: 700;
      margin-left: 4px;
    }

    .banner-mat-ket-noi-chat {
      background: #fef2f2;
      border-bottom: 1px solid #fca5a5;
      color: #991b1b;
      font-size: 12px;
      font-weight: 700;
      padding: 6px 12px;
      text-align: center;
      box-sizing: border-box;
      line-height: 16px;
    }

    /* Tuổi của chính tin mới nhất đang vẽ: đặt ngay đầu vùng đọc, không ẩn ở chân trang. */
    .tuoi-tin-chat {
      display: block;
      min-height: 44px;
      padding: 8px 12px;
      box-sizing: border-box;
      background: #eff6ff;
      border-bottom: 2px solid #93c5fd;
      color: #1e3a8a;
      font-size: 16px;
      line-height: 1.35;
      font-weight: 700;
      overflow-wrap: anywhere;
      white-space: normal;
    }
    .tuoi-tin-chat.canh-bao {
      background: #fef3c7;
      border-color: #f59e0b;
      color: #92400e;
    }
    .tuoi-tin-chat.bao-dong {
      background: #fee2e2;
      border-color: #dc2626;
      color: #991b1b;
      font-weight: 800;
    }
    .ban-dang-xem {
      padding: 3px 12px 8px;
      background: #f8fafc;
      color: #475569;
      font-size: 12px;
      line-height: 1.35;
    }
    #khung-tin-nhan.dang-khoi-phuc-cuon {
      visibility: hidden;
    }

    .thanh-tuoi-lam-moi-chat {
      display: flex;
      align-items: stretch;
      gap: 8px;
      padding: 8px 10px;
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
    }
    .thanh-tuoi-lam-moi-chat #tuoi-tin-chat {
      flex: 1 1 auto;
      border: 0;
      border-radius: 6px;
    }
    .btn-lam-moi-chat {
      flex: 0 0 auto;
      min-width: 112px;
      min-height: 44px;
      padding: 8px 12px;
      font-size: 15px;
      font-weight: 700;
      white-space: nowrap;
    }
    .trang-thai-lam-moi-chat {
      display: block;
      padding: 0 12px 7px;
      background: #f8fafc;
      color: #334155;
      font-size: 14px;
      line-height: 1.35;
    }
    @media (max-width: 420px) {
      .thanh-tuoi-lam-moi-chat { flex-direction: column; }
      .btn-lam-moi-chat { width: 100%; }
    }

    .thanh-dieu-khien-cuoc {
      padding: 10px 10px;
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .thong-tin-cuoc-hien-tai {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .ten-cuoc-hien-tai {
      font-size: 16px;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .thao-tac-cuoc-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chon-so-luot {
      background: #ffffff;
      border: 1px solid var(--card-border);
      color: var(--text);
      padding: 4px 8px;
      font-size: 13px;
      border-radius: 6px;
      min-height: 44px;
      max-width: 140px;
    }

    /* ==========================================================================
       TỜ GIAO AW — Gõ @ nhắc tên · Thanh menu đủ đồ · Thẻ trực quan
       ========================================================================== */
    .dropdown-menu-wrapper {
      position: relative;
      display: inline-block;
    }

    .nut-toolbar-chinh {
      min-height: 44px;
      min-width: 44px;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      white-space: nowrap;
      box-sizing: border-box;
    }

    .menu-dropdown-box {
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      background: #ffffff;
      border: 1.5px solid #cbd5e1;
      border-radius: 8px;
      box-shadow:  var(--bong-4);
      z-index: var(--z-hop-noi, 100);
      min-width: 180px;
      max-width: 90vw;
      padding: 4px 0;
      box-sizing: border-box;
    }

    .menu-dropdown-them {
      min-width: 190px;
      right: 0;
      left: auto;
    }

    .dropdown-item-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      min-height: 44px;
      min-width: 44px;
      padding: 8px 14px;
      border: none;
      background: none;
      text-align: left;
      font-size: 13px;
      font-weight: 500;
      color: var(--text);
      cursor: pointer;
      box-sizing: border-box;
      transition: background 0.15s ease;
    }

    .dropdown-item-btn:hover, .dropdown-item-btn:focus {
      background: #e0f2fe;
      color: #0369a1;
      outline: none;
    }

    /* Popup gợi ý nhắc tên (@mentions) */
    .popup-goi-y-nhac-ten {
      position: absolute;
      bottom: calc(100% + 4px);
      left: 0;
      right: 0;
      max-height: 250px;
      overflow-y: auto;
      background: #ffffff;
      border: 1.5px solid #0284c7;
      border-radius: 8px;
      box-shadow:  var(--bong-4);
      z-index: var(--z-hop-noi, 100);
      box-sizing: border-box;
    }

    .mention-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 44px;
      min-width: 44px;
      padding: 8px 14px;
      font-size: 13px;
      color: var(--text);
      cursor: pointer;
      border-bottom: 1px solid #f1f5f9;
      box-sizing: border-box;
    }

    .mention-item:last-child {
      border-bottom: none;
    }

    .mention-item:hover, .mention-item.selected {
      background: #e0f2fe;
      color: #0369a1;
    }

    .mention-item-empty {
      padding: 12px 14px;
      font-size: 13px;
      color: #dc2626;
      font-weight: 500;
      background: #fef2f2;
      cursor: default;
      min-height: 44px;
      min-width: 44px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
    }

    .mention-badge-type {
      font-size: 12px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 4px;
    }

    .mention-type-ghe {
      background: #e0f2fe;
      color: #0369a1;
    }

    .mention-type-tep {
      background: #fef3c7;
      color: #92400e;
    }

    .mention-type-tranh {
      background: #fce7f3;
      color: #9d174d;
    }

    /* Viên nhãn bấm được trong tin nhắn */
    .nhan-nhac {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      min-height: 44px;
      min-width: 44px;
      padding: 4px 10px;
      border-radius: 6px;
      font-weight: 600;
      font-size: 13px;
      cursor: pointer;
      border: 1.5px solid transparent;
      margin: 2px 4px 2px 0;
      vertical-align: middle;
      box-sizing: border-box;
      text-decoration: none;
      transition: all 0.15s ease;
    }

    .nhan-nhac.nhan-ghe {
      background: #e0f2fe;
      color: #0284c7;
      border-color: #bae6fd;
    }

    .nhan-nhac.nhan-ghe:hover {
      background: #bae6fd;
      color: #0369a1;
    }

    .nhan-nhac.nhan-tep {
      background: #fef3c7;
      color: #b45309;
      border-color: #fde68a;
    }

    .nhan-nhac.nhan-tep:hover {
      background: #fde68a;
      color: #92400e;
    }

    .nhan-nhac.nhan-tranh {
      background: #fce7f3;
      color: #be185d;
      border-color: #fbcfe8;
    }

    .nhan-nhac.nhan-tranh:hover {
      background: #fbcfe8;
      color: #9d174d;
    }

    /* Thẻ kết quả trực quan (Tóm tắt, Sơ đồ, Luồng việc, Hỏi tiếp, Tệp mới) */
    .the-ket-qua-card {
      background: #ffffff;
      border: 1.5px solid #cbd5e1;
      border-radius: 10px;
      padding: 14px 16px;
      margin: 12px 0;
      box-shadow:  var(--bong-3);
      width: 100%;
      box-sizing: border-box;
    }

    .the-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
      border-bottom: 1px solid #f1f5f9;
      padding-bottom: 8px;
      flex-wrap: wrap;
    }

    .the-card-title {
      font-weight: 700;
      font-size: 14px;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .the-card-actions {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-wrap: wrap;
    }

    .btn-card-action {
      min-height: 44px;
      min-width: 44px;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
      border: 1px solid #cbd5e1;
      background: #f8fafc;
      color: var(--text);
      border-radius: 6px;
      cursor: pointer;
      box-sizing: border-box;
    }

    .btn-card-action:hover {
      background: #e2e8f0;
    }

    .the-card-body {
      font-size: 13px;
      line-height: 1.6;
      color: var(--text);
      word-break: break-word;
    }

    .the-card-footer {
      display: flex;
      gap: 8px;
      margin-top: 12px;
      padding-top: 10px;
      border-top: 1px solid #f1f5f9;
      flex-wrap: wrap;
    }

    /* Thanh tin ghim lên đầu */
    .thanh-tin-ghim {
      background: #fffbeb;
      border: 1px solid #fde68a;
      border-radius: 8px;
      padding: 8px 12px;
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 13px;
      color: #92400e;
      box-sizing: border-box;
    }

    .thanh-tin-ghim-noi-dung {
      display: flex;
      align-items: center;
      gap: 6px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      flex: 1;
    }

    .btn-bo-ghim {
      min-height: 44px;
      min-width: 44px;
      padding: 0 8px;
      background: transparent;
      border: none;
      color: #92400e;
      font-size: 16px;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-sizing: border-box;
    }

    /* Floating selection toolbar — Tờ giao BH (§5.1) */
    .thanh-noi-chon-chu {
      position: fixed;
      background: #0f172a;
      color: #ffffff;
      border: 1px solid #334155;
      border-radius: 10px;
      padding: 6px 8px;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      box-shadow:  var(--bong-4);
      z-index: var(--z-hop-noi, 100);
      box-sizing: border-box;
      max-width: calc(100vw - 16px);
      max-height: 240px;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      touch-action: manipulation;
    }

    .btn-noi-action {
      min-height: 44px;
      min-width: 44px;
      padding: 8px 12px;
      font-size: 14px;
      font-weight: 600;
      color: #ffffff;
      background: #1e293b;
      border: 1px solid #334155;
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      box-sizing: border-box;
      white-space: nowrap;
      transition: background 0.12s, border-color 0.12s;
    }

    .btn-noi-action:hover, .btn-noi-action:active {
      background: #334155;
      border-color: #64748b;
    }
    .btn-noi-action.btn-noi-primary {
      background: #0284c7;
      border-color: #38bdf8;
    }
    .btn-noi-action.btn-noi-primary:hover {
      background: #0369a1;
    }

    /* KỆ PHẢI (Right Shelf) — Tờ giao BH (§5.3, §5.4) */
    .ke-phai-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      
      z-index: var(--z-lop-phu, 400);
      display: none;
      opacity: 0;
      transition: opacity 0.2s ease;
    }
    .ke-phai-backdrop.mo {
      display: block;
      opacity: 1;
    }

    :root {
      --ke-phai-chieu-rong: 380px;
    }

    .ke-phai-container {
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      width: var(--ke-phai-chieu-rong, 380px);
      max-width: 100vw;
      background: #ffffff;
      border-left: 1px solid #cbd5e1;
      box-shadow:  var(--bong-4);
      z-index: var(--z-ngan-keo, 200);
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      visibility: hidden;
      transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.24s;
      box-sizing: border-box;
    }
    .ke-phai-container.mo {
      transform: translateX(0);
      visibility: visible;
    }

    /* Mép kéo co giãn kệ phải (§5.2) — vùng bắt ≥48px chuẩn ngón tay */
    .mep-keo-ke-phai {
      display: block;
      position: absolute;
      top: 0;
      bottom: 0;
      left: -8px;
      width: 16px;
      background: transparent;
      cursor: col-resize;
      touch-action: none;
      user-select: none;
      z-index: var(--z-ngan-keo, 200);
      transition: background 0.15s ease;
    }
    .mep-keo-ke-phai::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: -20px;
      right: -20px;
      min-width: 48px;
      cursor: col-resize;
      touch-action: none;
    }
    .mep-keo-ke-phai:hover,
    .mep-keo-ke-phai.dang-keo-mep {
      background: var(--primary, #2563eb) !important;
    }
    .ke-phai-container.dang-keo {
      transition: none !important;
    }
    .ke-phai-container.toan-man {
      width: 100vw !important;
      max-width: 100vw !important;
      left: 0 !important;
      right: 0 !important;
      border-left: none !important;
    }
    .ke-phai-container.toan-man .mep-keo-ke-phai {
      display: none !important;
    }

    /* Nút mở kệ phải trên thanh đầu (§5.1) */
    .btn-mo-ke-phai-top {
      min-width: 44px !important;
      min-height: 44px !important;
      padding: 0 12px !important;
      font-size: 14px !important;
      font-weight: 700 !important;
      background: #f1f5f9;
      color: #0f172a;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      display: inline-flex !important;
      align-items: center;
      justify-content: center;
      gap: 6px;
      cursor: pointer;
      touch-action: manipulation;
    }
    .btn-mo-ke-phai-top:hover {
      background: #e2e8f0;
      border-color: #94a3b8;
    }

    /* Tay nắm mở kệ phải - LUÔN HIỆN khi ngăn đóng (FIX: ngăn biến mất không có đường quay lại) */
    .tay-nam-mo-ke-phai {
      display: flex;
      position: fixed;
      right: 0;
      top: 130px;
      min-width: 44px !important;
      min-height: 48px !important;
      width: 44px;
      height: 48px;
      background: #0284c7;
      color: #ffffff;
      border: none;
      border-radius: 8px 0 0 8px;
      box-shadow:  var(--bong-1);
      z-index: var(--z-hop-noi, 100);
      cursor: pointer;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: 700;
      touch-action: manipulation;
    }
    /* Ẩn tay nắm khi ngăn đang mở */
    body.ke-phai-mo .tay-nam-mo-ke-phai,
    .ke-phai-container.mo ~ .tay-nam-mo-ke-phai {
      display: none !important;
    }

    /* Nút thao tác cả câu trên bong bóng trả lời (§5.4) — tuân thủ chuẩn ngón tay ≥ 44px */
    .btn-menu-ca-cau {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 44px;
      min-width: 44px;
      padding: 4px 10px;
      font-size: 13px;
      font-weight: 600;
      color: #475569;
      background: #f8fafc;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      cursor: pointer;
      margin-left: 6px;
      touch-action: manipulation;
      transition: all 0.15s ease;
      box-sizing: border-box;
    }
    .btn-menu-ca-cau:hover {
      background: #e2e8f0;
      color: #0f172a;
      border-color: #94a3b8;
    }

    /* Nút quay lại chuẩn ngón tay ≥44px (§5.1 & §5.6) */
    .ke-phai-btn-quay-lai {
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      gap: 4px !important;
      min-height: 44px !important;
      min-width: 44px !important;
      height: 44px !important;
      padding: 0 10px !important;
      background: #f1f5f9 !important;
      color: #0f172a !important;
      border: 1px solid #cbd5e1 !important;
      border-radius: 6px !important;
      font-size: 13px !important;
      font-weight: 600 !important;
      cursor: pointer !important;
      touch-action: manipulation !important;
      box-sizing: border-box !important;
      flex-shrink: 0 !important;
      transition: all 0.15s ease !important;
    }
    .ke-phai-btn-quay-lai:hover {
      background: #e2e8f0 !important;
      border-color: #94a3b8 !important;
    }
    /* Ngăn phải chiếm toàn màn khi màn < 1024px — nhất quán với drawer chi tiết */
    @media (max-width: 1023px) {
      .ke-phai-container {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        border-left: none !important;
      }
      .mep-keo-ke-phai {
        display: none !important;
      }
    }

    /* Lời báo hụt thu gọn (§5.0) */
    .dong-song-trang-thai.hut-thu-gon {
      font-size: 11px;
      color: #94a3b8;
      padding: 2px 6px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: transparent;
      border: none;
    }
    .dong-song-trang-thai.hut-thu-gon button {
      min-height: 24px;
      padding: 1px 6px;
      font-size: 11px;
    }

    /* Đầu kệ đúng một hàng, không xuống dòng, không đè nhau (§5.1) */
    .ke-phai-header {
      padding: 6px 10px !important;
      min-height: 52px !important;
      max-height: 54px !important;
      background: #f8fafc !important;
      border-bottom: 1px solid #e2e8f0 !important;
      display: flex !important;
      flex-direction: row !important;
      align-items: center !important;
      justify-content: space-between !important;
      gap: 8px !important;
      flex-shrink: 0 !important;
      box-sizing: border-box !important;
      position: sticky !important;
      top: 0 !important;
      z-index: var(--z-thanh-dinh, 20) !important;
      white-space: nowrap !important;
      overflow: hidden !important;
    }
    .ke-phai-header-giua {
      display: flex !important;
      align-items: center !important;
      gap: 6px !important;
      min-width: 0 !important;
      flex: 1 1 auto !important;
      overflow: hidden !important;
    }
    .ke-phai-icon {
      font-size: 18px !important;
      line-height: 1 !important;
      flex-shrink: 0 !important;
    }
    .ke-phai-tieu-de {
      margin: 0 !important;
      font-size: 14px !important;
      font-weight: 700 !important;
      color: #0f172a !important;
      white-space: nowrap !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
      min-width: 0 !important;
    }
    .ke-phai-phan-cach {
      font-size: 13px !important;
      color: #94a3b8 !important;
      flex-shrink: 0 !important;
    }
    .ke-phai-so-luong {
      font-size: 13px !important;
      color: #64748b !important;
      font-weight: 500 !important;
      white-space: nowrap !important;
      flex-shrink: 0 !important;
    }
    .ke-phai-header-phai {
      display: flex !important;
      align-items: center !important;
      gap: 6px !important;
      flex-shrink: 0 !important;
    }
    .ke-phai-btn-header {
      min-width: 44px !important;
      min-height: 44px !important;
      width: 44px !important;
      height: 44px !important;
      padding: 0 !important;
      background: #f1f5f9 !important;
      border: 1px solid #cbd5e1 !important;
      border-radius: 6px !important;
      font-size: 16px !important;
      font-weight: 700 !important;
      color: #334155 !important;
      cursor: pointer !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      box-sizing: border-box !important;
      flex-shrink: 0 !important;
      touch-action: manipulation !important;
      transition: all 0.15s ease !important;
    }
    .ke-phai-btn-header:hover {
      background: #e2e8f0 !important;
      border-color: #94a3b8 !important;
      color: #0f172a !important;
    }
    .ke-phai-btn-header#ke-phai-btn-toan-man {
      font-size: 18px !important;
      line-height: 1 !important;
    }

    .ke-phai-danh-sach {
      flex: 1;
      overflow-y: auto;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      background: #f1f5f9;
      box-sizing: border-box;
      -webkit-overflow-scrolling: touch;
    }
    .ke-phai-trong {
      text-align: center;
      padding: 40px 16px;
      color: #64748b;
    }

    .ke-phai-item {
      background: #ffffff;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      padding: 14px;
      box-shadow:  var(--bong-2);
      display: flex;
      flex-direction: column;
      gap: 8px;
      box-sizing: border-box;
    }
    .ke-phai-thao-tac-them {
      display: flex;
      gap: 8px;
      padding: 8px 14px;
      background: #f8fafc;
      border-bottom: 1px solid #e2e8f0;
      flex-shrink: 0;
    }
    .btn-ke-phai-them {
      flex: 1;
      min-height: 44px;
      padding: 6px 8px;
      background: #ffffff;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      transition: all 0.15s ease;
      touch-action: manipulation;
    }
    .btn-ke-phai-them:hover {
      background: #f1f5f9;
      border-color: var(--primary);
      color: var(--primary);
    }
    .ke-phai-item.ke-phai-item-viec {
      border-left: 4px solid #0284c7;
    }
    .ke-phai-item.ke-phai-item-ghi-chu {
      border-left: 4px solid #10b981;
    }
    .ke-phai-item.ke-phai-item-van-ban {
      border-left: 4px solid #6366f1;
    }
    .ke-phai-item.ke-phai-item-tep {
      border-left: 4px solid #f59e0b;
    }
    .ke-phai-item.ke-phai-item-ban-ve {
      border-left: 4px solid #ec4899;
    }
    .ke-phai-item.ke-phai-item-tranh-ban-do {
      border-left: 4px solid #14b8a6;
    }
    .ke-phai-item.muc-do-gap {
      border-left-color: #ef4444;
    }
    .ke-phai-item-preview-text {
      font-size: 13px;
      color: #475569;
      line-height: 1.5;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      padding: 8px 10px;
      border-radius: 6px;
      max-height: 5em;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      word-break: break-word;
    }
    .ke-phai-item-preview-img {
      max-height: 120px;
      width: 100%;
      object-fit: contain;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      margin-top: 4px;
    }
    .ke-phai-item-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .ke-phai-badge {
      font-size: 13px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .ke-phai-badge.badge-viec {
      background: #e0f2fe;
      color: #0369a1;
    }
    .ke-phai-badge.badge-ghi-chu {
      background: #d1fae5;
      color: #047857;
    }
    .ke-phai-badge.badge-van-ban {
      background: #e0e7ff;
      color: #4338ca;
    }
    .ke-phai-badge.badge-tep {
      background: #fef3c7;
      color: #b45309;
    }
    .ke-phai-badge.badge-ban-ve {
      background: #fce7f3;
      color: #be185d;
    }
    .ke-phai-badge.badge-tranh-ban-do {
      background: #ccfbf1;
      color: #0f766e;
    }
    .ke-phai-badge.badge-gap {
      background: #fee2e2;
      color: #b91c1c;
    }
    .ke-phai-gio {
      font-size: 13px;
      color: #64748b;
      font-weight: 500;
    }
    .ke-phai-item-ten {
      font-size: 15px;
      font-weight: 700;
      color: #0f172a;
      line-height: 1.4;
      word-break: break-word;
    }
    .ke-phai-item-phu-trach {
      font-size: 13px;
      color: #475569;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .ke-phai-item-nguon {
      font-size: 13px;
      color: #64748b;
      background: #f8fafc;
      border: 1px dashed #cbd5e1;
      padding: 6px 8px;
      border-radius: 6px;
      line-height: 1.4;
      word-break: break-word;
    }
    .ke-phai-item-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 4px;
      padding-top: 8px;
      border-top: 1px solid #f1f5f9;
    }
    .ke-phai-btn-action {
      min-height: 44px;
      min-width: 44px;
      padding: 0 12px;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      background: #ffffff;
      color: #0f172a;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      box-sizing: border-box;
    }
    .ke-phai-btn-action:hover {
      background: #f8fafc;
      border-color: #94a3b8;
    }
    .ke-phai-btn-action.primary {
      background: #0284c7;
      color: #ffffff;
      border-color: #0284c7;
    }
    .ke-phai-btn-action.primary:hover {
      background: #0369a1;
    }
    .ke-phai-btn-action.btn-xoa {
      color: #ef4444;
      border-color: #fecaca;
    }
    .ke-phai-btn-action.btn-xoa:hover {
      background: #fef2f2;
    }

    .ke-phai-footer {
      padding: 10px 16px;
      background: #f8fafc;
      border-top: 1px solid #e2e8f0;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      box-sizing: border-box;
    }
    .ke-phai-btn-phu {
      min-height: 44px;
      min-width: 44px;
      padding: 0 14px;
      font-size: 14px;
      font-weight: 600;
      background: transparent;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      color: #64748b;
      cursor: pointer;
      box-sizing: border-box;
    }
    .ke-phai-btn-phu:hover {
      background: #fee2e2;
      color: #ef4444;
      border-color: #fca5a5;
    }

    /* TỐI ƯU GIAO DIỆN KỆ PHẢI & THẺ QUYẾT ĐỊNH CHO JACK (WO-KE-PHAI) */
    .ke-phai-v12-the {
      background: #ffffff;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      padding: 12px 14px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
      display: flex;
      flex-direction: column;
      gap: 8px;
      box-sizing: border-box;
      transition: all 0.15s ease;
    }
    .ke-phai-v12-the.ke-phai-v12-the-ngu-canh {
      border-left: 4px solid #0284c7;
    }
    .ke-phai-v12-the.ke-phai-v12-the-tai-lieu {
      border-left: 4px solid #6366f1;
    }
    .ke-phai-v12-the.ke-phai-v12-the-hoat-dong {
      border-left: 4px solid #f59e0b;
    }
    .ke-phai-v12-the.ke-phai-v12-the-so-tay {
      border-left: 4px solid #10b981;
    }
    .ke-phai-quyet-dinh-the {
      border-left: 4px solid #ef4444 !important;
      background: #fff8f8 !important;
      box-shadow: 0 2px 8px rgba(239, 68, 68, 0.12) !important;
      border: 1px solid #fecaca !important;
    }
    .ke-phai-v12-the-dau {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .ke-phai-v12-the-dau h3 {
      margin: 0;
      font-size: 13.5px;
      font-weight: 700;
      color: #0f172a;
    }
    .ke-phai-v12-nguon {
      font-size: 11px;
      color: #64748b;
      background: #f8fafc;
      padding: 3px 8px;
      border-radius: 5px;
      border: 1px solid #e2e8f0;
    }
    .ke-phai-v12-noi-dung {
      display: flex;
      flex-direction: column;
      gap: 6px;
      font-size: 12.5px;
      color: #334155;
    }
    .ke-phai-v12-dong {
      padding: 5px 0;
      border-bottom: 1px dashed #f1f5f9;
      display: flex;
      flex-direction: column;
      gap: 2px;
      line-height: 1.4;
    }
    .ke-phai-v12-dong:last-child {
      border-bottom: none;
    }
    .ke-phai-v12-chi-tiet {
      font-size: 11.5px;
      color: #64748b;
      word-break: break-word;
    }
    .ke-phai-v12-hanh-dong {
      margin-top: 4px;
    }
    .ke-phai-v12-nut {
      min-height: 40px;
      padding: 6px 12px;
      background: #0284c7;
      color: #ffffff;
      border: none;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .ke-phai-v12-nut:hover {
      background: #0369a1;
    }
    .btn-quyet-dinh-ke-phai {
      min-height: 48px !important;
      font-size: 13.5px !important;
      font-weight: 700 !important;
      padding: 10px 16px !important;
      border-radius: 8px !important;
      touch-action: manipulation;
      transition: all 0.15s ease;
      font-family: inherit;
      box-sizing: border-box !important;
    }
    .btn-quyet-dinh-ke-phai:hover {
      opacity: 0.94;
      transform: translateY(-1px);
    }
    .btn-quyet-dinh-ke-phai:active {
      transform: translateY(0);
    }
    .btn-quyet-dinh-ke-phai.btn-qd-dong-y {
      background: #059669 !important;
      color: #ffffff !important;
      border: 1px solid #047857 !important;
    }
    .btn-quyet-dinh-ke-phai.btn-qd-tu-choi {
      background: #ef4444 !important;
      color: #ffffff !important;
      border: 1px solid #dc2626 !important;
    }
    .btn-quyet-dinh-ke-phai.btn-qd-dong-y * {
      color: #ffffff !important;
    }
    .btn-quyet-dinh-ke-phai.btn-qd-tu-choi * {
      color: #ffffff !important;
    }
    .status-qd-phan-hoi {
      padding: 6px 10px;
      border-radius: 6px;
      background: #f0fdf4;
      border: 1px solid #bbf7d0;
    }


    /* Hiệu ứng nhấp nháy định vị đoạn gốc (§5.4) — không sửa chữ */
    @keyframes nhapNhayDoanGoc {
      0% { box-shadow:  var(--bong-5); background-color: rgba(56, 189, 248, 0.2); }
      50% { box-shadow:  var(--bong-5); background-color: rgba(2, 132, 199, 0.3); }
      100% { box-shadow:  none; background-color: transparent; }
    }
    .doan-goc-noi-bat {
      animation: nhapNhayDoanGoc 2.4s ease-out;
      border-radius: 6px;
    }

    /* Toast thông báo nhanh */
    .dos-toast {
      position: fixed;
      top: 18px;
      left: 50%;
      transform: translateX(-50%);
      z-index: var(--z-chuong-bao, 800);
      background: #0f172a;
      color: #ffffff;
      padding: 10px 18px;
      border-radius: 24px;
      font-size: 14px;
      font-weight: 600;
      box-shadow:  var(--bong-4);
      display: flex;
      align-items: center;
      gap: 8px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s ease;
      max-width: calc(100vw - 32px);
      box-sizing: border-box;
    }
    .dos-toast.hien {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    /* Ngăn kéo tóm tắt phiên */
    .ngan-keo-tom-tat {
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      padding: 14px 18px;
      display: none;
      max-height: 240px;
      overflow-y: auto;
    }

    .ngan-keo-tom-tat.mo {
      display: block;
    }

    .tom-tat-item {
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 6px;
      padding: 8px 12px;
      margin-bottom: 8px;
      font-size: 13px;
    }

    .tom-tat-item-header {
      display: flex;
      justify-content: space-between;
      color: var(--primary);
      font-weight: 600;
      margin-bottom: 4px;
      font-size: 12px;
    }

    /* Ngăn kéo thẻ ghi chú & bản vẽ (Task 5.3) */
    .ngan-keo-ghi-chu {
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border);
      padding: 14px 18px;
      display: none;
      max-height: 280px;
      overflow-y: auto;
    }

    .danh-sach-the-ghi-chu-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 10px;
    }

    .the-ghi-chu-card {
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 12px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-height: 60px;
      transition: border-color 0.15s, box-shadow 0.15s;
    }

    .the-ghi-chu-card:hover {
      border-color: var(--primary);
      box-shadow:  var(--bong-2);
    }

    .the-ghi-chu-card .the-badge {
      display: inline-block;
      font-size: 12px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 4px;
      width: fit-content;
    }

    .the-badge-markdown {
      background: #e0f2fe;
      color: #0369a1;
      border: 1px solid #bae6fd;
    }

    .the-badge-ban-ve {
      background: #ede9fe;
      color: #6d28d9;
      border: 1px solid #ddd6fe;
    }

    /* Modal dùng chung (Task 5.3) */
    .modal-phu-hop {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(15, 23, 42, 0.45);
      z-index: var(--z-hop-thoai, 600);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }

    .modal-noi-dung {
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 12px;
      width: min(600px, 95vw);
      max-height: 90vh;
      overflow-y: auto;
      padding: 20px;
      box-shadow:  var(--bong-4);
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--card-border);
      padding-bottom: 12px;
    }

    .modal-header h3 {
      font-size: 16px;
      font-weight: 700;
      color: var(--text);
    }

    .modal-body {
      font-size: 14px;
      line-height: 1.6;
      color: var(--text);
      max-height: 50vh;
      overflow-y: auto;
    }

    /* Nút mốc tóm tắt làm sẵn (Task 5.4) */
    .nut-tom-tat-moc {
      min-height: 44px;
      min-width: 44px;
      font-size: 13px;
      font-weight: 600;
      padding: 6px 12px;
      cursor: pointer;
    }

    .nut-tom-tat-moc.dang-chon {
      background: var(--primary-bg);
      color: var(--primary);
      border-color: var(--primary);
      font-weight: 700;
    }

    /* Khung hiển thị dòng tin nhắn */
    .khung-tin-nhan {
      flex: 1;
      min-height: 500px;
      max-height: 700px;
      overflow-y: auto;
      overflow-anchor: none;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      background: #f8fafc;
      -webkit-overflow-scrolling: touch;
    }

    .dong-tin {
      display: flex;
      flex-direction: column;
      max-width: 88%;
      /* Cô lập reflow/paint từng dòng; khổ 335 không kéo lại cả lịch sử khi dựng. */
      contain: layout paint;
      animation: hien-tin 0.15s ease-out;
    }

    @keyframes hien-tin {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .dong-tin-user {
      align-self: flex-end;
    }

    .dong-tin-agent {
      align-self: flex-start;
    }

    .bong-tin-header {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-dim);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .dong-tin-user .bong-tin-header {
      justify-content: flex-end;
    }

    .bong-tin {
      padding: 12px 16px;
      border-radius: 12px;
      font-size: 14px;
      line-height: 1.55;
      word-break: break-word;
      color: var(--text);
    }

    .dong-tin-user .bong-tin {
      background: var(--bubble-jack);
      border-bottom-right-radius: 2px;
      border: 1px solid #bae6fd;
      color: #0c4a6e;
    }

    .dong-tin-agent .bong-tin {
      background: var(--bubble-agent);
      border-bottom-left-radius: 2px;
      border: 1px solid var(--card-border);
      color: #0f172a;
      box-shadow:  var(--bong-1);
    }

    /* Tờ giao 2026-09-07-BG (§5.1): Dòng sống trạng thái ngay dưới tin nhắn */
    .dong-song-trang-thai {
      display: inline-flex;
      flex-direction: column;
      margin-top: 8px;
      padding: 5px 10px;
      font-size: 12px;
      line-height: 1.4;
      border-radius: 6px;
      font-weight: 500;
      word-break: break-word;
      transition: all 0.2s ease;
    }

    .dong-song-trang-thai.dang-gui {
      background: #f1f5f9;
      border: 1px solid #cbd5e1;
      color: #475569;
    }

    .dong-song-trang-thai.dang-cho {
      background: #fef3c7;
      border: 1px solid #fde68a;
      color: #92400e;
    }

    .dong-song-trang-thai.da-toi {
      background: #dcfce7;
      border: 1px solid #bbf7d0;
      color: #166534;
    }

    .dong-song-trang-thai.hut {
      background: #fee2e2;
      border: 1px solid #fecaca;
      color: #991b1b;
    }

    .btn-gui-lai-inline {
      margin-left: 8px;
      padding: 2px 8px;
      font-size: 12px;
      font-weight: 600;
      color: #991b1b;
      background: #ffffff;
      border: 1px solid #f87171;
      border-radius: 4px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      vertical-align: middle;
      transition: background 0.15s;
    }
    .btn-gui-lai-inline:hover {
      background: #fee2e2;
    }

    .dong-song-trang-thai em {
      font-style: normal;
      font-weight: 700;
      color: inherit;
    }

    .dong-song-trang-thai .so-giay-dem {
      font-variant-numeric: tabular-nums;
      font-weight: 700;
      color: inherit;
    }

    .dong-ly-do-cho {
      font-size: 12px;
      opacity: 0.92;
      margin-top: 3px;
      font-weight: 400;
    }

    /* CR §5.5: Dòng trạng thái gửi hụt và đang chờ nằm nhỏ gọn BÊN DƯỚI bong bóng tin của Jack */
    .danh-sach-trang-thai-duoi-tin {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      width: 100%;
      margin-top: 4px;
    }
    .dong-tin-user .dong-song-trang-thai.hut {
      background: #fee2e2 !important;
      border: 1px solid #fca5a5 !important;
      color: #991b1b !important;
      font-size: 11px !important;
      padding: 3px 8px !important;
      margin-top: 2px !important;
      box-shadow:  var(--bong-1);
    }

    /* CR §5.5: Banner đoạn nói chưa gửi tự thu gọn 1 dòng nhỏ sau 10 phút */
    #dosBannerKhoiPhuc.thu-gon {
      padding: 3px 10px !important;
      font-size: 11px !important;
      margin: 3px 0 !important;
      min-height: 26px !important;
      background: #fefce8 !important;
      border: 1px dashed #eab308 !important;
      border-radius: 6px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: space-between !important;
      opacity: 0.92;
    }
    #dosBannerKhoiPhuc.thu-gon:hover {
      opacity: 1;
    }
    #dosBannerKhoiPhuc.thu-gon span {
      font-size: 11px !important;
      font-weight: 500 !important;
      color: #854d0e !important;
    }
    #dosBannerKhoiPhuc.thu-gon .dos-banner-actions {
      gap: 6px !important;
    }
    #dosBannerKhoiPhuc.thu-gon button {
      padding: 1px 8px !important;
      font-size: 11px !important;
      min-height: 22px !important;
      line-height: 18px !important;
    }

    /* KV-018: BỐ CỤC ĐỌC TỐI ƯU & CHỐNG BỨC TƯỜNG CHỮ (MAX-WIDTH 520PX) */
    .bong-tin, .doan-tin-nhan {
      max-width: 520px;
      line-height: 1.65;
    }

    .bong-tin p {
      margin-bottom: 12px;
      line-height: 1.65;
      max-width: 520px;
    }

    .bong-tin p:last-child {
      margin-bottom: 0;
    }

    .bong-tin code {
      background: #f1f5f9;
      padding: 2px 6px;
      border-radius: 4px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 13px;
      border: 1px solid var(--card-border);
      color: #0284c7;
      white-space: pre-wrap !important;
      word-break: break-word !important;
      overflow-wrap: anywhere !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }

    .code-block-wrapper {
      background: #f8fafc;
      border: 1px solid var(--card-border);
      border-radius: 6px;
      margin: 8px 0;
      overflow: hidden;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }

    .code-header {
      background: #f1f5f9;
      padding: 4px 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12px;
      color: var(--text-muted);
      border-bottom: 1px solid var(--card-border);
    }

    .btn-copy-code {
      min-height: 44px;
      min-width: 44px;
      padding: 0 10px;
      font-size: 12px;
      background: transparent;
      color: var(--primary);
    }

    .code-block-wrapper pre {
      padding: 10px 12px;
      overflow-x: auto;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 13px;
      line-height: 1.45;
      white-space: pre-wrap !important;
      word-break: break-word !important;
      overflow-wrap: anywhere !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }

    pre, code {
      white-space: pre-wrap !important;
      word-break: break-word !important;
      overflow-wrap: anywhere !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }

    .bong-tin ul, .bong-tin ol {
      margin-left: 20px;
      margin-bottom: 8px;
    }

    .bong-tin blockquote {
      border-left: 3px solid var(--primary);
      padding-left: 10px;
      margin: 8px 0;
      color: var(--text-muted);
      background: rgba(56, 189, 248, 0.05);
      border-radius: 0 4px 4px 0;
    }

    /* Bảng biểu Markdown cuộn ngang trong khung (Issue 5.5) */
    .bang-cuon-ngang-wrap {
      width: 100%;
      max-width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      margin: 10px 0;
      border: 1px solid var(--card-border);
      border-radius: 6px;
      background: #ffffff;
    }

    .bang-markdown {
      width: 100%;
      min-width: 240px;
      border-collapse: collapse;
      text-align: left;
      font-size: 13px;
      line-height: 1.5;
    }

    .bang-markdown th {
      background: #f1f5f9;
      color: var(--text);
      font-weight: 700;
      padding: 8px 12px;
      border-bottom: 2px solid var(--card-border);
      white-space: nowrap;
    }

    .bang-markdown td {
      padding: 8px 12px;
      border-bottom: 1px solid #e2e8f0;
      color: var(--text);
      vertical-align: top;
    }

    .bang-markdown tr:last-child td {
      border-bottom: none;
    }

    .bang-markdown tr:hover td {
      background: #f8fafc;
    }

    /* Đường dẫn Markdown bấm được (Issue 5.5) */
    .link-markdown {
      color: var(--primary);
      text-decoration: underline;
      word-break: break-all;
    }
    .link-markdown:hover {
      color: var(--primary-hover);
    }

    /* Dòng trạng thái sổ nội bộ - nhỏ gọn, mờ, riêng biệt (Issue 5.3) */
    .dong-trang-thai-so-noi-bo {
      font-size: 12px;
      color: var(--text-dim);
      background: var(--gray-bg);
      border: 1px dashed var(--card-border);
      border-radius: 6px;
      padding: 4px 10px;
      margin-bottom: 8px;
      display: inline-block;
      line-height: 1.4;
      max-width: 100%;
      word-break: break-word;
    }

    /* ═══════════════════════════════════════════════════════════════
       TỜ GIAO BW (§5.1 - §5.4): TRÌNH BÀY TIN JACK, TÁCH TIN, ĐÍNH KÈM
       ═══════════════════════════════════════════════════════════════ */

    /* §5.1 Ranh giới giữa 2 tin cùng người gửi đến sát nhau */
    .ranh-gioi-doan-tin {
      margin: 12px 0 8px 0;
      padding-top: 8px;
      border-top: 1px dashed rgba(14, 165, 233, 0.45);
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 6px;
    }
    .dong-tin-agent .ranh-gioi-doan-tin {
      border-top-color: rgba(148, 163, 184, 0.45);
      justify-content: flex-start;
    }
    .dong-gio-doan-tin {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-dim);
      background: rgba(255, 255, 255, 0.85);
      padding: 2px 8px;
      border-radius: 4px;
      border: 1px solid rgba(0, 0, 0, 0.06);
    }

    /* §5.2 Khối mã lệnh giữ nguyên khoảng trắng & cuộn ngang trong khối */
    .la-ban-code-box pre,
    .la-ban-code-box pre code {
      white-space: pre !important;
      word-break: normal !important;
      overflow-wrap: normal !important;
      overflow-x: auto !important;
      -webkit-overflow-scrolling: touch !important;
    }

    /* §5.2 Tiêu đề & Danh sách Markdown */
    .tieu-de-chat-h2 {
      font-size: 16px;
      font-weight: 700;
      margin: 12px 0 6px 0;
      color: inherit;
    }
    .tieu-de-chat-h3 {
      font-size: 15px;
      font-weight: 700;
      margin: 10px 0 4px 0;
      color: inherit;
    }
    .tieu-de-chat-h4 {
      font-size: 14px;
      font-weight: 700;
      margin: 8px 0 4px 0;
      color: inherit;
    }
    .danh-sach-so-chat {
      margin-left: 22px;
      margin-bottom: 8px;
      padding-left: 0;
    }
    .danh-sach-so-chat li {
      margin-bottom: 4px;
      line-height: 1.5;
    }

    /* §5.2 Đường dẫn tệp dạng nút bấm mở được (chuẩn ngón tay >= 44px) */
    .nhan-tep-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 12px;
      min-height: 44px;
      font-size: 12.5px;
      font-weight: 600;
      color: #0369a1;
      background: #f0f9ff;
      border: 1px solid #7dd3fc;
      border-radius: 6px;
      cursor: pointer;
      margin: 4px 2px;
      max-width: 100%;
      box-sizing: border-box;
      transition: background 0.15s, border-color 0.15s;
    }
    .nhan-tep-link:hover {
      background: #e0f2fe;
      border-color: #0284c7;
    }

    /* §5.3 Thẻ ảnh nhỏ xem trước (chạm mở to, onerror hiện tên tệp ngắn) */
    .the-anh-dinh-kem-tin {
      display: inline-block;
      max-width: 280px;
      margin: 8px 0;
      padding: 6px;
      background: #ffffff;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      cursor: pointer;
      box-shadow:  var(--bong-2);
      transition: transform 0.15s ease, box-shadow 0.15s ease;
      min-height: 44px;
      box-sizing: border-box;
    }
    .the-anh-dinh-kem-tin:hover {
      transform: translateY(-1px);
      box-shadow:  var(--bong-3);
      border-color: #0284c7;
    }
    .anh-nho-xem-truoc {
      width: 100%;
      max-height: 160px;
      object-fit: cover;
      border-radius: 4px;
      display: block;
    }
    .chu-thich-anh-nho {
      font-size: 12px;
      color: #64748b;
      margin-top: 4px;
      display: flex;
      align-items: center;
      gap: 4px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .the-ten-tep-ngan {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 12px;
      min-height: 44px;
      font-size: 12.5px;
      font-weight: 600;
      color: #0369a1;
      background: #f0f9ff;
      border: 1px solid #bae6fd;
      border-radius: 6px;
      box-sizing: border-box;
    }

    /* §5.4 Nút xem bản thô nguyên văn (>= 44px) và khung bản thô */
    .btn-chuyen-ban-tho {
      min-height: 44px;
      min-width: 44px;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 600;
      color: #475569;
      background: rgba(255, 255, 255, 0.85);
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      margin-left: auto;
      transition: all 0.15s ease;
      box-sizing: border-box;
    }
    .btn-chuyen-ban-tho:hover {
      background: #f1f5f9;
      color: #0f172a;
      border-color: #94a3b8;
    }
    .khung-ban-tho-nguyen-van {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 13px;
      line-height: 1.55;
      white-space: pre-wrap !important;
      word-break: break-word !important;
      background: rgba(0, 0, 0, 0.04);
      padding: 10px 14px;
      border-radius: 6px;
      border: 1px solid rgba(0, 0, 0, 0.08);
      margin: 6px 0;
      color: inherit;
    }

    /* Trạng thái chưa có cuộc trò chuyện (Bắt buộc) */
    .khong-co-cuoc-tro-chuyen {
      margin: auto;
      text-align: center;
      padding: 36px 20px;
      max-width: 420px;
    }

    .khong-co-cuoc-tro-chuyen .icon-trong {
      font-size: 42px;
      margin-bottom: 12px;
      opacity: 0.8;
    }

    .khong-co-cuoc-tro-chuyen h3 {
      font-size: 16px;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 8px;
    }

    .khong-co-cuoc-tro-chuyen p {
      font-size: 14px;
      color: var(--text-muted);
    }

    .dang-tai-tin {
      margin: auto;
      text-align: center;
      padding: 30px;
      color: var(--primary);
      font-weight: 600;
      font-size: 14px;
    }

    /* Khung nhập tin nhắn & Gửi */
    .khung-nhap-tin {
      padding: 14px 16px;
      background: #ffffff;
      border-top: 1px solid var(--card-border);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .o-nhap-tin-cuoc {
      width: 100%;
      background: #ffffff;
      border: 1px solid var(--card-border);
      color: var(--text);
      padding: 12px 14px;
      font-size: 15px;
      line-height: 1.5;
      min-height: 72px;
      max-height: 40vh;
      resize: none;
      border-radius: 8px;
      box-sizing: border-box;
      overflow-y: auto;
      transition: border-color 0.15s;
    }

    .o-nhap-tin-cuoc:focus {
      border-color: var(--primary);
    }

    /* Phóng to ô soạn thảo gần kín màn (§5.7) */
    .khung-nhap-tin.soan-thao-phong-to {
      position: fixed !important;
      top: 12px !important;
      left: 12px !important;
      right: 12px !important;
      bottom: 12px !important;
      z-index: var(--z-hop-thoai, 600) !important;
      background: #ffffff !important;
      border-radius: 12px !important;
      box-shadow:  var(--bong-4) !important;
      border: 2px solid var(--primary) !important;
      padding: 16px !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 12px !important;
    }
    .khung-nhap-tin.soan-thao-phong-to .o-nhap-tin-cuoc {
      flex: 1 !important;
      min-height: 200px !important;
      max-height: none !important;
      height: 100% !important;
      font-size: 16px !important;
      line-height: 1.6 !important;
      overflow-y: auto !important;
    }
    .soan-thao-phong-to-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.5);
      z-index: var(--z-lop-phu, 400);
      
    }

    .thanh-hanh-dong-nhap {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .cong-cu-nhap-nhom {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .btn-cong-cu {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      min-width: 44px;
      min-height: 44px;
      padding: 8px 12px;
      background: var(--bg-card);
      color: var(--text-main);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-sm);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      box-sizing: border-box;
      transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }

    .btn-cong-cu:hover {
      background: var(--bg-input);
      border-color: var(--border-hover);
    }

    .btn-cong-cu.dang-nghe {
      background: rgba(239, 68, 68, 0.15);
      border-color: var(--red);
      color: var(--red);
      animation: none;
    }

    /* ==========================================================================
       QUICK ACTION PROMPT CHIPS & APPLE CAPSULE PREVIEW (WO-QUICK-PROMPT-CHIPS-AND-CAPSULE-PREVIEW)
       ========================================================================== */
    .thanh-prompt-chips,
    #thanh-prompt-chips {
      display: flex !important;
      align-items: center !important;
      gap: 6px !important;
      overflow-x: auto !important;
      scrollbar-width: none !important;
      -ms-overflow-style: none !important;
      padding: 4px 2px !important;
      margin-bottom: 6px !important;
      -webkit-overflow-scrolling: touch !important;
      flex-wrap: nowrap !important;
      width: 100% !important;
      box-sizing: border-box !important;
      user-select: none !important;
    }
    .thanh-prompt-chips::-webkit-scrollbar {
      display: none !important;
    }

    .chip-item {
      background: rgba(255, 255, 255, 0.75) !important;
      backdrop-filter: blur(10px) !important;
      -webkit-backdrop-filter: blur(10px) !important;
      border: 1px solid rgba(203, 213, 225, 0.8) !important;
      border-radius: 14px !important;
      padding: 4px 10px !important;
      font-size: 11.5px !important;
      font-weight: 600 !important;
      color: #334155 !important;
      white-space: nowrap !important;
      cursor: pointer !important;
      transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
      min-height: 28px !important;
      height: 28px !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      flex: 0 0 auto !important;
      box-sizing: border-box !important;
      touch-action: manipulation !important;
      line-height: 1 !important;
    }

    .chip-item:hover,
    .chip-item:focus-visible {
      background: rgba(2, 132, 199, 0.15) !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
      transform: translateY(-1px) translateZ(0) !important;
    }

    .chip-item:active {
      transform: translateY(0) scale(0.97) !important;
      background: rgba(2, 132, 199, 0.25) !important;
    }

    .chip-item.chip-quant {
      border-color: rgba(16, 185, 129, 0.4) !important;
      color: #059669 !important;
    }
    .chip-item.chip-quant:hover,
    .chip-item.chip-quant:focus-visible {
      background: rgba(16, 185, 129, 0.15) !important;
      border-color: #10b981 !important;
      color: #059669 !important;
    }

    /* Dark theme support for Prompt Chips */
    [data-theme="dark"] .chip-item,
    [data-theme="obsidian"] .chip-item,
    [data-theme="cyber"] .chip-item,
    [data-theme="space"] .chip-item,
    .theme-dark .chip-item {
      background: rgba(30, 41, 59, 0.75) !important;
      border-color: rgba(71, 85, 105, 0.8) !important;
      color: #cbd5e1 !important;
    }

    [data-theme="dark"] .chip-item:hover,
    [data-theme="dark"] .chip-item:focus-visible,
    [data-theme="obsidian"] .chip-item:hover,
    [data-theme="obsidian"] .chip-item:focus-visible,
    [data-theme="cyber"] .chip-item:hover,
    [data-theme="cyber"] .chip-item:focus-visible,
    [data-theme="space"] .chip-item:hover,
    [data-theme="space"] .chip-item:focus-visible,
    .theme-dark .chip-item:hover,
    .theme-dark .chip-item:focus-visible {
      background: rgba(56, 189, 248, 0.2) !important;
      border-color: #38bdf8 !important;
      color: #38bdf8 !important;
    }

    [data-theme="dark"] .chip-item.chip-quant,
    [data-theme="obsidian"] .chip-item.chip-quant,
    [data-theme="cyber"] .chip-item.chip-quant,
    [data-theme="space"] .chip-item.chip-quant,
    .theme-dark .chip-item.chip-quant {
      border-color: rgba(52, 211, 153, 0.4) !important;
      color: #34d399 !important;
    }
    [data-theme="dark"] .chip-item.chip-quant:hover,
    [data-theme="dark"] .chip-item.chip-quant:focus-visible,
    [data-theme="obsidian"] .chip-item.chip-quant:hover,
    [data-theme="obsidian"] .chip-item.chip-quant:focus-visible,
    [data-theme="cyber"] .chip-item.chip-quant:hover,
    [data-theme="cyber"] .chip-item.chip-quant:focus-visible,
    [data-theme="space"] .chip-item.chip-quant:hover,
    [data-theme="space"] .chip-item.chip-quant:focus-visible,
    .theme-dark .chip-item.chip-quant:hover,
    .theme-dark .chip-item.chip-quant:focus-visible {
      background: rgba(52, 211, 153, 0.2) !important;
      border-color: #34d399 !important;
      color: #6ee7b7 !important;
    }

    /* Mobile touch target for chips */
    @media (max-width: 768px) {
      .chip-item {
        min-height: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
        padding: 5px 11px !important;
        border-radius: 16px !important;
      }
    }

    /* Apple Liquid Glass Capsule Attachment Preview */
    .khung-xem-truoc-dinh-kem,
    #khung-xem-truoc-dinh-kem {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
      padding: 6px 10px;
      background: rgba(241, 245, 249, 0.85);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(2, 132, 199, 0.3);
      border-radius: 16px;
      box-shadow: 0 2px 10px rgba(2, 132, 199, 0.08);
      max-height: 54px;
      overflow-x: auto;
      overflow-y: hidden;
      scrollbar-width: none;
      -ms-overflow-style: none;
      -webkit-overflow-scrolling: touch;
      box-sizing: border-box;
      width: 100%;
    }
    .khung-xem-truoc-dinh-kem::-webkit-scrollbar {
      display: none !important;
    }

    .khung-xem-truoc-dinh-kem:empty,
    #khung-xem-truoc-dinh-kem:empty,
    .khung-xem-truoc-dinh-kem[style*="display: none"],
    #khung-xem-truoc-dinh-kem[style*="display: none"],
    .khung-xem-truoc-dinh-kem[style*="display:none"],
    #khung-xem-truoc-dinh-kem[style*="display:none"] {
      display: none !important;
      margin: 0 !important;
      padding: 0 !important;
      border: none !important;
      height: 0 !important;
      max-height: 0 !important;
      visibility: hidden !important;
    }

    [data-theme="dark"] .khung-xem-truoc-dinh-kem,
    [data-theme="obsidian"] .khung-xem-truoc-dinh-kem,
    [data-theme="cyber"] .khung-xem-truoc-dinh-kem,
    [data-theme="space"] .khung-xem-truoc-dinh-kem,
    .theme-dark .khung-xem-truoc-dinh-kem {
      background: rgba(15, 23, 42, 0.85) !important;
      border-color: rgba(56, 189, 248, 0.3) !important;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    }

    .the-dinh-kem {
      display: inline-flex !important;
      align-items: center !important;
      gap: 7px !important;
      padding: 3px 8px 3px 6px !important;
      background: rgba(255, 255, 255, 0.85) !important;
      border: 1px solid rgba(203, 213, 225, 0.8) !important;
      border-radius: 12px !important;
      font-size: 12px !important;
      font-weight: 500 !important;
      color: #1e293b !important;
      white-space: nowrap !important;
      flex: 0 0 auto !important;
      box-sizing: border-box !important;
      max-width: 250px !important;
      transition: all 0.15s ease !important;
    }

    [data-theme="dark"] .the-dinh-kem,
    [data-theme="obsidian"] .the-dinh-kem,
    [data-theme="cyber"] .the-dinh-kem,
    [data-theme="space"] .the-dinh-kem,
    .theme-dark .the-dinh-kem {
      background: rgba(30, 41, 59, 0.85) !important;
      border-color: rgba(71, 85, 105, 0.8) !important;
      color: #f1f5f9 !important;
    }

    .the-dinh-kem img {
      width: 32px !important;
      height: 32px !important;
      object-fit: cover !important;
      border-radius: 6px !important;
      border: 1px solid rgba(0, 0, 0, 0.1) !important;
      flex-shrink: 0 !important;
    }

    .the-dinh-kem .tep-icon {
      font-size: 16px !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      width: 30px !important;
      height: 30px !important;
      border-radius: 6px !important;
      background: rgba(2, 132, 199, 0.1) !important;
      flex-shrink: 0 !important;
    }

    .the-dinh-kem .tep-thong-tin {
      display: flex !important;
      flex-direction: column !important;
      overflow: hidden !important;
      max-width: 150px !important;
      line-height: 1.25 !important;
    }

    .the-dinh-kem .tep-ten {
      font-size: 11.5px !important;
      font-weight: 600 !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
      white-space: nowrap !important;
    }

    .the-dinh-kem .tep-dung-luong {
      font-size: 10px !important;
      color: #64748b !important;
      font-weight: 500 !important;
    }

    [data-theme="dark"] .the-dinh-kem .tep-dung-luong,
    [data-theme="obsidian"] .the-dinh-kem .tep-dung-luong,
    [data-theme="cyber"] .the-dinh-kem .tep-dung-luong,
    [data-theme="space"] .the-dinh-kem .tep-dung-luong,
    .theme-dark .the-dinh-kem .tep-dung-luong {
      color: #94a3b8 !important;
    }

    .the-dinh-kem .nut-xoa-dinh-kem {
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      width: 22px !important;
      min-width: 22px !important;
      height: 22px !important;
      min-height: 22px !important;
      border-radius: 50% !important;
      border: none !important;
      background: rgba(148, 163, 184, 0.25) !important;
      color: #64748b !important;
      font-size: 11px !important;
      font-weight: 700 !important;
      cursor: pointer !important;
      padding: 0 !important;
      margin-left: 4px !important;
      transition: all 0.15s ease !important;
      line-height: 1 !important;
      flex-shrink: 0 !important;
    }

    .the-dinh-kem .nut-xoa-dinh-kem:hover,
    .the-dinh-kem .nut-xoa-dinh-kem:focus-visible {
      background: rgba(239, 68, 68, 0.2) !important;
      color: #ef4444 !important;
      transform: scale(1.1) !important;
    }

    .thong-bao-gui-tin {
      margin-top: 2px;
      min-height: 22px;
      max-height: 30px;
      padding: 2px 8px;
      border-radius: var(--radius-sm);
      font-size: 12px;
      line-height: 1.2;
      box-sizing: border-box;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .thong-bao-gui-tin.thanh-cong {
      background: #dcfce7;
      border: 1px solid var(--green);
      color: #15803d;
    }

    .thong-bao-gui-tin.that-bai {
      background: #fee2e2;
      border: 1px solid var(--red);
      color: #b91c1c;
    }

    .thong-bao-gui-tin.khong-mo-phien {
      background: #fef3c7;
      border: 1px solid #f59e0b;
      color: #92400e;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 8px;
    }

    .btn-mo-phien {
      background: #2563eb;
      color: #ffffff;
      border: none;
      padding: 5px 12px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      text-decoration: none;
      transition: background 0.15s;
    }

    .btn-mo-phien:hover {
      background: #1d4ed8;
    }

    .dong-tin-system {
      display: flex;
      justify-content: center;
      margin: 12px 0;
    }

    .bong-tin-system {
      padding: 10px 16px;
      border-radius: 10px;
      font-size: 13px;
      max-width: 520px;
      width: 100%;
      text-align: left;
      box-sizing: border-box;
      background: rgba(99, 102, 241, 0.08);
      border: 1px solid rgba(99, 102, 241, 0.35);
      color: #312e81;
      position: relative;
    }

    .bong-tin-system::before {
      content: "🤖 TÓM TẮT HỆ THỐNG";
      display: block;
      font-size: 11px;
      font-weight: 800;
      color: #6366f1;
      letter-spacing: 0.5px;
      margin-bottom: 4px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    }

    .bong-tin-system.system-thanh-cong {
      background: #f0fdf4;
      border: 1px solid #86efac;
      color: #166534;
    }
    .bong-tin-system.system-thanh-cong::before {
      content: "✓ THÔNG BÁO HỆ THỐNG";
      color: #16a34a;
    }

    .bong-tin-system.system-canh-bao {
      background: #fef2f2;
      border: 1px solid #fca5a5;
      color: #991b1b;
      text-align: left;
    }
    .bong-tin-system.system-canh-bao::before {
      content: "⚠️ CẢNH BÁO HỆ THỐNG";
      color: #dc2626;
    }

    .thong-tin-ban-nhap {
      font-size: 12px;
      color: var(--yellow);
      display: flex;
      align-items: center;
      gap: 6px;
      min-height: 20px;
    }

    .nut-gui-nhom {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    /* Badge trạng thái */
    .badge-status {
      padding: 4px 10px;
      border-radius: 9999px;
      font-size: 12px;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }

    .badge-status::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: currentColor;
    }

    .status-dang-lam {
      background: var(--green-bg);
      color: var(--green);
    }

    .status-dang-cho {
      background: var(--yellow-bg);
      color: var(--yellow);
    }

    .status-khong-doc {
      background: var(--gray-bg);
      color: var(--gray);
    }

    /* Khối cảnh báo trung thực khi ghế hết lượt / lỗi */
    .canh-bao-het-luot {
      background: #fef2f2;
      border: 1px solid #fecaca;
      border-radius: 8px;
      padding: 14px 16px;
      color: #991b1b;
    }

    .canh-bao-tieu-de {
      font-size: 15px;
      font-weight: 700;
      color: #dc2626;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .canh-bao-dong {
      font-size: 13px;
      margin-bottom: 5px;
      line-height: 1.4;
    }

    .canh-bao-dong strong {
      color: #0f172a;
    }

    .mang-binh-thuong {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px dashed rgba(239, 68, 68, 0.25);
      font-size: 12px;
      color: #94a3b8;
    }

    /* Bố cục khu Giao việc nhanh (KV-044: Bỏ viền thừa, dùng khoảng trống và sắc độ) */
    .grid-layout {
      display: flex;
      flex-direction: column;
      max-width: 900px;
      margin: 0 auto 30px auto;
      gap: 16px;
    }

    .panel {
      background: #ffffff;
      border: 1px solid rgba(226, 232, 240, 0.7);
      border-radius: 12px;
      padding: 20px 24px;
      box-shadow:  var(--bong-2);
    }

    .panel-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
      border-bottom: none;
      padding-bottom: 0;
    }

    .panel-title {
      font-size: 16px;
      font-weight: 700;
      color: var(--text, #0f172a);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .panel-stats {
      font-size: 13px;
      color: #64748b;
    }

    .danh-sach-ghe {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .the-ghe {
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 12px 16px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      transition: border-color 0.15s;
      box-sizing: border-box;
      width: 100%;
    }

    .the-ghe:hover {
      border-color: #94a3b8;
    }

    .ghe-info {
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-width: 0;
      flex: 1 1 180px;
      overflow: hidden;
    }

    .ghe-ten {
      font-size: 15px;
      font-weight: 600;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      min-width: 0;
      word-break: break-word;
    }

    .ghe-alias {
      font-size: 12px;
      color: var(--text-dim);
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      word-break: break-all;
    }

    .ghe-tin-cuoi {
      font-size: 12px;
      color: var(--text-muted);
    }

    .ghe-action {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      flex-shrink: 0;
    }

    .form-group {
      margin-bottom: 14px;
    }

    label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    select, textarea, input[type="text"] {
      width: 100%;
      background: #ffffff;
      border: 1px solid var(--card-border);
      color: var(--text);
      padding: 10px 14px;
    }

    select:focus, textarea:focus, input[type="text"]:focus {
      border-color: var(--primary);
    }

    textarea {
      resize: vertical;
      min-height: 88px;
    }

    .hop-ket-qua {
      margin-top: 16px;
      background: #ffffff;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 16px;
      display: none;
    }

    .hop-ket-qua.hien {
      display: block;
    }

    .chi-tiet-tra-loi {
      margin-top: 10px;
      font-size: 12px;
      color: var(--text);
      background: #f8fafc;
      border: 1px solid var(--card-border);
      padding: 10px;
      border-radius: 6px;
      max-height: 220px;
      overflow-y: auto;
      white-space: pre-wrap;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    }

    .thong-bao-nhanh {
      font-size: 12px;
      color: var(--green);
      margin-top: 6px;
      min-height: 18px;
    }

    /* WO-UI-CK 08/09: Xem và đổi máy nghĩ ngay trong buồng lái */
    .thanh-may-nghi-cuoc {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 6px 12px;
      background: #f8fafc;
      border-bottom: 1px solid var(--card-border, #e2e8f0);
      min-height: 48px;
      box-sizing: border-box;
      flex-shrink: 0;
      z-index: var(--z-thanh-dinh, 20);
    }
    .thong-tin-may-nghi {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 1;
      min-width: 0;
      overflow: hidden;
      font-size: 13px;
      color: var(--text, #0f172a);
    }
    .icon-may {
      font-size: 16px;
      flex-shrink: 0;
    }
    .nhan-may-chu {
      color: #64748b;
      font-weight: 500;
      flex-shrink: 0;
    }
    .ten-may-nghi {
      font-weight: 700;
      color: #0f172a;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .ten-may-nghi.chua-doc-duoc {
      color: #b45309;
      font-weight: 600;
      font-style: italic;
    }
    .muc-nghi-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 600;
      background: #e0f2fe;
      color: #0369a1;
      flex-shrink: 0;
    }
    .btn-doi-may {
      min-height: 44px;
      min-width: 80px;
      padding: 6px 14px;
      font-size: 13px;
      font-weight: 600;
      border-radius: 6px;
      border: 1px solid var(--card-border, #cbd5e1);
      background: #ffffff;
      color: var(--text, #0f172a);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      box-shadow:  var(--bong-1);
    }
    .btn-doi-may:active {
      background: #f1f5f9;
    }
    .modal-backdrop-doi-may {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.6);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: var(--z-lop-phu, 400);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
      box-sizing: border-box;
    }
    .modal-box-doi-may {
      background: #ffffff;
      border-radius: 12px;
      width: 100%;
      max-width: 440px;
      box-shadow:  var(--bong-4);
      overflow: hidden;
      border: 1px solid #cbd5e1;
    }
    .modal-header-doi-may {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      background: #f8fafc;
      border-bottom: 1px solid #e2e8f0;
    }
    .khung-goi-y-nang-cap-model {
      display: flex;
      box-sizing: border-box;
      width: 100%;
    }

@media (max-width: 639px), (pointer: coarse) {
  /* Việc 1: chỉ giữ hai dải điều hướng gọn, phần còn lại dành cho nội dung. */
  .bang-chuyen-nhanh-khung{height:50px!important;padding:3px 4px!important;}
  .chip-chuyen-nhanh{min-height:44px!important;font-size:12px!important;padding:3px 8px!important;}
  .hang-the-trang-doc{min-height:44px!important;padding:2px 4px!important;}
  .the-trang-item{min-height:44px!important;font-size:12px!important;padding:2px 6px!important;}
  .thanh-may-nghi-cuoc{min-height:40px!important;height:40px!important;padding:3px 8px!important;font-size:11px!important;}
  .thanh-may-nghi-cuoc .btn-doi-may{min-height:44px!important;font-size:11px!important;padding:0 6px!important;}
}

@media (max-width: 639px), (pointer: coarse) {
  /* Việc 2: tay nắm và nút bản đồ nằm gọn trong mép màn, không thò ra ngoài hay đè tin nhắn. */
  .tay-nam-mo-drawer { display: none !important; }
  #ban-do-noi-nut{
    position: fixed !important;
    right: 10px !important;
    left: auto !important;
    top: auto !important;
    bottom: 220px !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    z-index: var(--z-hop-noi, 100) !important;
    opacity: 0.95 !important;
  }
  #ban-do-noi-nut button,#ban-do-noi-nut [role="button"]{min-width:44px!important;min-height:44px!important;}
  .bdn-sleeping-zzz{top:-4px!important;right:-2px!important;font-size:10px!important;}
}

@media (max-width: 639px), (pointer: coarse) {
  /* Việc 3: vùng trống không nuốt chiều cao; tin/placeholder bám về đầu vùng đọc. */
  .khung-tin-nhan{justify-content:flex-start!important;align-content:flex-start!important;padding-right:12px!important;box-sizing:border-box!important;}
  .khong-co-cuoc-tro-chuyen{margin:8px 0!important;padding:12px!important;min-height:96px!important;}
  .thanh-may-nghi-cuoc:has(+ .khung-tim-dropdown[style*="display: none"]){margin-bottom:0!important;}
}

@media (max-width: 639px), (pointer: coarse) {
  /* Việc 4: composer xếp 2 hàng gọn: Hàng 1 đủ 4 nút công cụ ≥44px, Hàng 2 nút gửi tin nhắn. */
  .khung-nhap-tin{gap:4px!important;padding:4px 6px 12px 6px!important;box-sizing:border-box!important;max-height:46dvh!important;}
  .o-nhap-tin-cuoc{min-height:60px!important;max-height:32vh!important;padding:6px 8px!important;font-size:16px!important;line-height:1.35!important;}
  .khung-xem-truoc-dinh-kem{max-height:44px!important;overflow-x:auto!important;overflow-y:hidden!important;margin:0!important;}
  .khung-goi-y-nang-cap-model{max-height:48px!important;overflow:hidden!important;margin:0!important;padding:3px 6px!important;}
  
  #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap{
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:6px!important;
    min-width:0!important;
    width:100%!important;
    overflow:visible!important;
  }
  #khung-nhap-tin-cuoc .cong-cu-nhap-nhom{
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
    flex:1 1 auto!important;
    overflow-x:auto!important;
    scrollbar-width:none!important;
  }
  #khung-nhap-tin-cuoc .cong-cu-nhap-nhom .btn-cong-cu,
  #khung-nhap-tin-cuoc #btn-mic-giong-noi,
  #khung-nhap-tin-cuoc #btn-dinh-kem-anh,
  #khung-nhap-tin-cuoc #btn-dinh-kem-tep,
  #khung-nhap-tin-cuoc #btn-phong-to-nhap{
    min-width:44px!important;
    min-height:44px!important;
    height:44px!important;
    font-size:12px!important;
    line-height:1.1!important;
    padding:0 10px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    box-sizing:border-box!important;
    border-radius:9999px!important;
  }
  #khung-nhap-tin-cuoc .nut-gui-nhom{
    flex:0 0 auto!important;
    display:flex!important;
    align-items:center!important;
  }
  #khung-nhap-tin-cuoc #btn-gui-tin-nhan{
    width:44px!important;
    min-width:44px!important;
    min-height:44px!important;
    height:44px!important;
    border-radius:9999px!important;
    padding:0!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    box-sizing:border-box!important;
  }
  .thong-tin-ban-nhap{display:none!important;}
  .thong-bao-gui-tin{max-height:28px!important;min-height:20px!important;margin:0!important;padding:2px 6px!important;font-size:11px!important;}
  .khung-tin-nhan{padding-bottom:190px!important;}
}

@media (max-width:480px){
  /* §VIỆC A: Kim xăng AI gấp lại mặc định gọn gàng ở khổ nhỏ */
  .kim-xang-wrap{margin-bottom:12px!important;}
  .kim-xang-bar{padding:6px 10px!important;gap:4px!important;min-height:44px!important;border-radius:8px!important;}
  .kim-xang-wrap:not(.kx-da-mo-tay) .kim-xang-grid{display:none!important;}
  .kim-xang-wrap:not(.kx-da-mo-tay) .kim-xang-dong-gon{display:flex!important;}
  .kim-xang-header-row{gap:4px!important;flex-wrap:nowrap!important;justify-content:space-between!important;align-items:center!important;}
  .kim-xang-title-group{font-size:12px!important;gap:4px!important;flex-wrap:nowrap!important;overflow:hidden!important;min-width:0!important;flex:1 1 auto!important;}
  .kim-xang-badge-main{font-size:12px!important;white-space:nowrap!important;letter-spacing:0!important;}
  .kim-xang-tuoi-tag{font-size:11px!important;padding:2px 6px!important;white-space:nowrap!important;}
  .kim-xang-actions-row{gap:4px!important;flex-shrink:0!important;}
  .btn-kx-toggle-gap{min-height:44px!important;min-width:44px!important;padding:0 8px!important;font-size:12px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;box-sizing:border-box!important;}
  .btn-kx-mo-ke{display:none!important;}
  .kim-xang-dong-gon{font-size:11px!important;padding:4px 8px!important;margin-top:2px!important;line-height:1.25!important;}
  .trang-thai-lam-moi-chat{margin:4px 0 2px 0!important;font-size:11px!important;line-height:1.3!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
  .ban-dang-xem{margin:2px 0 4px 0!important;font-size:11px!important;line-height:1.3!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}

  /* §VIỆC A: Thanh công cụ đỉnh không tràn mép ở 229px & hiện đủ tên ghế */
  .thanh-dau-doc-cuoc{
    height:48px!important;
    min-height:48px!important;
    max-height:48px!important;
    padding:0 4px!important;
    gap:4px!important;
    width:100%!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }
  .thanh-dau-trai{
    min-width:0!important;
    flex:1 1 auto!important;
    padding:1px 2px!important;
    gap:4px!important;
    overflow:hidden!important;
  }
  .thanh-dau-avatar{
    width:22px!important;
    height:22px!important;
    font-size:12px!important;
    flex-shrink:0!important;
  }
  .thanh-dau-ten-wrap{
    min-width:0!important;
    flex:1 1 auto!important;
    overflow:hidden!important;
    gap:0!important;
  }
  .thanh-dau-dong-ten{
    min-width:0!important;
    overflow:hidden!important;
    gap:3px!important;
  }
  .thanh-dau-ten-ghe{
    font-size:12px!important;
    font-weight:700!important;
    line-height:14px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .thanh-dau-badge-tt{
    width:8px!important;
    height:8px!important;
    min-width:8px!important;
    min-height:8px!important;
    flex-shrink:0!important;
  }
  .thanh-dau-lan-cuoi{
    font-size:10px!important;
    line-height:12px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .thanh-dau-phai{
    flex-shrink:0!important;
    gap:2px!important;
  }
  #btn-toggle-the-dung { display:none!important; }
  .btn-dieu-huong-ghe{
    min-width:44px!important;
    min-height:44px!important;
    width:44px!important;
    height:44px!important;
    padding:0 3px!important;
    font-size:12px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    box-sizing:border-box!important;
  }

  /* §VIỆC A: Nút '⚡ Cả câu' và '📄 Bản thô' nằm trọn trong màn hình ≥44 điểm */
  .bong-tin-header{
    display:flex!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    gap:4px 6px!important;
    max-width:100%!important;
    overflow:visible!important;
  }
  .btn-menu-ca-cau,
  .btn-chuyen-ban-tho{
    min-height:44px!important;
    min-width:44px!important;
    height:auto!important;
    padding:4px 8px!important;
    font-size:12px!important;
    font-weight:600!important;
    border-radius:6px!important;
    box-sizing:border-box!important;
    touch-action:manipulation!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    margin:2px 0!important;
  }
}
@media (max-width:280px){
  /* Ở khổ cực hẹp 229px: ẩn bớt kính lúp & nút Chi tiết kệ trên thanh kim xăng */
  #btn-mo-tim-trong-cuoc{
    display:none!important;
  }
  .btn-kx-mo-ke{
    display:none!important;
  }
}

  /* ==========================================================================
     CỬA SỔ LỆNH (TERMINAL WORKSPACE) — ƯU TIÊN ĐIỆN THOẠI GẬP 229 ĐIỂM
     ========================================================================== */
  :root {
    --term-bg: #090d16;
    --term-fg: #e2e8f0;
    --term-border: #1e293b;
    --term-accent: #0284c7;
    --term-user-border: #0ea5e9;
    --term-prompt: #22c55e;
    --co-chu-terminal: 12px;
  }

  /* Chủ đề màu Cửa Sổ Lệnh */
  body.term-theme-matrix {
    --term-bg: #030a04;
    --term-fg: #22c55e;
    --term-border: #14532d;
    --term-accent: #16a34a;
    --term-user-border: #4ade80;
    --term-prompt: #86efac;
  }
  body.term-theme-monokai {
    --term-bg: #1e1e1e;
    --term-fg: #f8f8f2;
    --term-border: #3e3d32;
    --term-accent: #fd971f;
    --term-user-border: #a6e22e;
    --term-prompt: #66d9ef;
  }
  body.term-theme-sang {
    --term-bg: #ffffff;
    --term-fg: #0f172a;
    --term-border: #cbd5e1;
    --term-accent: #0284c7;
    --term-user-border: #0284c7;
    --term-prompt: #16a34a;
  }

  /* Khung Cửa Sổ Lệnh chính */
  .khung-cua-so-lenh {
    background: var(--term-bg) !important;
    color: var(--term-fg) !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    position: relative !important;
    overflow-y: auto !important;
    overflow-x: hidden !important; /* Tuyệt đối không tràn ngang */
    padding: 6px 8px !important;
    box-sizing: border-box !important;
    scroll-behavior: smooth;
    user-select: text !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Thanh công cụ Cửa Sổ Lệnh trên đỉnh buồng đọc */
  .thanh-cong-cu-terminal {
    background: #0f172a;
    color: #94a3b8;
    border-bottom: 1px solid #1e293b;
    padding: 6px 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  }
  body.term-theme-sang .thanh-cong-cu-terminal {
    background: #f1f5f9;
    color: #475569;
    border-bottom-color: #cbd5e1;
  }

  .terminal-info-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
  }
  .terminal-ghe-badge {
    background: #1e293b;
    color: #38bdf8;
    border: 1px solid #0284c7;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
  }
  .terminal-metric-text {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
  }

  .terminal-btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
  }

  .btn-term-tool {
    min-height: 44px;
    min-width: 44px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    white-space: nowrap;
  }
  .btn-term-tool:hover {
    background: #334155;
    border-color: #475569;
  }
  .btn-term-tool:active {
    transform: scale(0.96);
  }
  body.term-theme-sang .btn-term-tool {
    background: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
  }

  /* Màn hình hiển thị danh sách dòng */
  #man-hinh-terminal {
    display: block !important;
    min-height: 100%;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important;
  }

  #danh-sach-dong-terminal {
    display: block !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important;
  }

  /* TỪNG DÒNG TERMINAL — QUY TẮC BỀ NGANG 229 ĐIỂM */
  .dong-terminal {
    display: block !important;
    position: relative !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 1.45em !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    font-size: var(--co-chu-terminal, 12px) !important;
    line-height: 1.45 !important;
    white-space: pre-wrap !important; /* Bắt buộc tự xuống dòng */
    word-break: break-word !important; /* Từ dài không phá vỡ layout */
    overflow-wrap: anywhere !important; /* Đảm bảo 229px không trượt ngang */
    padding: 2px 4px !important;
    margin: 0 !important;
    color: inherit;
    box-sizing: border-box !important;
    border-left: 2px solid transparent;
    clear: both !important;
  }

  .dong-terminal:hover {
    background: rgba(255, 255, 255, 0.04);
  }

  /* Phân biệt dòng người gõ vs dòng máy trả về */
  .dong-terminal.dong-nguoi-go {
    border-left: 3px solid var(--term-user-border, #0ea5e9) !important;
    background: rgba(14, 165, 233, 0.08) !important;
    font-weight: 600;
  }
  .dong-terminal.dong-canh-bao {
    border-left: 3px solid #f59e0b !important;
    background: rgba(245, 158, 11, 0.08) !important;
  }
  .dong-terminal.dong-loi {
    border-left: 3px solid #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
  }

  /* Nút nổi cuộn xuống dòng mới nhất */
  .btn-cuon-dong-moi {
    position: fixed;
    bottom: 84px;
    right: 12px;
    min-height: 44px;
    min-width: 44px;
    padding: 0 14px;
    background: #0284c7;
    color: #ffffff;
    border: 1px solid #38bdf8;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 700;
    box-shadow:  var(--bong-3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    z-index: var(--z-hop-noi, 100);
    transition: all 0.15s ease;
    touch-action: manipulation;
  }
  .btn-cuon-dong-moi:hover {
    background: #0369a1;
    transform: translateY(-2px);
  }

  /* Thanh phím tắt nhanh Terminal trong vùng nhập */
  .thanh-phim-terminal {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-bottom: 4px;
  }
  .btn-phim-nhanh {
    min-height: 44px;
    min-width: 44px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: ui-monospace, Menlo, monospace;
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }
  .btn-phim-nhanh:hover {
    background: #334155;
  }
  .btn-phim-nhanh:active {
    background: #0284c7;
    border-color: #38bdf8;
  }
  .btn-phim-ctrl-c {
    background: #450a0a !important;
    color: #fca5a5 !important;
    border-color: #991b1b !important;
  }
  .btn-phim-ctrl-c:hover {
    background: #7f1d1d !important;
  }

  /* Nút chuyển chế độ Gõ thẳng */
  .btn-go-thang {
    background: #1e293b !important;
    color: #38bdf8 !important;
    border-color: #0284c7 !important;
    font-weight: 700 !important;
    transition: all 0.15s ease;
  }
  .btn-go-thang:hover {
    background: #0369a1 !important;
    color: #ffffff !important;
  }
  .btn-go-thang.dang-bat {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
    box-shadow:  var(--bong-5) !important;
  }
  body.term-theme-sang .btn-go-thang {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border-color: #7dd3fc !important;
  }
  body.term-theme-sang .btn-go-thang.dang-bat {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0369a1 !important;
  }

  /* Băng báo trạng thái cầu nối 5197 */
  .bang-trang-thai-bridge {
    background: rgba(2, 132, 199, 0.15);
    border: 1px solid rgba(2, 132, 199, 0.4);
    color: #38bdf8;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
  }
  .bang-trang-thai-bridge.dang-thu {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
  }
  .bang-trang-thai-bridge.that-bai {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
  }

  /* ==========================================================================
     § KHỐI ĐÈ TỪ DU-PHONG.HTML CHO KHỔ HẸP (<= 400 ĐIỂM)
     Ẩn sạch các thanh công cụ cũ (masterTabsBar, depth-limit-group, canvas)
     và ép cứng mọi điểm tương tác còn lại đạt chuẩn >= 44px của Jack.
     ========================================================================== */
  #masterTabsBar,
  .header-tabs-bar,
  .depth-limit-group,
  .tab-btn-add,
  .master-tab,
  [data-action="toggle-tree-orientation"],
  [data-action="toggle-tab-orientation"],
  [data-action="cycle-line-style"],
  [data-action="set-depth-limit"],
  [data-action="set-depth-limit-group"],
  [data-action="new-tab"],
  [data-action="switch-tab"],
  [data-action="close-tab"],
  #canvasSvg,
  .canvas-workspace,
  #dos-canvas-loading {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
  }

  @media (max-width: 400px) {
    #masterTabsBar,
    .header-tabs-bar,
    .depth-limit-group,
    .tab-btn-add,
    .master-tab,
    [data-action="toggle-tree-orientation"],
    [data-action="toggle-tab-orientation"],
    [data-action="cycle-line-style"],
    [data-action="set-depth-limit"],
    [data-action="set-depth-limit-group"],
    #canvasSvg,
    .canvas-workspace {
      display: none !important;
      visibility: hidden !important;
      pointer-events: none !important;
    }

    button, input, select, textarea, [data-action], .btn-action, .btn-mini, .nut-bam-duoc {
      min-height: 44px !important;
      min-width: 44px !important;
      box-sizing: border-box !important;
    }
  }

  /* BACKDROPS & MODAL OVERLAYS: Không bao giờ được chiếm diện tích hoặc chặn touch khi ẩn */
  #kx-ke-backdrop,
  .kx-ke-backdrop,
  #backdrop-danh-sach-ghe {
    min-height: 0 !important;
    min-width: 0 !important;
  }
  #kx-ke-backdrop[style*="display: none"],
  #kx-ke-backdrop[style*="display:none"],
  .kx-ke-backdrop[style*="display: none"],
  .kx-ke-backdrop[style*="display:none"],
  #backdrop-danh-sach-ghe[style*="display: none"],
  #backdrop-danh-sach-ghe[style*="display:none"],
  #backdrop-danh-sach-ghe:not(.active):not(.dang-mo) {
    display: none !important;
    pointer-events: none !important;
  }

  /* Nút toggle Kim xăng và dải gấp gọn: ép >= 44px */
  #btn-kx-toggle-gap,
  .btn-kx-toggle-gap,
  .kim-xang-dong-gon > div:last-child {
    min-height: 44px !important;
    min-width: 44px !important;
    box-sizing: border-box !important;
  }

  /* Tiêu đề thanh đầu trái là nhãn hiển thị thông tin, không phải nút bấm */
  .thanh-dau-trai {
    pointer-events: none !important;
    cursor: default !important;
  }

  /* RÀNG BUỘC TOÀN BỘ NÚT VÀ PHẦN TỬ BẤM ĐƯỢC: Mọi thứ bấm được trên trang đều >= 44px */
  button, input, select, textarea, [role="button"], [onclick]:not(#kx-ke-backdrop):not(.kx-ke-backdrop):not(#backdrop-danh-sach-ghe), .btn-action, .btn-mini, .master-tab, .tab-btn-add, .chip-ghe, .the-trang-item, [data-action], .nut-bam-duoc, .depth-limit-group button, .depth-limit-group .btn-mini {
    min-height: 44px !important;
    min-width: 44px !important;
    box-sizing: border-box !important;
  }

  /* TỐI ƯU HIỆU NĂNG CUỘN 60FPS TRÊN CẢM ỨNG & KHỬ SCROLL DRIFT */
  .vung-tin-cuoc,
  /* #khung-tin-nhan ĐÃ GỠ 10/9 22:35 — transform:translateZ(0) biến nó thành khung chứa cho con position:fixed, làm ô nhập neo vào đáy HỘP thay vì đáy MÀN HÌNH → ô nhập rơi khỏi tầm nhìn. Không được đưa lại. */
  .bang-lenh-danh-sach,
  #bang-lenh-danh-sach,
  .drawer-danh-sach-ghe-body,
  .drawer-danh-sach-ghe,
  .khung-man-hinh-terminal,
  #khung-noi-dung-terminal {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    will-change: scroll-position !important;
    transform: translateZ(0) !important;
  }

  /* Bảng lệnh Slash Popup (Gõ / mở danh sách lệnh - bám chặt trực tiếp vào ô gõ) */
  .bang-lenh-slash {
    display: none;
    position: fixed !important;
    min-height: 175px !important; /* Đảm bảo tối thiểu thấy 3 lệnh + header */
    max-height: 260px !important;
    background: #181b24 !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    border-radius: 10px !important;
    box-shadow:  var(--bong-5) !important;
    z-index: var(--z-hop-thoai, 600) !important;
    overflow: hidden !important;
    flex-direction: column !important;
    
    -webkit-
    pointer-events: auto !important;
    box-sizing: border-box !important;
  }
  .bang-lenh-slash.hien-thi {
    display: flex !important;
  }
  .bang-lenh-tieu-de {
    flex: 0 0 auto !important;
    padding: 8px 12px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #94a3b8 !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .bang-lenh-danh-sach {
    flex: 1 1 auto !important;
    min-height: 135px !important; /* 3 lệnh x 44px + padding */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 4px !important;
    margin: 0 !important;
    list-style: none !important;
  }
  .muc-lenh-slash {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background 0.12s ease, color 0.12s ease !important;
    user-select: none !important;
    min-height: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important; /* Không cho phép từng mục bị bóp dẹt */
    box-sizing: border-box !important;
  }
  .muc-lenh-slash:hover,
  .muc-lenh-slash.muc-lenh-chon {
    background: rgba(56, 189, 248, 0.16) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
  }
  .muc-lenh-icon {
    font-size: 16px !important;
    width: 24px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
  }
  .muc-lenh-ten {
    font-family: "SF Mono", Consolas, Menlo, monospace !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #38bdf8 !important;
    min-width: 80px !important;
    flex-shrink: 0 !important;
  }
  .muc-lenh-mo-ta {
    font-size: 12px !important;
    color: #cbd5e1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex: 1 1 auto !important;
  }

  /* ==========================================================================
     3 ĐIỀU KHẨU VỊ NẶNG NHẤT: KV-006 · KV-007 · KV-025 (dev-3)
     ========================================================================== */

  /* 🟢 KV-006: Phân biệt 4 sắc thái thị giác trong 1s */
  .nhan-vat-dang-lam, [data-trang-thai="dang-lam"], [data-trang-thai="active"], [data-trang-thai="working"] {
    border-color: #22c55e !important;
    box-shadow:  var(--bong-5) !important;
    opacity: 1 !important;
  }
  .nhan-vat-nghi, [data-trang-thai="nghi"], [data-trang-thai="idle"], [data-trang-thai="vua-xong"], [data-trang-thai="done"] {
    border-color: #64748b !important;
    opacity: 0.85 !important;
  }
  .nhan-vat-cho-jack, [data-trang-thai="dang-cho"], [data-trang-thai="gap-khuc-mac"], [data-trang-thai="blocked"], [data-trang-thai="cho-jack"] {
    border-color: #f59e0b !important;
    box-shadow:  var(--bong-5) !important;
    opacity: 1 !important;
  }
  .nhan-vat-ngu-dong, [data-trang-thai="ngu-dong"], [data-trang-thai="offline"] {
    border-color: #475569 !important;
    opacity: 0.40 !important;
    filter: grayscale(0.6) !important;
  }

  /* 🟢 KV-007: Bong bóng tiếng người 1 dòng <= 40 ký tự, cấm tiếng máy. Khi nhân vật nghỉ: tự động ẩn bong bóng */
  .bong-bong-loi-thoai, .bong-noi {
    white-space: nowrap !important;
    max-width: 280px !important;
    font-size: 13px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .nhan-vat-nghi .bong-bong-loi-thoai,
  .nhan-vat-nghi .bong-noi,
  .nhan-vat-ngu-dong .bong-bong-loi-thoai,
  .nhan-vat-ngu-dong .bong-noi,
  [data-trang-thai="nghi"] .bong-bong-loi-thoai,
  [data-trang-thai="nghi"] .bong-noi,
  [data-trang-thai="idle"] .bong-bong-loi-thoai,
  [data-trang-thai="idle"] .bong-noi,
  [data-trang-thai="vua-xong"] .bong-bong-loi-thoai,
  [data-trang-thai="vua-xong"] .bong-noi,
  [data-trang-thai="done"] .bong-bong-loi-thoai,
  [data-trang-thai="done"] .bong-noi,
  [data-trang-thai="ngu-dong"] .bong-bong-loi-thoai,
  [data-trang-thai="ngu-dong"] .bong-noi,
  [data-trang-thai="offline"] .bong-bong-loi-thoai,
  [data-trang-thai="offline"] .bong-noi {
    display: none !important;
  }

  /* 🟢 KV-025: Cấm cắt cụt nút bấm, chuẩn Icon-First >= 44x44px */
  button, .btn, .tab-btn, .tab-gom, [role="button"], .nut-bam-duoc, .nut-lenh-nhanh {
    text-overflow: clip !important;
    min-height: 44px !important;
    min-width: 44px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
  }
  .tab-icon-first {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
    gap: 6px !important;
    padding: 0 10px !important;
    white-space: nowrap !important;
  }
  @media (max-width: 400px) {
    .khung-hanh-dong-day, .thanh-hanh-dong-nhap, .cum-nut-goc-phai {
      flex-direction: column !important;
      width: 100% !important;
    }
    .khung-hanh-dong-day button, .thanh-hanh-dong-nhap button, .cum-nut-goc-phai button {
      width: 100% !important;
      min-height: 44px !important;
    }
  }
/* ==========================================================================
   CĂN PHÒNG CHI TIẾT 3 TẦNG TRỰC QUAN (KV-010 & KV-013)
   ========================================================================== */
.khung-chi-tiet-ba-tang {
  padding: 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}
.tang-chi-tiet {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-sizing: border-box;
}
.tang-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.tang-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tang-title h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #0f172a;
}
.badge-tien-do {
  font-size: 12px;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid #bae6fd;
}
.thanh-tien-trinh-buoc {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.buoc-tien-do {
  flex: 1;
  height: 8px;
  border-radius: 4px;
}
.buoc-xong { background: #22c55e; }
.buoc-dang-chay { background: #0284c7; }
.buoc-cho { background: #e2e8f0; }
.hang-nhan-buoc {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 4px;
}
.nhan-xong { color: #16a34a; font-weight: 600; }
.nhan-chay { color: #0284c7; font-weight: 700; }
.the-nhiem-vu {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.tieu-de-nhiem-vu {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.noi-dung-nhiem-vu {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}
.hang-nut-hanh-dong-tang-1 {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hang-nut-hanh-dong-tang-1 button {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
}
#btn-hanh-dong-giao-viec {
  border: none;
  background: #0284c7;
  color: #ffffff;
}
#btn-hanh-dong-lam-moi, #btn-hanh-dong-mo-so {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}
.so-moc-thoi-gian {
  font-size: 11px;
  color: #64748b;
}
.truc-thoi-gian-doc {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 2px solid #cbd5e1;
  margin-left: 10px;
  padding-left: 16px;
}
.moc-timeline-item {
  position: relative;
}
.cham-timeline {
  position: absolute;
  left: -22px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.cham-xanh-duong { background: #0284c7; box-shadow:  var(--bong-5); }
.cham-tim { background: #8b5cf6; box-shadow:  var(--bong-5); }
.cham-xanh-la { background: #22c55e; box-shadow:  var(--bong-5); }
.dong-meta-timeline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.tl-tac-gia {
  font-size: 11px;
  font-weight: 700;
}
#tl-tac-gia-1 { color: #0284c7; }
#tl-tac-gia-2 { color: #8b5cf6; }
#tl-tac-gia-3 { color: #16a34a; }
.tl-gio {
  font-size: 11px;
  color: #94a3b8;
}
.the-noi-dung-timeline {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #334155;
  line-height: 1.4;
}
.khung-mat-do-hoat-dong {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.tieu-de-mat-do {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.nhan-mat-do-tong {
  font-size: 11px;
  font-weight: 600;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 999px;
}
.thanh-mat-do-bon-tieng {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 56px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px 4px 10px;
  box-sizing: border-box;
}
.khoang-gio-cot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 2px;
}
.cot-hoat-dong {
  width: 100%;
  max-width: 44px;
  min-height: 4px;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
}
.cot-hoat-dong.mat-do-day { background: #0284c7; }
.cot-hoat-dong.mat-do-vua { background: #38bdf8; }
.cot-hoat-dong.mat-do-thua { background: #93c5fd; }
.cot-hoat-dong.mat-do-vang { background: #e2e8f0; }
.nhan-gio-cot {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.so-dem-cot {
  font-size: 9px;
  font-weight: 700;
  color: #0f172a;
}
.khoang-gio-nhom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f9;
  border-left: 3px solid #0284c7;
  padding: 4px 8px;
  border-radius: 0 6px 6px 0;
  margin: 10px 0 6px -6px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}
.badge-khoang-gio-dem {
  font-size: 10px;
  font-weight: 600;
  color: #0369a1;
}
.badge-trang-thai-vl {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.badge-trang-thai-dang-lam {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.badge-trang-thai-da-xong {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}
.badge-trang-thai-cho {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}
.badge-do-tuoi {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: auto;
}
.moc-timeline-item.tuoi-moi { opacity: 1; }
.moc-timeline-item.tuoi-vua { opacity: 0.88; }
.moc-timeline-item.tuoi-cu { opacity: 0.72; }
#btn-thu-phong-nhat-ky {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.danh-sach-the-nhat-ky-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.the-nhat-ky-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
}
.the-nhat-ky-card summary {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
}
.the-badge-ghi-so {
  font-size: 11px;
  color: #10b981;
  background: #ecfdf5;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.the-badge-san-sang {
  font-size: 11px;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.the-nhat-ky-body {
  margin-top: 8px;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
}
#backdrop-chi-tiet-du-phong {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: var(--z-lop-phu, 400);
}
#drawer-chi-tiet-du-phong {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  z-index: var(--z-hop-thoai, 600);
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  background: #ffffff;
  border-left: 1px solid #e2e8f0;
  box-shadow:  var(--bong-3);
}

/* Drawer chiếm toàn màn hình (bottom sheet) khi màn < 1024px để không bóp cột giữa */
@media (max-width: 1023px) {
  #drawer-chi-tiet-du-phong {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 92dvh !important;
    max-height: 92dvh !important;
    border-radius: 16px 16px 0 0 !important;
    border: 1px solid #cbd5e1 !important;
    border-bottom: none !important;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.25) !important;
  }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-title-group span { font-size: 22px; }
.drawer-ten { font-weight: 700; font-size: 15px; color: #0f172a; }
.drawer-vai { font-size: 12px; color: #64748b; }
#drawer-dp-btn-dong {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drawer-noi-dung {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Responsive text switches */
.chu-ngan-tren-mobile { display: none; }
@media (max-width: 600px) {
  .chu-dai-tren-mobile { display: none !important; }
  .chu-ngan-tren-mobile { display: inline !important; }
}

/* Khung nhập tin cước layout */
#khung-nhap-tin-cuoc,
.khung-nhap-tin {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
#khung-nhap-tin-cuoc .thanh-chip-lenh-nhanh {
  display: flex !important;
  flex-wrap: wrap !important;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  height: auto !important;
  gap: 6px !important;
}
#khung-nhap-tin-cuoc .o-nhap-tin-cuoc {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
#khung-nhap-tin-cuoc .thanh-hanh-dong-nhap {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  justify-content: space-between !important;
}
#khung-nhap-tin-cuoc .cong-cu-nhap-nhom {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
}
#khung-nhap-tin-cuoc .btn-cong-cu {
  min-width: 44px !important;
  min-height: 44px !important;
}
#nut-duong-thoat {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 44px !important;
  min-height: 44px !important;
  z-index: var(--z-hop-noi, 100) !important;
}


/* Dãy tabs và thanh chế độ xem (KV-013) luôn bám đỉnh và nổi rõ trên nội dung */
#thanh-che-do-xem {
  z-index: 12;
  z-index: var(--z-day-tabs, 50) !important;
}

#dau-ban-tu-dong {
  position: fixed !important;
  bottom: 2px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  right: auto !important;
  z-index: 40;
  z-index: var(--z-dau-ban, 950) !important;
}

@media (max-width: 639px) {
  body #khung-nhap-tin-cuoc.khung-nhap-tin {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-height: 45dvh !important;
    z-index: var(--z-thanh-dinh, 20) !important;
  }
  body #thanh-che-do-xem {
    position: sticky !important;
    top: 0 !important;
    z-index: var(--z-day-tabs, 50) !important;
  }
}
#bang-goi-y-lenh-slash:not(.hien-thi),#bang-lenh-slash:not(.hien-thi){display:none!important;pointer-events:none!important;}

/* ==========================================================================
   KHỐI "AI ĐANG CHỜ JACK" (WO-UI-DP-HIEN-AI-CHO) — HIỆN TRONG TẦM MẮT GIÂY THỨ 2
   ========================================================================== */
.ai-dang-cho {
  width: 100%;
  margin: 8px 0 12px 0;
  border-radius: 12px;
  box-sizing: border-box;
  font-family: inherit;
}

.ai-dang-cho-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 10px 10px 0 0;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.ai-dang-cho-header.header-co-khan-cap {
  background: #991b1b;
  box-shadow:  var(--bong-5);
}

.ai-dang-cho-danh-sach {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-top: none;
  border-radius: 0 0 10px 10px;
}

.ai-dang-cho-the {
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

/* Thẻ ghế chờ ngắn (<= 15 phút): Hổ phách, bình tĩnh */
.ai-dang-cho-the-ngan {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
}

/* Thẻ ghế chờ trung bình (16 - 60 phút): Cam đậm */
.ai-dang-cho-the-trung-binh {
  background: #fff7ed;
  border: 2px solid #ea580c;
}

/* Thẻ ghế chờ khẩn cấp (> 60 phút, ví dụ 916 phút): ĐỎ RỰC, VIỀN DÀY, CẢNH BÁO KẸT */
.ai-dang-cho-the-khan-cap {
  background: #fef2f2;
  border: 2.5px solid #ef4444;
  box-shadow:  var(--bong-5);
}

.ai-dang-cho-hang-dau {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-dang-cho-ten-ghe {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-dang-cho-thoi-gian-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Huy hiệu thời gian chờ */
.badge-cho-ngan {
  background: #fef3c7;
  color: #92400e;
  border: 1.5px solid #f59e0b;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-cho-trung-binh {
  background: #ffedd5;
  color: #9a3412;
  border: 1.5px solid #ea580c;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-cho-khan-cap {
  background: #fee2e2;
  color: #991b1b;
  border: 2px solid #ef4444;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
  box-shadow:  var(--bong-5);
}

/* Số cũ: mờ đi và viền nét đứt (bắt buộc theo luật Jack) */
.so-cu-mo-vien-net-dut {
  opacity: 0.75 !important;
  border: 1.5px dashed #64748b !important;
  background: rgba(148, 163, 184, 0.15) !important;
  color: #475569 !important;
}

.ai-dang-cho-canh-bao-ket {
  background: rgba(239, 68, 68, 0.12);
  border-left: 4px solid #ef4444;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: #991b1b;
  line-height: 1.4;
}

.ai-dang-cho-cau-hoi-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 14px;
}

.ai-dang-cho-cau-hoi-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}

.ai-dang-cho-cau-hoi-noi-dung {
  font-size: 14px;
  line-height: 1.55;
  color: #0f172a;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-dang-cho-lua-chon-hang {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.btn-lua-chon-cho {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1.5px solid #0284c7;
  background: #e0f2fe;
  color: #0369a1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.btn-lua-chon-cho:hover {
  background: #0284c7;
  color: #ffffff;
}

.ai-dang-cho-tac-vu-hang {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-tra-loi-ngay {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  background: #0284c7;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
}

.btn-tra-loi-ngay:hover {
  background: #0369a1;
}

/* ==========================================================================
   GỠ BỐN CHỖ ĐÈ NHAU TRÊN TRANG TRÒ CHUYỆN (WO-UI-DP-DE-NHAU)
   ========================================================================== */
.chuong-bao-fb-010 {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: var(--z-chuong-bao, 800);
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:  var(--bong-3);
  cursor: pointer;
}

/* ==========================================================================
   HỢP ĐỒNG 5 TẦNG & NGÂN SÁCH GIAO DIỆN (KT-01 / DOC 62)
   Trần phần tử nổi: TỐI ĐA 4 (Bình thường: 3; khi mở drawer: 4)
   ========================================================================== */

/* 1. TRIỆT TIÊU TOÀN BỘ PHẦN TỬ NỔI VÀ THỪA TRÊN MỌI MÀN HÌNH */
header,
.buong-tieu-de-bar,
.bang-chuyen-nhanh-khung,
#ai-dang-cho,
.ai-dang-cho,
#chuong-bao-fb-010,
.chuong-bao-fb-010,
#kim-xang-root,
.kim-xang-wrap,
#ban-do-noi-nut,
#btn-cuon-dong-moi,
.btn-cuon-dong-moi,
#dai-tin-moi,
#dau-ban-tu-dong,
#thanh-che-do-xem,
#thanh-tom-tat-dang-lam-ghim,
#btn-tai-tin-cu,
.btn-tai-tin-cu,
#khung-tai-tin-cu,
#btn-tin-cu,
.thanh-trang-thai-tra-loi,
#thanh-trang-thai-tra-loi,
.dong-tin,
.dong-tin-user,
.dong-tin-agent,
#dropzone-overlay-chat {
  display: none !important;
  position: static !important;
}

/* Biểu tượng chấm trạng thái chuẩn >= 18px, tránh bị tính li ti <= 16px */
.cham-trang-thai-dot {
  min-width: 18px !important;
  min-height: 18px !important;
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
}

@media (max-width: 639px) {

  /* 2. TẦNG 0 · NỀN (z-index: 0–9): Dòng chảy trang tự nhiên, KHÔNG FIXED */
  body {
    overflow-x: hidden !important;
    background: #0b1120 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .buong-hoi-thoai,
  #buong-hoi-thoai-chinh {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .khung-hoi-thoai-grid {
    display: block !important;
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 48px 0 136px 0 !important;
    z-index: 1 !important;
  }

  .cot-noi-dung,
  .khung-doc-va-the-wrap,
  .khung-than-doc,
  #khung-tin-nhan,
  .khung-tin-nhan {
    display: block !important;
    position: static !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* 3. TẦNG 1 · THANH NEO ĐỈNH (10–19): Cao đúng 48px, cố định trên cùng */
  #thanh-dau-doc-cuoc,
  .thanh-dau-doc-cuoc {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    z-index: 600 !important;
    background: #0f172a !important;
    border-bottom: 1px solid #334155 !important;
    padding: 0 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    box-sizing: border-box !important;
    gap: 8px !important;
  }
  #thanh-dau-doc-cuoc::-webkit-scrollbar,
  .thanh-dau-doc-cuoc::-webkit-scrollbar {
    display: none !important;
  }

  #thanh-dau-doc-cuoc .thanh-dau-trai {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #btn-ve-the-gioi-top {
    min-width: 36px !important;
    min-height: 36px !important;
    height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(56, 189, 248, 0.15) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 6px !important;
    color: #38bdf8 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    flex-shrink: 0 !important;
  }

  #thanh-dau-doc-cuoc .thanh-dau-ten-wrap {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #thanh-dau-doc-cuoc .thanh-dau-dong-ten {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
  }

  #thanh-dau-doc-cuoc #thanh-dau-ten-ghe {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #thanh-dau-doc-cuoc #thanh-dau-lan-cuoi {
    font-size: 10px !important;
    color: #94a3b8 !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #thanh-dau-doc-cuoc .thanh-dau-phai {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
  }

  #thanh-dau-doc-cuoc #btn-ghe-truoc,
  #thanh-dau-doc-cuoc #btn-ghe-sau,
  #thanh-dau-doc-cuoc #btn-term-font-down,
  #thanh-dau-doc-cuoc #btn-term-font-up,
  #thanh-dau-doc-cuoc #btn-term-chep,
  #thanh-dau-doc-cuoc #btn-term-theme {
    display: none !important;
  }

  #thanh-dau-doc-cuoc #btn-mo-drawer-chi-tiet {
    min-width: 44px !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    border-radius: 6px !important;
  }

  /* 4. TẦNG 0 · TERMINAL THẬT: Nhân vật chính 520px (~62% ở 390x844) */
  #man-hinh-terminal.terminal-hien-ban-tho,
  .man-hinh-terminal-that.terminal-hien-ban-tho {
    position: relative !important;
    z-index: 1 !important;
    display: block !important;
    width: 100% !important;
    height: 520px !important;
    min-height: 520px !important;
    max-height: 520px !important;
    background: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    border-bottom: 1px solid #1e293b !important;
  }

  #man-hinh-terminal #iframe-terminal-that,
  #iframe-terminal-that {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    border: none !important;
    display: block !important;
    background: #000000 !important;
  }

  #danh-sach-dong-terminal,
  .truc-thoi-gian-doc,
  #tang-the-nhat-ky,
  #khung-chi-tiet-ba-tang {
    display: none !important;
  }

  /* 5. TẦNG 1 · THANH NEO ĐÁY (10–19): Tổng cao thanh neo <= 25% màn */
  #khung-nhap-tin-cuoc,
  .khung-nhap-tin {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 10 !important;
    background: #0f172a !important;
    border-top: 1.5px solid #1e293b !important;
    padding: 4px 6px !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    height: auto !important;
    max-height: none !important;
  }

  #khung-nhap-tin-cuoc .thanh-chip-lenh-nhanh {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    height: auto !important;
    min-height: 44px !important;
    max-height: none !important;
    padding: 2px 2px !important;
    margin: 0 0 4px 0 !important;
    box-sizing: border-box !important;
  }

  #khung-nhap-tin-cuoc .chip-lenh-nhanh {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    min-width: 44px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
    box-sizing: border-box !important;
  }

  #hang-nhap-terminal-truc-tiep {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 8px !important;
    background: #0b1120 !important;
    border: 1.5px solid #0284c7 !important;
    border-radius: 8px !important;
    min-height: 44px !important;
    height: 44px !important;
    max-height: 44px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  #hang-nhap-terminal-truc-tiep .nhan-hang-nhap-term {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #38bdf8 !important;
    white-space: nowrap !important;
    padding-left: 4px !important;
  }

  #nhap-terminal-truc-tiep {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    height: 36px !important;
    min-height: 36px !important;
    background: transparent !important;
    color: #f8fafc !important;
    border: none !important;
    font-size: 12px !important;
    font-family: ui-monospace, Menlo, Monaco, monospace !important;
    padding: 0 8px !important;
    outline: none !important;
    border-radius: 8px !important;
  }

  #hang-nhap-terminal-truc-tiep .btn-go-thang {
    min-width: 44px !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    background: #0284c7 !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #hang-nhap-tuy-bien-cuoc {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 8px !important;
    border: none !important;
  }

  #nhap-tin-hoi-thoai {
    min-height: 40px !important;
    height: 40px !important;
    max-height: 40px !important;
    padding: 8px !important;
    font-size: 16px !important;
    background: #0f172a !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    resize: none !important;
  }

  /* 6. TẦNG 3 · NÚT NỔI (30–39): ĐÚNG 1 CÁI (Góp ý), góc phải dưới, KHÔNG ĐÈ HÀNG NÚT */
  #gop-y-lazy-trigger,
  button#gop-y-lazy-trigger {
    position: fixed !important;
    bottom: 250px !important;
    right: 14px !important;
    left: auto !important;
    top: auto !important;
    z-index: 30 !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 50% !important;
    background: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
  }
  @media (min-width: 640px) {
    #gop-y-lazy-trigger,
    button#gop-y-lazy-trigger {
      bottom: 360px !important;
      right: 16px !important;
    }
  }

  .dos-mic-hint {
    display: none !important;
  }

  /* 7. TẦNG 2 · LỚP PHỦ (20–29): Ngăn kéo có nút đóng >= 44px, mờ tầng 1 */
  .cot-danh-sach.drawer-mo,
  #drawer-chi-tiet-du-phong {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 25 !important;
    background: #0f172a !important;
  }

  /* Khi tầng 2 mở thì tầng 1 mờ đi */
  body.drawer-dang-mo #thanh-dau-doc-cuoc,
  body.drawer-dang-mo #khung-nhap-tin-cuoc {
    opacity: 0.25 !important;
    pointer-events: none !important;
  }

  /* 8. TẦNG 4 · BÁO ĐỘNG (40–49) */
  #toast-hoan-tai,
  .thong-bao-gui-tin,
  .hop-thoai-xac-nhan {
    z-index: 45 !important;
  }
}

/* ==========================================================================
   HÀNG THẺ TRANG TERMINAL (WO-TAB-VA-SIDEBAR)
   Hiển thị các tab terminal tương ứng với các ghế / phiên làm việc.
   Mọi phần tử tương tác đều đạt chuẩn ngón tay >= 44px.
   ========================================================================== */
#hang-the-trang-doc,
.hang-the-trang-doc {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 52px !important;
  max-height: 56px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  padding: 4px 10px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-sizing: border-box !important;
  z-index: 15 !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
}

.the-trang-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 8px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  min-height: 44px !important;
  height: 44px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  touch-action: manipulation !important;
  user-select: none !important;
  transition: all 0.15s ease !important;
}

.the-trang-item.dang-chon {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0369a1 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25) !important;
}

.the-trang-item .the-trang-ten {
  font-size: 13px !important;
  font-weight: 600 !important;
  max-width: 140px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.the-trang-btn-action,
.the-trang-dong-btn {
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  border: none !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  color: #64748b !important;
  touch-action: manipulation !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.the-trang-btn-action:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.the-trang-btn-action.da-ghim {
  color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.12) !important;
}

.the-trang-dong-btn:hover {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

.btn-them-the-trang {
  min-width: 44px !important;
  min-height: 44px !important;
  height: 44px !important;
  padding: 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  background: #f1f5f9 !important;
  border: 1px dashed #94a3b8 !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #475569 !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}
.btn-them-the-trang:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  border-color: #64748b !important;
}

/* Nút mở kệ phải trên topbar */
#btn-mo-ke-phai,
.btn-mo-ke-phai-top {
  display: inline-flex !important;
  min-width: 44px !important;
  min-height: 44px !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 10px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  box-sizing: border-box !important;
}

/* WO-DU-PHONG-UX-OVERHAUL-PERFECTION: Giữ nút Kệ Phải ổn định hài hòa bên cạnh nút Theme trên topbar, không bị văng fixed */
html body.ke-phai-mo #btn-mo-ke-phai,
html body #btn-mo-ke-phai {
  position: static !important;
  top: auto !important;
  right: auto !important;
}
@media (min-width: 640px) and (max-width: 1099px) {
  body.ke-phai-mo:not(.ke-phai-toan-man) .ke-phai-backdrop {
    top: 52px;
  }
}

/* Kệ phải trên màn hẹp (<= 639px): Mở dạng overlay toàn màn hình có nút đóng >= 44px */
@media (max-width: 639px) {
  #ke-phai-container.mo {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    z-index: 25 !important;
    position: fixed !important;
  }
  #ke-phai-btn-dong,
  #ke-phai-btn-quay-lai {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
  }
}

/* ==========================================================================
   WO-BANG-TRONG: THIẾT KẾ DÀNH RIÊNG CHO MÁY TÍNH BẢNG (Tab S10 nằm ngang)
   Không thêm gì. Chỉ bớt và gộp. Chiều cao hội thoại đạt >= 60% màn hình.
   ========================================================================== */
@media (min-width: 640px) {
  /* Thanh đỉnh tầng 1: cao đúng 48px, cố định tại top 0, z-index 10 */
  html body #thanh-dau-doc-cuoc,
  html body .thanh-dau-doc-cuoc {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    padding: 0 12px !important;
    z-index: 10 !important;
    background: #0f172a !important;
    border-bottom: 1px solid #334155 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
  }
  .thanh-dau-trai {
    min-height: 44px !important;
    gap: 6px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .thanh-dau-avatar {
    width: 22px !important;
    height: 22px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-ten-wrap {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .thanh-dau-ten-ghe {
    font-size: 16px !important;
    line-height: 16px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .thanh-dau-lan-cuoi {
    font-size: 12px !important;
    line-height: 16px !important;
    color: #64748b !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-phai {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-phai .btn-dieu-huong-ghe:not(#btn-menu-thanh-dau-them):not(#btn-mo-drawer-chi-tiet):not(#btn-mo-ke-phai):not(#btn-topbar-theme):not(#btn-thao-tac-nhanh-topbar) {
    display: none !important;
  }
  .thanh-dau-phai #btn-mo-ke-phai,
  html body #btn-mo-ke-phai,
  html body .btn-mo-ke-phai-top {
    display: inline-flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0284c7 !important;
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-phai #btn-mo-drawer-chi-tiet {
    display: inline-flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 10px !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0284c7 !important;
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
  }
  .thanh-dau-phai #wrap-menu-thanh-dau-them,
  .thanh-dau-phai #btn-menu-thanh-dau-them {
    display: inline-flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    width: 44px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }

  /* Khung hội thoại chính trên tablet: rộng thoáng từ top 80px tới đỉnh khung nhập (bottom 165px) */
  .khung-hoi-thoai-grid {
    position: fixed !important;
    top: 80px !important;
    bottom: 165px !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(100vh - 80px - 165px) !important;
    max-height: calc(100vh - 80px - 165px) !important;
    overflow: hidden !important;
    margin-top: 0 !important;
  }
  .cot-noi-dung,
  .khung-doc-va-the-wrap,
  .khung-than-doc {
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Dải 6: Thanh chế độ xem mỏng nhẹ một hàng 32px */
  body #thanh-che-do-xem {
    position: static !important;
    padding: 2px 10px !important;
    min-height: 32px !important;
    height: 32px !important;
    max-height: 32px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
  body #nhan-che-do-xem {
    display: none !important;
  }
  body #thanh-che-do-xem button,
  body #thanh-che-do-xem .nut-tang-tin,
  body #thanh-che-do-xem .nut-tang-tin span,
  #dau-ban-build-live,
  .dau-ban-build-live,
  #dau-ban-build-live b,
  #dau-vet-ban-chay,
  .dau-vet-ban-chay {
    font-size: 12px !important;
  }
  body #thanh-che-do-xem button,
  body #thanh-che-do-xem .nut-tang-tin {
    min-height: 26px !important;
    height: 26px !important;
    padding: 2px 8px !important;
    border-radius: 4px !important;
  }

  /* Vùng hội thoại (chat stream): ĐẠT >= 60% CHIỀU CAO MÀN HÌNH */
  #khung-tin-nhan,
  .khung-tin-nhan {
    flex: 1 1 auto !important;
    height: calc(100% - 32px) !important;
    min-height: 440px !important;
    max-height: calc(100% - 32px) !important;
    overflow-y: auto !important;
    padding: 8px 60px 16px 12px !important;
    box-sizing: border-box !important;
  }
  #man-hinh-terminal,
  #danh-sach-dong-terminal {
    height: 100% !important;
    min-height: 400px !important;
  }

  /* Dải 8: Khung soạn tin đáy trên tablet/desktop: ĐỦ CẢ HAI Ô NHẬP (Terminal sống + Custom với voice typing, menu nhanh) */
  html body #khung-nhap-tin-cuoc {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: auto !important;
    min-height: 150px !important;
    max-height: 165px !important;
    padding: 6px 12px 8px 12px !important;
    box-sizing: border-box !important;
    gap: 4px !important;
    background: #0f172a !important;
    z-index: 25 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* 2. Menu nhanh (chip lệnh) tablet */
  #khung-nhap-tin-cuoc .thanh-chip-lenh-nhanh {
    min-height: 44px !important;
    height: auto !important;
    gap: 6px !important;
    margin-bottom: 2px !important;
    display: flex !important;
    flex-wrap: wrap !important;
  }
  #khung-nhap-tin-cuoc .chip-lenh-nhanh {
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    flex: 0 0 auto !important;
  }

  /* 3. Ô nhập textarea custom tablet */
  #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai {
    min-height: 44px !important;
    padding: 8px 12px !important;
    font-size: 16px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  /* 4. Thanh công cụ tablet: Voice typing (Nói), Dừng, Gửi */
  #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    min-height: 48px !important;
    height: auto !important;
    gap: 8px !important;
    padding-right: 14px !important;
  }
  #khung-nhap-tin-cuoc .cong-cu-nhap-nhom {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    overflow-x: auto !important;
  }
  #khung-nhap-tin-cuoc .btn-cong-cu {
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #khung-nhap-tin-cuoc .nut-gui-nhom,
  #khung-nhap-tin-cuoc .nut-gui-nhom #btn-gui-tin-nhan {
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    align-self: center !important;
    margin-right: 14px !important;
  }
  /* GO 10/9 21:58 — luat nay giau NUT GUI. Go xong khong gui duoc thi o nhap la o chet. */

  /* Dải 7: Nút cuộn tin mới nhất dời ra mép phải dưới (không che chữ ở giữa) */
  #btn-cuon-dong-moi,
  .btn-cuon-dong-moi {
    position: fixed !important;
    bottom: 228px !important;
    right: 68px !important;
    left: auto !important;
    transform: none !important;
    z-index: 30 !important;
    margin: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
  }

  html body #kim-xang-root,
  html body div.kim-xang-wrap {
    position: fixed !important;
    bottom: 228px !important;
    right: 12px !important;
    left: auto !important;
    top: auto !important;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    z-index: 30 !important;
  }

  html body #chuong-bao-fb-010,
  html body .chuong-bao-fb-010 {
    position: fixed !important;
    bottom: 280px !important;
    right: 12px !important;
    left: auto !important;
    top: auto !important;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    z-index: 30 !important;
  }
  html body #ban-do-noi-nut {
    position: fixed !important;
    bottom: 332px !important;
    right: 12px !important;
    left: auto !important;
    top: auto !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    z-index: 30 !important;
  }
}

@media (max-width: 639px) {
  html body #khung-nhap-tin-cuoc {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 12px)) 10px !important;
    box-sizing: border-box !important;
    gap: 4px !important;
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-top: 1px solid rgba(203, 213, 225, 0.8) !important;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08) !important;
    z-index: 1000 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    min-height: 56px !important;
    max-height: none !important;
  }
  #khung-nhap-tin-cuoc .thanh-chip-lenh-nhanh {
    min-height: 44px !important;
    height: auto !important;
    gap: 6px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    margin-bottom: 2px !important;
  }
  #khung-nhap-tin-cuoc .chip-lenh-nhanh {
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
    flex: 0 0 auto !important;
  }
  /* GO 10/9 21:58 — luat nay giau MOI CHIP TU CAI THU 3, tuc la /dong-bo va /dung-lai. Jack goi day la 'mat voice typing va cac menu khac'. KV-063: got gon khong duoc got mat duong vao. */
  #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai {
    min-height: 44px !important;
    height: 44px !important;
    max-height: 44px !important;
    padding: 6px 10px !important;
    font-size: 16px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }
  #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    min-height: 44px !important;
    height: 44px !important;
    gap: 6px !important;
    padding: 0 !important;
    width: 100% !important;
  }
  #khung-nhap-tin-cuoc .cong-cu-nhap-nhom {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
  }
  #khung-nhap-tin-cuoc .cong-cu-nhap-nhom .btn-cong-cu,
  #khung-nhap-tin-cuoc #btn-mic-giong-noi,
  #khung-nhap-tin-cuoc #btn-ctrl-c {
    display: inline-flex !important;
    width: auto !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
    flex: 0 0 auto !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
  }
  #khung-nhap-tin-cuoc .nut-gui-nhom {
    flex: 0 0 auto !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }
  #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec,
  #khung-nhap-tin-cuoc .nut-gui-nhom #btn-gui-tin-nhan {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    width: auto !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    font-weight: 600 !important;
    cursor: pointer !important;
  }
  #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec:active,
  #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec.dang-bam {
    background: #e2e8f0 !important;
    transform: scale(0.96) !important;
    opacity: 0.7 !important;
  }
  /* GO 10/9 21:58 — luat nay giau NUT GUI. Go xong khong gui duoc thi o nhap la o chet. */

  /* Kim xăng AI trên thanh đỉnh mobile (Việc 4) */
  html body #kim-xang-root,
  html body #kim-xang-root.kim-xang-wrap,
  html body #kim-xang-root.kim-xang-wrap.kim-xang-gap,
  html body div.kim-xang-wrap,
  html body div.kim-xang-wrap.kim-xang-gap {
    position: fixed !important;
    top: 7px !important;
    bottom: auto !important;
    right: 106px !important;
    left: auto !important;
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    z-index: 120 !important;
  }
  html body #chuong-bao-fb-010,
  html body .chuong-bao-fb-010 {
    position: fixed !important;
    bottom: 227px !important;
    right: 12px !important;
    left: auto !important;
    top: auto !important;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    z-index: 30 !important;
  }
  #btn-cuon-dong-moi,
  .btn-cuon-dong-moi {
    position: fixed !important;
    bottom: 175px !important;
    right: 64px !important;
    left: auto !important;
    transform: none !important;
    z-index: 30 !important;
    font-size: 12px !important;
    height: 44px !important;
    min-height: 44px !important;
    align-items: center !important;
  }
  .khung-hoi-thoai-grid {
    bottom: 165px !important;
    height: calc(100vh - 98px - 165px) !important;
    max-height: calc(100vh - 98px - 165px) !important;
  }

  /* Thanh đầu ghế tinh gọn trên mobile */
  .thanh-dau-phai {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-phai .btn-dieu-huong-ghe:not(#btn-menu-thanh-dau-them):not(#btn-mo-drawer-chi-tiet):not(#btn-mo-ke-phai):not(#btn-topbar-theme):not(#btn-thao-tac-nhanh-topbar) {
    display: none !important;
  }
  .thanh-dau-phai #btn-mo-ke-phai,
  html body #btn-mo-ke-phai,
  html body .btn-mo-ke-phai-top {
    display: inline-flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0284c7 !important;
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-phai #btn-mo-drawer-chi-tiet {
    display: inline-flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 10px !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0284c7 !important;
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
  }
  .thanh-dau-phai #wrap-menu-thanh-dau-them,
  .thanh-dau-phai #btn-menu-thanh-dau-them {
    display: inline-flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    width: 44px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }
}

/* ==========================================================================
   TERMINAL THẬT NHÚNG TRỰC TIẾP (TTYD + XTERM.JS) (KV-041, KV-061, KV-065)
   - Nhúng terminal SSH thật từ ttyd (nền trắng chuẩn KV-041, interactive)
   - Không dựng ô nhập giả lập, gõ trực tiếp trong terminal hoặc qua ô custom
   ========================================================================== */
#man-hinh-terminal,
.man-hinh-terminal-that {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 240px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border-radius: 6px !important;
  box-sizing: border-box !important;
  position: relative !important;
}

#iframe-terminal-that {
  flex: 1 1 100% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 240px !important;
  border: none !important;
  outline: none !important;
  background: #ffffff !important;
  display: block !important;
  box-sizing: border-box !important;
}

/* Khi chưa xác thực được ghế/bridge, JS bỏ src và đặt display:none cho iframe.
   Không để luật display:block !important bên trên biến trạng thái đó thành một
   khung trắng phủ lên thông báo kết nối. Khi JS nối được, nó đổi lại thành block. */
html body #iframe-terminal-that[style*="display: none"],
html body #iframe-terminal-that[style*="display:none"] {
  display: none !important;
}

/* Một tầng xem = một mặt terminal. Mặt đang chọn dùng trọn phần cao còn lại. */
html body #khung-tin-nhan.terminal-mot-dai {
  gap: 0 !important;
  max-height: calc(100% - 4px) !important;
}
html body #khung-tin-nhan.terminal-mot-dai #bang-trang-thai-bridge {
  display: none !important;
}
html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal {
  display: flex !important;
  flex: 1 1 0 !important;
  width: 100% !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
}
html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal #iframe-terminal-that,
html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal #danh-sach-dong-terminal {
  flex: 1 1 100% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}
html body #man-hinh-terminal.terminal-hien-ban-tho #danh-sach-dong-terminal,
html body #man-hinh-terminal.terminal-hien-ban-tho #khung-terminal-loi,
html body #man-hinh-terminal.terminal-hien-da-don #iframe-terminal-that,
html body #man-hinh-terminal.terminal-hien-da-don #khung-terminal-loi {
  display: none !important;
}
html body #man-hinh-terminal.terminal-hien-ban-tho #iframe-terminal-that {
  display: block !important;
  flex: 1 1 100% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 480px !important;
  border: none !important;
}
html body #man-hinh-terminal.terminal-hien-da-don #danh-sach-dong-terminal {
  display: block !important;
}
html body #man-hinh-terminal.terminal-hien-da-don #danh-sach-dong-terminal {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Kim xăng AI trên trang trò chuyện: LUÔN ở dạng nút tròn nổi mép phải, không bao giờ bung khối đè ô nhập (KV-042, KV-061) */
html body #kim-xang-root,
html body div.kim-xang-wrap {
  border-radius: 50% !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}
html body #kim-xang-root .kim-xang-bar,
html body div.kim-xang-wrap .kim-xang-bar {
  width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  justify-content: center !important;
  align-items: center !important;
  cursor: pointer !important;
  background: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}
html body #kim-xang-root .kim-xang-header-row,
html body #kim-xang-root .kim-xang-badge-main,
html body #kim-xang-root #kx-tuoi-so-lieu,
html body #kim-xang-root .btn-kx-toggle-gap,
html body #kim-xang-root .btn-kx-mo-ke,
html body #kim-xang-root .kim-xang-dong-khan-cap,
html body #kim-xang-root .kim-xang-dong-gon,
html body #kim-xang-root .kim-xang-grid {
  display: none !important;
  height: 0 !important;
}
html body #kim-xang-root .kim-xang-icon-only {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  height: 100% !important;
  font-size: 20px !important;
}

/* ==========================================================================
   KV-001, KV-007, KV-018: Phép gấp dòng máy móc / kỹ thuật thành 1 dòng tiếng Việt
   Chỉ mở ra xem khi Jack chạm/click vào. Mặc định chỉ thấy dòng tóm tắt tiếng Việt.
   ========================================================================== */
.dong-gap-ky-thuat {
  margin: 4px 0 !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-left: 3px solid #64748b !important;
  border-radius: 6px !important;
  font-size: 12.5px !important;
  line-height: 1.4 !important;
  color: #475569 !important;
  overflow: hidden !important;
  transition: all 0.15s ease !important;
}

.dong-gap-ky-thuat[open] {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  border-left-color: #3b82f6 !important;
}

.dong-gap-ky-thuat summary.summary-gap-ky-thuat {
  padding: 6px 10px !important;
  font-weight: 500 !important;
  color: #475569 !important;
  list-style: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  user-select: none !important;
  min-height: 44px !important;
  outline: none !important;
  cursor: pointer !important;
}

.dong-gap-ky-thuat summary.summary-gap-ky-thuat::-webkit-details-marker {
  display: none !important;
}

.dong-gap-ky-thuat .chi-tiet-noi-dung-gap {
  padding: 8px 10px !important;
  background: #0f172a !important;
  color: #cbd5e1 !important;
  border-top: 1px solid #334155 !important;
  font-family: ui-monospace, Menlo, Monaco, monospace !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
  max-height: 240px !important;
  overflow-y: auto !important;
  white-space: pre-wrap !important;
  word-break: break-all !important;
  cursor: text !important;
}

.dong-gap-ky-thuat .dong-code-gap {
  margin: 0 !important;
  padding: 2px 0 !important;
  font-family: inherit !important;
  font-size: 12px !important;
  color: inherit !important;
  cursor: text !important;
}

.dong-terminal.dong-ket-qua {
  background: #f0fdf4 !important;
  border-left: 3px solid #22c55e !important;
  color: #166534 !important;
  font-weight: 600 !important;
  padding: 5px 10px !important;
  margin-bottom: 4px !important;
  border-radius: 4px !important;
  font-size: 13px !important;
}

/* ==========================================================================
   CHUẨN CHỮ VÀ NÚT TỐI THIỂU (KIEM-NGON-TAY: CỠ CHỮ >= 12PX TOÀN CỤC)
   ========================================================================== */
html body #thanh-che-do-xem,
html body #thanh-che-do-xem button,
html body #thanh-che-do-xem .nut-tang-tin,
html body #thanh-che-do-xem .nut-tang-tin span,
html body #btn-xem-lai-so,
html body #btn-chuyen-buc-tranh-3-tang,
html body #nut-tang-tom-tat,
html body #nut-tang-tom-tat span,
html body #nut-tang-ban-tho,
html body #nut-tang-ban-tho span,
html body #nut-tang-day-du,
html body #nut-tang-day-du span,
html body #dau-ban-build-live,
html body .dau-ban-build-live,
html body #dau-ban-build-live b,
html body #dau-vet-ban-chay,
html body .dau-vet-ban-chay {
  font-size: 12px !important;
}

/* ==========================================================================
   DÒNG TÓM TẮT TIẾNG NGƯỜI GHIM CỨNG Ở TRÊN CÙNG (CĂN PHÒNG CHI TIẾT)
   ========================================================================== */
.thanh-tom-tat-dang-lam-ghim {
  position: sticky !important;
  top: 0 !important;
  z-index: 25 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border-bottom: 2px solid #0284c7 !important;
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center !important;
  min-height: 44px !important;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.08) !important;
}

.thanh-tom-tat-dang-lam-ghim .tom-tat-dang-lam-inner {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
}

.thanh-tom-tat-dang-lam-ghim .icon-tom-tat-ghim {
  font-size: 16px !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}

.thanh-tom-tat-dang-lam-ghim .nhan-tom-tat-label {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #0369a1 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.thanh-tom-tat-dang-lam-ghim .chu-nhan-vat-dang-lam {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex: 1 !important;
  min-width: 0 !important;
  line-height: 1.4 !important;
}

/* Nút mở-gấp chữ máy đảm bảo Fitts touch target >= 44pt */
.dong-terminal.dong-gap-ky-thuat {
  margin-bottom: 4px !important;
}

.dong-terminal.dong-gap-ky-thuat summary.summary-gap-ky-thuat {
  min-height: 44px !important;
  min-width: 44px !important;
  padding: 6px 12px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: #475569 !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: background 0.1s ease !important;
}

.dong-terminal.dong-gap-ky-thuat summary.summary-gap-ky-thuat:active {
  background: #e2e8f0 !important;
}

/* Nút cuộn tin mới nhất neo góc phải dưới trên thanh nhập, không che vùng nội dung */
#btn-cuon-dong-moi,
.btn-cuon-dong-moi {
  position: fixed !important;
  bottom: 140px !important;
  right: 16px !important;
  left: auto !important;
  z-index: 30 !important;
}



/* ==========================================================================
   10/9 22:10 — CHIA CHỖ ĐẬU CHO CÁC THỨ NỔI
   Jack chụp lúc 22:08: chuông, kim xăng, nút "Tin mới nhất" và nút "Gửi yêu cầu"
   CÙNG ĐẬU MỘT GÓC PHẢI–DƯỚI, đè lên nhau. Đo được:
     chuông            bottom: 20px  right: 20px
     nút tin mới       bottom: 84px  right: 12px
     kim xăng          ngay cạnh đó
     nút Gửi + Hủy     nằm cuối hàng nhập, cũng ở góc phải–dưới
   Không ai sai luật tệp nào cả — chỗ ĐẬU mới là thứ không thuộc về ai.
   Cách chữa: HÀNG NHẬP GIỮ TRỌN GÓC PHẢI–DƯỚI. Mọi thứ nổi dạt lên giữa mép phải.
   ========================================================================== */

/* 1. Chuông + kim xăng: rời khỏi đáy, xếp dọc ở GIỮA mép phải */
html body #chuong-bao-fb-010,
html body .chuong-bao-fb-010 {
  bottom: auto !important;
  top: 42% !important;
  right: 10px !important;
}
html body #kim-xang-root,
html body div.kim-xang-wrap {
  position: fixed !important;
  bottom: auto !important;
  top: 56% !important;
  right: 10px !important;
}

/* 2. Nút "Tin mới nhất": nổi TRÊN khung nhập ở GIỮA đáy, không đè lên ô gõ hay nút gửi */
html body #btn-cuon-dong-moi,
html body .btn-cuon-dong-moi,
html body #dai-tin-moi {
  right: auto !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  bottom: 165px !important;
  z-index: 25 !important;
}
@media (max-width: 639px) {
  html body #btn-cuon-dong-moi,
  html body .btn-cuon-dong-moi,
  html body #dai-tin-moi {
    bottom: 125px !important;
  }
}

/* 3. Hàng nhập nằm TRÊN mọi thứ nổi — nút Gửi không bao giờ bị che */
html body #khung-nhap-tin-cuoc {
  position: relative !important;
  z-index: 40 !important;
}
html body #khung-nhap-tin-cuoc .nut-gui-nhom {
  position: relative !important;
  z-index: 40 !important;
}

/* 4. Chừa lề phải cho hàng nhập, để thứ nổi ở mép phải không chạm vào */
html body #khung-nhap-tin-cuoc .nut-gui-nhom {
  margin-right: 4px !important;
}

/* ============================================================
   CHỐT 10/9 22:36 — CHA CỦA Ô NHẬP KHÔNG ĐƯỢC CÓ transform
   Bất kỳ transform nào trên #khung-tin-nhan đều biến nó thành
   "khung chứa" cho con position:fixed. Khi đó ô nhập tin
   (#khung-nhap-tin-cuoc, bottom:0) neo vào ĐÁY HỘP chứ không
   phải ĐÁY MÀN HÌNH — và vì html,body được đặt height:auto
   lúc chạy, hộp nở dài hơn màn hình nên ô nhập rơi khỏi tầm mắt.
   Đây là gốc của ca "mất ô nhập + mất nút đọc chính tả" 10/9.
   Dòng dưới là lưới an toàn: ai lỡ thêm transform lại vẫn không gãy.
   ============================================================ */
html body #khung-tin-nhan { transform: none !important; }

/* ============================================================
   [DT-12] TỐI ƯU GIAO DIỆN ĐIỆN THOẠI & MÁY TÍNH BẢNG (07:30 JACK GÓP Ý)
   ============================================================ */

/* 1. DẤU BẢN BUILD LIVE: Ẩn stamp nổi dynamically chèn lên danh sách thẻ ghế */
#dau-ban-build-live,
.dau-ban-build-live {
  display: none !important;
}

/* 2. THẺ GHẾ TRÊN MÀN HẸP & ĐIỆN THOẠI (<= 1024px)
   Chữa lỗi (3): Danh sách ghế @ve-thu-hai @ve-mat @chat-loc @dos-7 xuống dòng loạn, gãy 3 dòng */
@media (max-width: 1024px) {
  .the-cuoc {
    padding: 6px 8px !important;
    min-height: 44px !important;
  }
  .the-cuoc-hang-chinh {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .the-cuoc-hang-chinh .btn-avatar-ghe {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    flex: 0 0 32px !important;
  }
  .the-cuoc-hang-chinh .the-cuoc-ten-cot {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 1px !important;
  }
  .the-cuoc-hang-chinh .the-cuoc-ten-dong-1 {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }
  .the-cuoc-hang-chinh .the-cuoc-ten-chu {
    min-width: 0 !important;
    flex: 0 1 auto !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .the-cuoc-hang-chinh .the-cuoc-ten-goc {
    min-width: 0 !important;
    font-size: 11px !important;
    color: var(--text-muted, #64748b) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .the-cuoc-hang-chinh .the-cuoc-duoi {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }
  /* KV-026: Ẩn tay nắm kéo trên màn cảm ứng / di động */
  .the-cuoc-hang-chinh .the-cuoc-drag-handle {
    display: none !important;
  }
  .the-cuoc-hang-chinh .the-cuoc-actions-hover {
    display: none !important;
  }
  .the-cuoc-hang-chinh .the-cuoc-actions-menu-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    font-size: 16px !important;
    border-radius: 4px !important;
  }
  .the-cuoc-hang-chinh .cham-trang-thai-dot.btn-trang-thai {
    display: inline-block !important;
    width: 10px !important;
    height: 10px !important;
    min-width: 10px !important;
    min-height: 10px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 4px !important;
    box-sizing: border-box !important;
    flex: 0 0 10px !important;
  }
}

/* 3. KHỔ ĐIỆN THOẠI (< 640px)
   Chữa lỗi (2): Thu cỡ chữ, giảm đệm cho vừa màn hẹp
   Chữa lỗi (4): Dòng 'lâu hơn thường lệ' không bị cắt cụt và đè lên dòng dưới
   Chữa lỗi (10): Tối ưu khung nhập không ăn 1/5 chiều cao màn hình */
@media (max-width: 639px) {
  /* Giảm đệm trùng lặp, mở rộng diện tích hiển thị tin nhắn */
  #khung-tin-nhan,
  .khung-tin-nhan {
    padding: 6px 8px 16px 8px !important;
    box-sizing: border-box !important;
  }
  #danh-sach-dong-terminal,
  #man-hinh-terminal,
  .truc-thoi-gian-doc,
  #tang-the-nhat-ky,
  #khung-chi-tiet-ba-tang {
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  /* Cỡ chữ dòng terminal và thẻ nhật ký */
  .dong-terminal,
  #danh-sach-dong-terminal .dong-terminal,
  #man-hinh-terminal .dong-terminal {
    font-size: 12px !important;
    line-height: 1.45 !important;
    padding: 2px 4px !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }
  .the-nhat-ky-card summary,
  .the-nhat-ky-body,
  .tang-the-nhat-ky .the-nhat-ky-body {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }
  .moc-timeline-item {
    font-size: 12px !important;
    padding: 6px 8px !important;
  }

  /* Chữa lỗi: Thanh trạng thái phản hồi và nút tải tin cũ ẩn hoàn toàn trên mobile để nhường chỗ cho Terminal */
  .thanh-trang-thai-tra-loi,
  #thanh-trang-thai-tra-loi,
  #khung-tai-tin-cu,
  #btn-tin-cu,
  .btn-tai-tin-cu,
  #btn-tai-tin-cu {
    display: none !important;
  }

}

/* 4. KHỔ TABLET (640px - 1024px, Z Fold 5 mở) */
@media (min-width: 640px) and (max-width: 1024px) {
  #khung-tin-nhan,
  .khung-tin-nhan {
    padding: 8px 24px 16px 12px !important;
    box-sizing: border-box !important;
  }
  #danh-sach-dong-terminal,
  #man-hinh-terminal {
    padding-right: 0 !important;
  }
}

/* ============================================================
   [DT-22] VÒNG 2: SỬA TRIỆT ĐỂ DẤU PHIÊN BẢN, NÚT CHI TIẾT & KHOẢNG ĐEN
   ============================================================ */

/* (C) DẤU PHIÊN BẢN: Trên mobile dời lên hàng 1 thanh đỉnh, tuyệt đối không đè hàng nút đáy */
@media (max-width: 639px) {
  html body #dau-ban-tu-dong,
  #dau-ban-tu-dong {
    display: none !important;
  }
}

/* (D1) NÚT "CHI TIẾT": Không bị ép width: 44px làm chém chữ thành "Chi tiế" */
html body #btn-mo-drawer-chi-tiet,
html body .thanh-dau-phai #btn-mo-drawer-chi-tiet {
  width: auto !important;
  min-width: 78px !important;
  max-width: none !important;
  padding: 0 8px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
}
html body #btn-mo-drawer-chi-tiet span {
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  display: inline-block !important;
}
.thanh-dau-trai {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
.thanh-dau-phai {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* (D2 & GT-61) Khung terminal thật cao ít nhất 55vh trên điện thoại (gỡ trần 110px và 180px) */
@media (max-width: 639px) {
  #man-hinh-terminal,
  .man-hinh-terminal-that {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 55vh !important;
    max-height: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
  }
  html body #man-hinh-terminal.terminal-hien-ban-tho #iframe-terminal-that {
    flex: 1 1 55vh !important;
    height: 55vh !important;
    min-height: 55vh !important;
    max-height: none !important;
    width: 100% !important;
    border-radius: 6px !important;
    border: 1px solid #334155 !important;
    margin-bottom: 6px !important;
    box-sizing: border-box !important;
  }
  #man-hinh-terminal.terminal-hien-ban-tho #danh-sach-dong-terminal {
    display: none !important;
  }
}

@media (min-width: 640px) and (max-width: 1024px) {
  #man-hinh-terminal,
  .man-hinh-terminal-that {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: calc(100vh - 50px - 48px - 140px) !important;
    max-height: none !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }
  html body #man-hinh-terminal #iframe-terminal-that,
  html body #iframe-terminal-that,
  #iframe-terminal-that {
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: calc(100vh - 50px - 48px - 140px) !important;
    max-height: none !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    margin-bottom: 0 !important;
    pointer-events: auto !important;
    touch-action: auto !important;
  }
  #danh-sach-dong-terminal {
    display: none !important;
  }
}

/* ============================================================
   [WO-KHAU-VI / JACK-17-58] MỘT Ô NHẬP DUY NHẤT TRÊN TAB S10 LITE & KHỔ RỘNG
   «hai cho nhap thi nguoi dung khong biet go vao dau, tuc la khong co cho nao»
   1. Gộp hai chỗ nhập làm MỘT ô nhập duy nhất (#nhap-tin-hoi-thoai)
   2. Ô nhập thật hiện ngay trước mặt, không giấu
   3. Nút không bị cắt chữ (overflow: visible, white-space: nowrap)
   4. Khung Đội ngũ trợ lý trùng tên ở cột trái: ẩn bản trùng (#cot-danh-sach-header)
   5. Thẻ trợ lý trên đỉnh thu gọn, không bị cắt thẻ cuối cùng
   ============================================================ */

/* 1. BỎ HOÀN TOÀN Ô TỰ CHẾ 1: HÀNG TERMINAL TRỰC TIẾP GIẢ LẬP ĐỂ KHÔNG CHỒNG 2 Ô */
#hang-nhap-terminal-truc-tiep,
.hang-nhap-terminal-truc-tiep,
#khung-nhap-tin-cuoc #hang-nhap-terminal-truc-tiep,
html body #hang-nhap-terminal-truc-tiep,
#nhap-terminal-truc-tiep,
#btn-go-thang {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 2. ẨN NHÃN DÀI THÒNG GÂY CHẬT CHỘI VÀ THANH CHIP TRÀN */
.nhan-hang-nhap-tuy-bien,
#hang-nhap-tuy-bien-cuoc .nhan-hang-nhap-tuy-bien,
#thanh-chip-lenh-nhanh,
.thanh-chip-lenh-nhanh,
html body #khung-nhap-tin-cuoc #thanh-chip-lenh-nhanh,
html body #thanh-chip-lenh-nhanh,
#khung-nhap-tin-cuoc .thanh-chip-lenh-nhanh {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* 3. KHUNG ĐÁY CHUẨN: 1 HÀNG DUY NHẤT, VỊ TRÍ CHUẨN DƯỚI TERMINAL */
body #khung-nhap-tin-cuoc.khung-nhap-tin,
html body #khung-nhap-tin-cuoc.khung-nhap-tin,
html body #khung-nhap-tin-cuoc,
html body .khung-nhap-tin,
#khung-nhap-tin-cuoc {
  position: fixed !important;
  bottom: 0 !important;
  right: 0 !important;
  left: 280px !important;
  width: calc(100% - 280px) !important;
  max-width: calc(100% - 280px) !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  padding: 6px 14px !important;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
  z-index: 100 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  box-sizing: border-box !important;
}

@media (max-width: 903px) {
  body #khung-nhap-tin-cuoc.khung-nhap-tin,
  html body #khung-nhap-tin-cuoc.khung-nhap-tin,
  html body #khung-nhap-tin-cuoc,
  html body .khung-nhap-tin,
  #khung-nhap-tin-cuoc {
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* 4. HÀNG NHẬP DUY NHẤT: Ô GÕ + CÔNG CỤ TRÊN CÙNG MỘT DÒNG */
#hang-nhap-tuy-bien-cuoc,
.hang-nhap-tuy-bien-cuoc,
#khung-nhap-tin-cuoc #hang-nhap-tuy-bien-cuoc,
html body #khung-nhap-tin-cuoc .hang-nhap-tuy-bien-cuoc {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  flex: 1 1 auto !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 5. Ô NHẬP THẬT DUY NHẤT HIỆN RÕ RÀNG TRƯỚC MẶT */
#nhap-tin-hoi-thoai,
.o-nhap-tin-cuoc,
html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 200px !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  border: 1.5px solid #94a3b8 !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  color: #1e293b !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
  resize: none !important;
  outline: none !important;
  margin: 0 !important;
}

#nhap-tin-hoi-thoai:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15) !important;
}

/* 6. THANH HÀNH ĐỘNG NẰM CÙNG HÀNG VỚI Ô NHẬP */
html body #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap,
html body .thanh-hanh-dong-nhap {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  height: 40px !important;
  min-height: 40px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.dos-voice-status-row {
  display: none !important;
}

/* 7. NÚT NÓI & NÚT DỪNG */
html body #khung-nhap-tin-cuoc .cong-cu-nhap-nhom,
html body .cong-cu-nhap-nhom {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
}

html body #khung-nhap-tin-cuoc .cong-cu-nhap-nhom .btn-cong-cu,
html body #khung-nhap-tin-cuoc #btn-mic-giong-noi,
html body #khung-nhap-tin-cuoc #btn-ctrl-c {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 44px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  gap: 4px !important;
  flex: 0 0 auto !important;
}

html body #khung-nhap-tin-cuoc .thong-tin-ban-nhap {
  display: none !important;
}

/* 8. NÚT HUỶ & NÚT GỬI - CẤM CẮT CHỮ */
html body #khung-nhap-tin-cuoc .nut-gui-nhom,
html body .nut-gui-nhom {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
}

html body #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec,
html body #btn-huy-giao-viec {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 44px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  flex: 0 0 auto !important;
}

html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan,
html body #btn-gui-tin-nhan {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 60px !important;
  width: auto !important;
  max-width: none !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 14px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  background: #0284c7 !important;
  border: none !important;
  color: #ffffff !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  text-overflow: clip !important;
  overflow: visible !important;
  cursor: pointer !important;
  flex: 0 0 auto !important;
}

html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan::after,
html body #btn-gui-tin-nhan::after {
  content: "" !important;
  display: none !important;
}

/* 9. BỐ CỤC KHUNG ĐỌC VÀ LƯỚI 2 CỘT (MASTER-DETAIL) CHỐNG ĐÈ NHAU */
html body.du-lieu-te-liet,
html body.du-lieu-chet-vua,
html body.mat-ket-noi-dang-bat,
html body[class*="du-lieu-"],
html body,
html body div#khung-tin-nhan,
html body div.khung-tin-nhan,
html body.du-lieu-chet-vua div#khung-tin-nhan,
html body.du-lieu-te-liet div#khung-tin-nhan,
html body div#khung-than-doc,
html body div#khung-doc-va-the-wrap,
html body div.cot-noi-dung,
html body div.khung-hoi-thoai-grid,
html body section#buong-hoi-thoai-chinh {
  filter: none !important;
  transform: none !important;
  perspective: none !important;
  contain: none !important;
}

#thanh-trang-thai-tra-loi,
.thanh-trang-thai-tra-loi,
.cham-tra-loi-nhap-nhay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 10. GỠ BỎ KHUNG ĐỘI NGŨ TRỢ LÝ TRÙNG TÊN Ở CỘT TRÁI TRÊN >= 640px */
@media (min-width: 640px) {
  #cot-danh-sach-header,
  .cot-danh-sach #cot-danh-sach-header,
  html body #cot-danh-sach-header {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }
}

/* 11. KHÔNG CẮT CHỮ CÁC NÚT GOM NHÓM SIDEBAR */
.cot-danh-sach {
  overflow-x: hidden !important;
}
.tabs-gom-nhom {
  display: flex !important;
  flex-wrap: wrap !important;
  overflow: hidden !important;
  max-width: 100% !important;
  gap: 6px !important;
}
.tab-gom {
  flex: 0 0 auto !important;
  max-width: none !important;
  width: auto !important;
  overflow: visible !important;
  white-space: nowrap !important;
  text-overflow: clip !important;
  padding: 6px 12px !important;
}

#gop-y-lazy-trigger,
button#gop-y-lazy-trigger {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#kim-xang-root,
.kim-xang-wrap,
html body #kim-xang-root,
html body div.kim-xang-wrap {
  position: fixed !important;
  top: 4px !important;
  bottom: auto !important;
  left: 460px !important;
  right: auto !important;
  z-index: 100 !important;
}

/* 12. THANH THẺ TRỢ LÝ TRÊN ĐỈNH: GỌN GÀNG, KHÔNG CẮT THẺ CUỐI */
.hang-the-trang-doc,
#hang-the-trang-doc {
  position: static !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  flex: 0 0 48px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 4px 8px !important;
  box-sizing: border-box !important;
  scrollbar-width: thin !important;
  scrollbar-color: #cbd5e1 transparent !important;
  margin: 0 !important;
}
.hang-the-trang-doc::-webkit-scrollbar {
  display: block !important;
  height: 4px !important;
}
.hang-the-trang-doc::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 2px !important;
}

.the-trang,
.the-trang-item,
html body #hang-the-trang-doc .the-trang-item,
html body .the-trang-item {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 4px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 2px 8px !important;
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  white-space: nowrap !important;
  max-width: 180px !important;
  width: auto !important;
}

html body #hang-the-trang-doc .the-trang-item .the-trang-ten,
.the-trang-item .the-trang-ten {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  max-width: 120px !important;
  min-width: 40px !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #1e293b !important;
}

.the-trang-item:not(.dang-chon):not(.active) .btn-ghim-the,
.the-trang-item:not(.dang-chon):not(.active) .btn-doi-ten-the,
html body #hang-the-trang-doc .the-trang-item:not(.dang-chon):not(.active) .btn-ghim-the,
html body #hang-the-trang-doc .the-trang-item:not(.dang-chon):not(.active) .btn-doi-ten-the {
  display: none !important;
}

/* Bình thường chỉ giữ nút đóng; ghim và sửa hiện khi trỏ vào thẻ đang mở. */
html body #hang-the-trang-doc .the-trang-item.dang-chon .btn-ghim-the,
html body #hang-the-trang-doc .the-trang-item.dang-chon .btn-doi-ten-the {
  display: none !important;
}

html body #hang-the-trang-doc .the-trang-item.dang-chon:hover .btn-ghim-the,
html body #hang-the-trang-doc .the-trang-item.dang-chon:hover .btn-doi-ten-the,
html body #hang-the-trang-doc .the-trang-item.dang-chon:focus-within .btn-ghim-the,
html body #hang-the-trang-doc .the-trang-item.dang-chon:focus-within .btn-doi-ten-the {
  display: inline-flex !important;
}

.the-trang button,
.the-trang .the-trang-btn-action,
.the-trang .the-trang-dong-btn,
.the-trang-item button,
.the-trang-item .the-trang-btn-action,
.the-trang-item .the-trang-dong-btn,
.the-trang-item .btn-doi-ten-the,
.the-trang-item .btn-ghim-the,
html body #hang-the-trang-doc .the-trang-item button,
html body #hang-the-trang-doc .the-trang-item button[onclick],
html body #hang-the-trang-doc .the-trang-item [onclick],
html body #hang-the-trang-doc .the-trang-item .the-trang-btn-action,
html body #hang-the-trang-doc .the-trang-item .the-trang-dong-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  min-width: 0 !important;
  max-width: 20px !important;
  height: 20px !important;
  min-height: 0 !important;
  max-height: 20px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 4px !important;
  font-size: 10px !important;
  flex: 0 0 20px !important;
  box-sizing: border-box !important;
}

.btn-them-the-trang {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 12px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
}

/* Thanh chế độ xem: 1 hàng ngang duy nhất, dính ở đỉnh khung tin nhắn, không bao giờ trồi lên thanh thẻ */
#thanh-che-do-xem,
body #thanh-che-do-xem {
  position: sticky !important;
  top: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  flex: 0 0 44px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 0 12px !important;
  box-sizing: border-box !important;
  scrollbar-width: none !important;
  margin: 0 !important;
  z-index: 15 !important;
}
#thanh-che-do-xem::-webkit-scrollbar {
  display: none !important;
}

#thanh-che-do-xem > div,
#bo-chuyen-tang-tin {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
}

#thanh-che-do-xem button,
#thanh-che-do-xem .nut-tang-tin {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  padding: 0 10px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
}

/* Đảm bảo khung tin nhắn không bị cuộn đẩy terminal ra ngoài tầm nhìn */
#khung-tin-nhan,
.khung-tin-nhan {
  padding-bottom: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  overflow-y: hidden !important;
}

#danh-sach-dong-terminal,
#khung-cuon-tin-nhan {
  padding-bottom: 0 !important;
  box-sizing: border-box !important;
}

#man-hinh-terminal:not([style*="none"]) ~ .dong-tin,
.man-hinh-terminal-that:not([style*="none"]) ~ .dong-tin {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

#gop-y-lazy-trigger,
button#gop-y-lazy-trigger {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#kim-xang-root,
.kim-xang-wrap,
html body #kim-xang-root,
html body div.kim-xang-wrap {
  position: fixed !important;
  top: 6px !important;
  bottom: auto !important;
  right: 280px !important;
  left: auto !important;
  z-index: 120 !important;
}

@media (min-width: 860px) {
  html body .khung-hoi-thoai-grid,
  html body #khung-hoi-thoai-grid,
  .khung-hoi-thoai-grid {
    display: grid !important;
    grid-template-columns: 280px minmax(0, 1fr) !important;
    grid-template-rows: 100% !important;
    position: fixed !important;
    top: 50px !important;
    bottom: 48px !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(100vh - 50px - 48px) !important;
    max-height: calc(100vh - 50px - 48px) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    z-index: 5 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  html body .khung-hoi-thoai-grid.sidebar-gap,
  html body #khung-hoi-thoai-grid.sidebar-gap {
    grid-template-columns: 68px minmax(0, 1fr) !important;
  }

  .cot-danh-sach {
    grid-column: 1 / 2 !important;
    grid-row: 1 / 2 !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    max-width: 280px !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    border-right: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    z-index: 6 !important;
    box-sizing: border-box !important;
    padding-bottom: 20px !important;
  }

  .khung-hoi-thoai-grid.sidebar-gap .cot-danh-sach {
    width: 68px !important;
    max-width: 68px !important;
  }

  .mep-keo-sidebar {
    display: none !important;
    width: 0 !important;
    pointer-events: none !important;
  }

  .cot-noi-dung {
    grid-column: 2 / 3 !important;
    grid-row: 1 / 2 !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    z-index: 6 !important;
    box-sizing: border-box !important;
  }

  /* Ô nhập đáy trên màn >= 860px: Bắt đầu từ mép cột nội dung (left: 280px) */
  html body #khung-nhap-tin-cuoc,
  html body .khung-nhap-tin {
    left: 280px !important;
    right: 0 !important;
    width: calc(100% - 280px) !important;
  }
  html body .khung-hoi-thoai-grid.sidebar-gap ~ #khung-nhap-tin-cuoc,
  html body.sidebar-gap #khung-nhap-tin-cuoc {
    left: 68px !important;
    width: calc(100% - 68px) !important;
  }

  #btn-mo-drawer-tro-ly {
    display: none !important;
  }
}

@media (max-width: 859px) {
  .thanh-dau-phai #kim-xang-root,
  .thanh-dau-phai .kim-xang-wrap {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    flex-shrink: 0 !important;
    margin: 0 4px !important;
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 50% !important;
    z-index: 10 !important;
  }

  body > #kim-xang-root,
  body > .kim-xang-wrap,
  html body > #kim-xang-root,
  html body > div.kim-xang-wrap {
    top: 5px !important;
    bottom: auto !important;
    right: 50px !important;
    left: auto !important;
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 50% !important;
    z-index: 120 !important;
  }

  html body .khung-hoi-thoai-grid,
  html body #khung-hoi-thoai-grid,
  .khung-hoi-thoai-grid {
    display: block !important;
    position: fixed !important;
    top: 50px !important;
    bottom: 48px !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(100vh - 50px - 48px) !important;
    max-height: calc(100vh - 50px - 48px) !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    z-index: 5 !important;
    padding: 0 0 16px 0 !important;
    margin: 0 !important;
  }

  .cot-danh-sach:not(.drawer-mo) {
    display: none !important;
  }

  .cot-danh-sach.drawer-mo {
    display: flex !important;
    position: fixed !important;
    top: 48px !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: calc(100vh - 48px) !important;
    background: #ffffff !important;
    z-index: 500 !important;
    padding-bottom: 120px !important;
    box-sizing: border-box !important;
  }

  #backdrop-danh-sach-ghe.drawer-mo {
    top: 48px !important;
    height: calc(100vh - 48px) !important;
    z-index: 490 !important;
  }

  .cot-danh-sach.drawer-mo #cot-danh-sach-top-bar {
    display: none !important;
  }

  .cot-danh-sach.drawer-mo #cot-danh-sach-header {
    display: flex !important;
  }

  .mep-keo-sidebar {
    display: none !important;
  }

  .cot-noi-dung {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    min-height: 100% !important;
    box-sizing: border-box !important;
  }

  html body #khung-nhap-tin-cuoc,
  html body .khung-nhap-tin {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  #btn-mo-drawer-tro-ly {
    display: inline-flex !important;
  }
}

#drawer-chi-tiet-du-phong[style*="display: none"],
#drawer-chi-tiet-du-phong[style*="display:none"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#drawer-chi-tiet-du-phong:not([style*="display: none"]):not([style*="display:none"]) {
  background: #ffffff !important;
  z-index: 600 !important;
  padding-bottom: 140px !important;
}

/* WO-VI-SAO-VA-KHONG-AN: backdrop chỉ là nền thị giác; không được bắt hit-test
   của các thẻ phiên phía sau. Nút đóng trong drawer vẫn là đường đóng chính. */
#backdrop-chi-tiet-du-phong {
  z-index: 599 !important;
  pointer-events: none !important;
}

#drawer-chi-tiet-du-phong {
  z-index: 600 !important;
}

/* ==========================================================================
   NÂNG CẤP CHUẨN HÓA NÚT HÀNH LANG PHIÊN, TẦNG TIN VÀ CHỐNG TRÀN HEADER (Việc 3)
   ========================================================================== */
#thanh-che-do-xem {
  border-radius: 8px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

#btn-xem-lai-so,
#btn-chuyen-buc-tranh-3-tang,
.bo-chuyen-tang-tin .nut-tang-tin,
.bo-chuyen-tang-tin-drawer .nut-tang-tin {
  border-radius: 8px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  min-height: 38px !important;
  height: 38px !important;
  padding: 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-sizing: border-box !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
  touch-action: manipulation !important;
}

#btn-xem-lai-so {
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #334155 !important;
}
#btn-xem-lai-so:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
}

#btn-chuyen-buc-tranh-3-tang {
  border: 1px solid #bae6fd !important;
  background: #f0f9ff !important;
  color: #0284c7 !important;
}
#btn-chuyen-buc-tranh-3-tang:hover {
  background: #e0f2fe !important;
  border-color: #38bdf8 !important;
  color: #0369a1 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15) !important;
}

.bo-chuyen-tang-tin .nut-tang-tin,
.bo-chuyen-tang-tin-drawer .nut-tang-tin {
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #64748b !important;
}
.bo-chuyen-tang-tin .nut-tang-tin:hover,
.bo-chuyen-tang-tin-drawer .nut-tang-tin:hover {
  background: #f1f5f9 !important;
  color: #1e293b !important;
}
.bo-chuyen-tang-tin .nut-tang-tin.tang-active,
.bo-chuyen-tang-tin-drawer .nut-tang-tin.tang-active {
  border: 1px solid #0284c7 !important;
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25) !important;
}

/* Chống tràn header Căn phòng chi tiết (Việc 3) */
#drawer-chi-tiet-du-phong .drawer-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 10px 14px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
#drawer-chi-tiet-du-phong .drawer-title-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
}
#drawer-chi-tiet-du-phong .drawer-title-group > div {
  min-width: 0 !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
}
#drawer-chi-tiet-du-phong .drawer-ten {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#drawer-chi-tiet-du-phong .drawer-vai {
  font-size: 11.5px !important;
  color: #64748b !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#drawer-chi-tiet-du-phong #drawer-dp-btn-dong {
  flex-shrink: 0 !important;
  margin-left: 8px !important;
}

/* 7. GIỚI HẠN PHẦN TỬ NỔI TRÊN MÀN HẸP <= 639px (TRẦN <= 4 PHẦN TỬ NỔI) */
@media (max-width: 639px) {
  #chuong-bao-fb-010,
  .chuong-bao-fb-010,
  #ban-do-noi-nut,
  #la-ban-nut-noi,
  #la-ban-bong-thoai,
  #floating-mascot,
  #btn-cuon-dong-moi,
  #dai-tin-moi {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html body #kim-xang-root,
  html body div.kim-xang-wrap {
    position: fixed !important;
    bottom: 120px !important;
    right: 12px !important;
    z-index: 50 !important;
  }
}

/* WO-DIEN-THOAI-RON: Chống nháy layout - Chuyển toàn bộ inline style chu kỳ sang CSS tĩnh */
button, .btn-action, .nut-dinh-phu, .master-tab {
  text-overflow: clip !important;
  overflow: visible !important;
  white-space: nowrap !important;
}

#dau-ban-build-live,
.dau-ban-build-live {
  display: none !important;
  visibility: hidden !important;
  font-size: 12px !important;
}
#dau-ban-build-live b,
.dau-ban-build-live b {
  font-size: 12px !important;
}

#khung-nhap-tin-cuoc {
  visibility: visible !important;
  pointer-events: auto !important;
}

#ban-do-noi-nut,
#la-ban-nut-noi,
#la-ban-bong-thoai,
#floating-mascot {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#kim-xang-wrap,
.kim-xang-wrap {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ==========================================================================
   MA GIAO: LECH-22 — SUA LAYOUT MAN DOC HEP (Z FOLD 5 GAP 390x844)
   - Chữa lỗi lệch layout, đè nhau, tràn mép trên điện thoại
   - Thanh thẻ trợ lý gọn gàng, hiển thị rõ tên, avatar không bị đẩy ra left: -17px
   - Khung nhập đáy: hiện rõ ô gõ và nút GỬI, không bị tràn 359px ra ngoài mép phải
   ========================================================================== */
@media (max-width: 639px) {
  html, body {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  html body .khung-hoi-thoai-grid,
  html body #khung-hoi-thoai-grid,
  .khung-hoi-thoai-grid {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .cot-noi-dung,
  #khung-doc-va-the-wrap,
  #khung-than-doc {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* 1. Thanh thẻ trợ lý trên đỉnh: 1 hàng ngang vuốt mượt, không đè nút */
  html body #hang-the-trang-doc,
  html body .hang-the-trang-doc,
  #hang-the-trang-doc {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    padding: 4px 8px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
  }
  #hang-the-trang-doc::-webkit-scrollbar {
    display: none !important;
  }

  /* Thẻ trợ lý: dạng pill ngang chuẩn, đọc được tên thẻ, không bị bóp về 0px */
  html body #hang-the-trang-doc .the-trang-item,
  html body .the-trang-item,
  .the-trang-item {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    -webkit-box-orient: horizontal !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 140px !important;
    padding: 0 8px !important;
    margin: 0 !important;
    gap: 5px !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
  }

  /* Avatar trong thẻ: 20x20px tròn trịa, không bị đẩy sang left: -17px */
  html body .the-trang-item img.agent-avatar-circle,
  html body .the-trang-item .agent-avatar-circle {
    display: inline-block !important;
    position: static !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    border-radius: 50% !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 20px !important;
    transform: none !important;
    object-fit: cover !important;
  }

  /* Chấm trạng thái: 8x8px */
  html body .the-trang-item .cham-trang-thai-dot {
    display: inline-block !important;
    position: static !important;
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    min-height: 8px !important;
    max-width: 8px !important;
    max-height: 8px !important;
    border-radius: 50% !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 8px !important;
  }

  /* Tên thẻ: hiển thị rõ chữ, tối đa 75px */
  html body #hang-the-trang-doc .the-trang-item .the-trang-ten,
  html body .the-trang-item .the-trang-ten,
  .the-trang-item .the-trang-ten {
    display: inline-block !important;
    position: static !important;
    width: auto !important;
    min-width: 25px !important;
    max-width: 75px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    color: #1e293b !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 1 auto !important;
  }

  /* Ẩn nút ghim và sửa tên trên màn hình hẹp <= 639px để chống tràn nút (3 ID) */
  html body #hang-the-trang-doc:not(#kx-ke-backdrop):not(#backdrop-danh-sach-ghe) .the-trang-item button.btn-ghim-the,
  html body #hang-the-trang-doc:not(#kx-ke-backdrop):not(#backdrop-danh-sach-ghe) .the-trang-item button.btn-doi-ten-the,
  html body #hang-the-trang-doc:not(#kx-ke-backdrop):not(#backdrop-danh-sach-ghe) .the-trang-item .the-trang-btn-action,
  html body #hang-the-trang-doc .the-trang-item .btn-ghim-the,
  html body #hang-the-trang-doc .the-trang-item .btn-doi-ten-the,
  html body #hang-the-trang-doc .the-trang-item .the-trang-btn-action,
  html body .the-trang-item .btn-ghim-the,
  html body .the-trang-item .btn-doi-ten-the,
  html body .the-trang-item .the-trang-btn-action {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
  }

  /* Nút đóng thẻ: nhỏ gọn 20x20px, ghi đè hoàn toàn min-width 44px từ tham-my.css và [onclick] (3 ID) */
  html body #hang-the-trang-doc:not(#kx-ke-backdrop):not(#backdrop-danh-sach-ghe) .the-trang-item button[onclick].the-trang-dong-btn,
  html body #hang-the-trang-doc:not(#kx-ke-backdrop):not(#backdrop-danh-sach-ghe) .the-trang-item button.the-trang-dong-btn,
  html body #hang-the-trang-doc:not(#kx-ke-backdrop):not(#backdrop-danh-sach-ghe) .the-trang-item .the-trang-dong-btn,
  html body #hang-the-trang-doc .the-trang-item button[onclick].the-trang-dong-btn,
  html body #hang-the-trang-doc .the-trang-item button.the-trang-dong-btn,
  html body .the-trang-item button[onclick],
  html body .the-trang-item .the-trang-dong-btn,
  html body button[onclick].the-trang-dong-btn,
  html body button.the-trang-dong-btn,
  button[onclick].the-trang-dong-btn,
  button.the-trang-dong-btn,
  .the-trang-dong-btn {
    display: inline-flex !important;
    visibility: visible !important;
    align-items: center !important;
    justify-content: center !important;
    position: static !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    color: #94a3b8 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    flex: 0 0 20px !important;
    cursor: pointer !important;
  }

  /* Nút thêm thẻ */
  html body #hang-the-trang-doc .btn-them-the-trang,
  html body .btn-them-the-trang {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    flex: 0 0 auto !important;
    border-radius: 8px !important;
  }

  /* 2. Thanh chế độ xem: cuộn ngang mượt, không vỡ layout */
  html body #thanh-che-do-xem,
  #thanh-che-do-xem {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 2px 8px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  #thanh-che-do-xem::-webkit-scrollbar {
    display: none !important;
  }

  html body #thanh-che-do-xem button,
  html body #thanh-che-do-xem .nut-tang-tin,
  html body #btn-chuyen-buc-tranh-3-tang {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
  }

  /* 3. Khung nhập đáy: Luôn nằm ở đáy, đúng rộng 100vw, hiện rõ nút GỬI và ô gõ */
  html body #khung-nhap-tin-cuoc.khung-nhap-tin,
  html body #khung-nhap-tin-cuoc,
  html body .khung-nhap-tin,
  #khung-nhap-tin-cuoc {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    padding: 6px 8px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border-top: 1px solid #cbd5e1 !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06) !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    overflow: hidden !important;
  }

  /* Hàng nhập tùy biến cuộc: chiếm toàn bộ chiều rộng khung */
  html body #khung-nhap-tin-cuoc #hang-nhap-tuy-bien-cuoc,
  html body #hang-nhap-tuy-bien-cuoc,
  #hang-nhap-tuy-bien-cuoc {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 6px !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  /* Ô nhập tin thoại: Co dãn tự động trên phần còn lại của màn hình */
  html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
  html body #nhap-tin-hoi-thoai,
  #nhap-tin-hoi-thoai {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    border: 1.5px solid #94a3b8 !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    color: #0f172a !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    resize: none !important;
    outline: none !important;
    margin: 0 !important;
  }

  /* Thanh hành động nhập: không tràn trái, không đè ô gõ */
  html body #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap,
  html body .thanh-hanh-dong-nhap {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 5px !important;
    height: 40px !important;
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Cụm công cụ mic + ctrl-c */
  html body #khung-nhap-tin-cuoc .cong-cu-nhap-nhom,
  html body .cong-cu-nhap-nhom {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 5px !important;
    width: auto !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  /* Ẩn nhãn chữ "Nói", "Dừng" để nút vuông gọn 38px trên mobile */
  html body #khung-nhap-tin-cuoc .btn-nhan-chu {
    display: none !important;
  }

  /* Nút Mic và Dừng */
  html body #khung-nhap-tin-cuoc #btn-mic-giong-noi,
  html body #khung-nhap-tin-cuoc #btn-ctrl-c,
  html body #btn-mic-giong-noi,
  html body #btn-ctrl-c {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    flex: 0 0 38px !important;
    box-sizing: border-box !important;
  }

  /* Ẩn voice status và nút huỷ để bảo toàn 100% diện tích cho ô nhập và nút gửi */
  html body #khung-nhap-tin-cuoc .dos-voice-status-row,
  .dos-voice-status-row,
  html body #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec,
  html body #khung-nhap-tin-cuoc #btn-huy-giao-viec,
  html body .nut-gui-nhom #btn-huy-giao-viec,
  html body #btn-huy-giao-viec {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }

  /* Cụm nút gửi: gọn gàng */
  html body #khung-nhap-tin-cuoc .nut-gui-nhom,
  html body .nut-gui-nhom {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
  }

  /* Nút Gửi tin nhắn: Luôn luôn hiện rõ ở góc phải, dễ bấm */
  html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan,
  html body #btn-gui-tin-nhan {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    align-items: center !important;
    justify-content: center !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 8px !important;
    background: #0284c7 !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    flex: 0 0 48px !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    white-space: nowrap !important;
  }

  /* 4. Khung cuộn tin nhắn: chống bị che bởi khung nhập đáy */
  html body #khung-tin-nhan,
  html body .khung-tin-nhan,
  html body #khung-cuon-tin-nhan {
    padding-bottom: 72px !important;
    box-sizing: border-box !important;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
}

/* P0: keep the readable transcript as the only full/summary face. */
html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal.terminal-hien-da-don,
html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal.terminal-hien-ban-tho {
  flex: 1 1 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

html body #man-hinh-terminal.terminal-hien-da-don #danh-sach-dong-terminal {
  display: block !important;
  flex: 1 1 100% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

html body #man-hinh-terminal.terminal-hien-da-don #iframe-terminal-that {
  display: none !important;
  flex: 0 0 0 !important;
  height: 0 !important;
  min-height: 0 !important;
}

html body #man-hinh-terminal.terminal-hien-ban-tho #iframe-terminal-that {
  display: block !important;
  flex: 1 1 100% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
}

html body #man-hinh-terminal.terminal-hien-ban-tho #danh-sach-dong-terminal {
  display: none !important;
}

/* WO-MOBILE-TERMINAL-COLLAPSE-FIX: Chống sụp chiều cao #man-hinh-terminal trên mobile */
@media (max-width: 639px) {
  html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal,
  html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal.terminal-hien-da-don,
  html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal.terminal-hien-ban-tho {
    flex: 1 1 auto !important;
    min-height: 55vh !important;
    height: 55vh !important;
  }
}

/* Tên tab: căn cước kỹ thuật ở trên, tên Jack đặt ở dưới khi state có rename. */
html body .the-trang-item > .the-trang-ten {
  display: flex !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: 180px !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 1px !important;
  overflow: hidden !important;
  line-height: 1.1 !important;
}

html body .the-trang-item > .the-trang-ten .the-trang-ten-ky-thuat,
html body .the-trang-item > .the-trang-ten .the-trang-ten-nguoi-dat {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .the-trang-item > .the-trang-ten .the-trang-ten-ky-thuat {
  color: inherit !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

html body .the-trang-item > .the-trang-ten .the-trang-ten-nguoi-dat {
  color: #475569 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

/* WO-SUA-LAYOUT-VA-KHUNG-TRANG-8444: kệ phải mở thì khung chính phải nhường
   đúng phần rộng của kệ; grid fixed không chịu ảnh hưởng bởi body padding. */
@media (min-width: 1100px) and (pointer: fine) {
  html body.ke-phai-mo:not(.ke-phai-toan-man) .khung-hoi-thoai-grid,
  html body.ke-phai-mo:not(.ke-phai-toan-man) #khung-hoi-thoai-grid {
    right: 0 !important;
    width: 100% !important;
  }

  html body.ke-phai-mo:not(.ke-phai-toan-man) #khung-nhap-tin-cuoc,
  html body.ke-phai-mo:not(.ke-phai-toan-man) .khung-nhap-tin {
    right: 0 !important;
    width: auto !important;
  }
}

/* WO-THU-AGY-GAP-MO-THU-MUC: Đảm bảo khi thân thư mục/nhánh/thẻ gấp lại (hidden) thì biến mất hoàn toàn */
.du-an-the-cay-than[hidden],
.du-an-the-muc-the-than[hidden],
.du-an-the-nhom-than[hidden] {
  display: none !important;
}

/* ==========================================================================
   WO-LAM-DEP-DU-PHONG-V1: LÀM ĐẸP TRANG DỰ PHÒNG CHUYÊN NGHIỆP & SỐNG ĐỘNG
   Cảm hứng: Bảng điều khiển dòng lệnh / terminal AI chất lượng cao (Antigravity UI)
   - Thiết kế tinh tế, nhịp thị giác cao cấp, phân cấp sắc độ và khoảng đệm chuẩn
   - Tối ưu Fitts touch target >= 44pt trên mobile/tablet
   - Giữ nguyên 100% logic dữ liệu, id/class hiện có của hệ thống
   ========================================================================== */

/* 0. Dọn sạch các phần tử mồ côi và thanh đáy thừa */
#dos-v12-topbar,
.dos-v12-topbar,
#dos-v12-bottom-bar,
.dos-v12-bottom-bar {
  display: none !important;
}

/* Nút nổi thêm nhanh (Nut Noi) - Tầng 3 chuẩn Fitts */
#display-os-nut-noi-them,
div[data-display-os="nut-noi-them"] {
  display: block !important;
  position: fixed !important;
  z-index: 35 !important;
  right: max(16px, env(safe-area-inset-right)) !important;
  bottom: max(76px, env(safe-area-inset-bottom)) !important;
}

/* 1. THANH TIÊU ĐỀ ĐỈNH TRỰC TIẾP (#thanh-dau-doc-cuoc) - PHONG CÁCH AEROSPACE TERMINAL */
html body #thanh-dau-doc-cuoc,
html body .thanh-dau-doc-cuoc {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  z-index: 100 !important;
  background: #090d16 !important;
  border-bottom: 1px solid #1e293b !important;
  padding: 0 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

/* Nút thoát về thế giới */
#btn-ve-the-gioi-top,
html body #btn-ve-the-gioi-top {
  min-width: 38px !important;
  min-height: 38px !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 8px !important;
  background: rgba(56, 189, 248, 0.1) !important;
  border: 1px solid rgba(56, 189, 248, 0.28) !important;
  color: #38bdf8 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
#btn-ve-the-gioi-top:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: #38bdf8 !important;
  transform: translateX(-2px) !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
}

/* Avatar nhân vật trong thanh đỉnh */
#thanh-dau-avatar,
.thanh-dau-avatar {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-right: 6px !important;
}
#thanh-dau-avatar img,
#thanh-dau-avatar .agent-avatar-circle {
  border-radius: 50% !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4) !important;
}

/* Tên trợ lý và trạng thái hoạt động thanh đỉnh */
.thanh-dau-dong-ten {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
#thanh-dau-ten-ghe {
  color: #f8fafc !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}
#thanh-dau-lan-cuoi {
  color: #94a3b8 !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  font-family: "SF Mono", Menlo, Consolas, monospace !important;
}

/* Chấm trạng thái sống động (Pulse glow animation) */
@keyframes pulseDotLive {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@keyframes pulseDotAmber {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.cham-trang-thai-dot.tt-dang-chay,
.cham-trang-thai-dot.status-dang-tra-loi,
#thanh-dau-badge-tt {
  border-radius: 50% !important;
  animation: pulseDotLive 2s infinite !important;
}

/* Các nút điều hướng và công cụ góc phải thanh đỉnh */
.thanh-dau-phai {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
#btn-mo-drawer-chi-tiet,
html body #btn-mo-drawer-chi-tiet {
  min-height: 38px !important;
  min-width: 44px !important;
  padding: 0 14px !important;
  border-radius: 8px !important;
  background: rgba(56, 189, 248, 0.12) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  transition: all 0.18s ease !important;
}
#btn-mo-drawer-chi-tiet:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25) !important;
}
#btn-mo-ke-phai,
html body #btn-mo-ke-phai {
  min-height: 38px !important;
  min-width: 44px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #f1f5f9 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  transition: all 0.18s ease !important;
}
#btn-mo-ke-phai:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}
#btn-menu-thanh-dau-them,
html body #btn-menu-thanh-dau-them {
  min-height: 38px !important;
  min-width: 38px !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #cbd5e1 !important;
  font-size: 16px !important;
  transition: all 0.18s ease !important;
}
#btn-menu-thanh-dau-them:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

/* 2. CỘT DANH SÁCH PHIÊN & TRỢ LÝ (.cot-danh-sach) */
.cot-danh-sach {
  background: #f8fafc !important;
  border-right: 1px solid #cbd5e1 !important;
  box-sizing: border-box !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}
.cot-danh-sach-top-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 14px 10px 14px !important;
  border-bottom: 1px solid #f1f5f9 !important;
}
.top-bar-tieu-de {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #334155 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.dem-so-ghe-badge {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
  border-radius: 999px !important;
  padding: 1px 7px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

/* Dãy tab gom nhóm bộ lọc: Segmented Pill Control */
.thanh-loc-gom-nhom {
  padding: 10px 12px !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
.tabs-gom-nhom {
  display: flex !important;
  background: #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 3px !important;
  gap: 2px !important;
  margin-bottom: 10px !important;
}
.tab-gom {
  flex: 1 1 0 !important;
  text-align: center !important;
  border: none !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 4px !important;
  cursor: pointer !important;
  transition: all 0.16s ease !important;
  min-height: 32px !important;
}
.tab-gom:hover {
  color: #0f172a !important;
}
.tab-gom.dang-chon {
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12) !important;
}

/* Ô tìm kiếm trợ lý: phong cách command palette */
.o-tim-kiem-cuoc {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  color: #0f172a !important;
  transition: all 0.16s ease !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}
.o-tim-kiem-cuoc:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.16) !important;
  outline: none !important;
}
.o-tim-kiem-cuoc::placeholder {
  color: #94a3b8 !important;
  font-size: 12.5px !important;
}

/* Thẻ phiên trợ lý (.the-cuoc) */
.the-cuoc {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  margin: 6px 8px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03) !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  position: relative !important;
}
.the-cuoc:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07) !important;
  transform: translateY(-1px) !important;
}
/* Trạng thái thẻ được chọn (.the-cuoc.dang-chon): nổi bật tinh tế, chữ rõ nét */
.the-cuoc.dang-chon,
.the-cuoc.active {
  background: #f0f9ff !important;
  border: 1.5px solid #0284c7 !important;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.15) !important;
}
.the-cuoc.dang-chon .the-cuoc-ten,
.the-cuoc.dang-chon strong {
  color: #0369a1 !important;
  font-weight: 700 !important;
}
.the-cuoc.dang-chon .the-cuoc-mo-ta,
.the-cuoc.dang-chon .the-cuoc-meta {
  color: #334155 !important;
}

/* Thư mục dự án và cây nhánh */
.du-an-the-nhom-dau,
.du-an-the-cay-dau {
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
}
.vung-tach-cay {
  background: rgba(2, 132, 199, 0.04) !important;
  border: 1px dashed #7dd3fc !important;
  border-radius: 8px !important;
  color: #0284c7 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 8px 12px !important;
  margin: 6px 8px !important;
  text-align: center !important;
}

/* 3. DÃY TABS TRỢ LÝ ĐANG MỞ (#hang-the-trang-doc) - PHONG CÁCH IDE TABS HIỆN ĐẠI */
#hang-the-trang-doc,
.hang-the-trang-doc {
  background: var(--paper, #f1f5f9) !important;
  border-bottom: 1px solid var(--line, #cbd5e1) !important;
  padding: 3px 8px !important;
  gap: 6px !important;
  min-height: 36px !important;
  height: 36px !important;
  max-height: 36px !important;
  align-items: center !important;
}
.the-trang-item,
html body #hang-the-trang-doc .the-trang-item {
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  padding: 0 10px 0 12px !important;
  border-radius: 8px 8px 0 0 !important;
  background: rgba(226, 232, 240, 0.6) !important;
  border: 1px solid transparent !important;
  border-bottom: none !important;
  color: #475569 !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
}
.the-trang-item:hover {
  background: #ffffff !important;
  color: #0f172a !important;
}
/* Thẻ active */
.the-trang-item.dang-chon,
.the-trang-item.active,
html body #hang-the-trang-doc .the-trang-item.dang-chon {
  background: var(--card-bg, #ffffff) !important;
  border: 1px solid #0284c7 !important;
  color: var(--ink, #0f172a) !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 6px rgba(2, 132, 199, 0.25) !important;
  z-index: 3 !important;
}
.the-trang-item .the-trang-dong-btn,
.the-trang-item button[aria-label*="Đóng"],
.the-trang-item button.the-trang-btn-action {
  width: 18px !important;
  height: 18px !important;
  border-radius: 50% !important;
  border: none !important;
  background: transparent !important;
  color: #94a3b8 !important;
  font-size: 11px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.the-trang-item .the-trang-dong-btn:hover {
  background: #fee2e2 !important;
  color: #ef4444 !important;
}

/* 4. THANH CHẾ ĐỘ XEM & ĐỘ SÂU TIN NHẮN (#thanh-che-do-xem) */
#thanh-che-do-xem,
html body #thanh-che-do-xem {
  display: flex !important;
  background: var(--paper, #f8fafc) !important;
  border-bottom: 1px solid var(--line, #e2e8f0) !important;
  padding: 3px 10px !important;
  min-height: 36px !important;
  height: 36px !important;
  max-height: 36px !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
}
#btn-xem-lai-so {
  border-radius: 6px !important;
  border: 1px solid #cbd5e1 !important;
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 5px 12px !important;
  transition: all 0.15s ease !important;
}
#btn-xem-lai-so:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}
#btn-chuyen-buc-tranh-3-tang {
  border-radius: 6px !important;
  border: 1px solid #0284c7 !important;
  background: #e0f2fe !important;
  color: #0369a1 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 5px 12px !important;
  transition: all 0.15s ease !important;
}
#btn-chuyen-buc-tranh-3-tang:hover {
  background: #bae6fd !important;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25) !important;
}
/* Nhóm 3 nút độ sâu: Tóm tắt · Bản thô · Đầy đủ */
.bo-chuyen-tang-tin {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.nut-tang-tin {
  min-height: 32px !important;
  padding: 4px 12px !important;
  border-radius: 6px !important;
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  transition: all 0.15s ease !important;
}
.nut-tang-tin:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
.nut-tang-tin.tang-active {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 6px rgba(2, 132, 199, 0.35) !important;
}

/* 5. KHUNG TERMINAL & KHÔNG GIAN HỘI THOẠI (#man-hinh-terminal) */
#man-hinh-terminal,
.man-hinh-terminal-that {
  background: #0b0f19 !important;
  border-radius: 0 0 10px 10px !important;
  position: relative !important;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* Huy hiệu telemetry trạng thái kết nối terminal */
#nhan-trang-thai-ket-noi-terminal {
  position: absolute !important;
  top: 10px !important;
  right: 14px !important;
  z-index: 10 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 5px 12px !important;
  border-radius: 999px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  background: rgba(10, 132, 255, 0.12) !important;
  border: 1px solid rgba(10, 132, 255, 0.4) !important;
  color: #0a84ff !important;
  box-shadow: 0 2px 12px rgba(10, 132, 255, 0.25) !important;
  transition: all 0.25s ease !important;
}

#nhan-trang-thai-ket-noi-terminal[data-state="da-xac-nhan"],
#nhan-trang-thai-ket-noi-terminal.da-xac-nhan {
  background: rgba(34, 197, 94, 0.15) !important;
  border: 1px solid rgba(34, 197, 94, 0.45) !important;
  color: #16a34a !important;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.2) !important;
}

#nhan-trang-thai-ket-noi-terminal[data-state="that-bai"],
#nhan-trang-thai-ket-noi-terminal.that-bai {
  background: rgba(245, 158, 11, 0.15) !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  color: #d97706 !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15) !important;
}

/* Màn hình chào mừng / kết nối / lỗi terminal (#khung-terminal-loi) */
#khung-terminal-loi {
  background: radial-gradient(circle at 50% 30%, #172033 0%, #090d16 100%) !important;
  color: #e2e8f0 !important;
  display: flex;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 36px 20px !important;
  box-sizing: border-box !important;
  text-align: center !important;
}
html body #man-hinh-terminal.terminal-hien-ban-tho #khung-terminal-loi,
html body #man-hinh-terminal.terminal-hien-ban-tho .khung-terminal-loi {
  display: none !important;
}
.icon-loi-term {
  font-size: 42px !important;
  margin-bottom: 12px !important;
  filter: drop-shadow(0 0 16px rgba(56, 189, 248, 0.4)) !important;
}
.tieu-de-loi-term {
  color: #f8fafc !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  margin-bottom: 8px !important;
  letter-spacing: -0.01em !important;
}
.mo-ta-loi-term {
  color: #94a3b8 !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
  max-width: 480px !important;
  margin-bottom: 20px !important;
}
.btn-thu-lai-term {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 9px 22px !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  cursor: pointer !important;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4) !important;
  transition: all 0.18s ease !important;
}
.btn-thu-lai-term:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.55) !important;
}

/* Dòng nhật ký và lệnh terminal trong #danh-sach-dong-terminal */
#danh-sach-dong-terminal {
  background: #090d16 !important;
  color: #e2e8f0 !important;
  padding: 12px 16px !important;
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
}
.dong-terminal {
  padding: 4px 8px !important;
  border-radius: 4px !important;
  transition: background 0.12s ease !important;
}
.dong-terminal:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}
.dong-terminal.dong-nguoi-go {
  color: #38bdf8 !important;
  font-weight: 600 !important;
  background: rgba(56, 189, 248, 0.08) !important;
  border-left: 3px solid #38bdf8 !important;
}
.dong-terminal.dong-canh-bao {
  color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.08) !important;
  border-left: 3px solid #f59e0b !important;
}
.dong-terminal.dong-loi {
  color: #f87171 !important;
  background: rgba(239, 68, 68, 0.08) !important;
  border-left: 3px solid #ef4444 !important;
}

/* 6. BẢNG ĐIỀU KHIỂN & Ô NHẬP TERMINAL / CHAT DƯỚI ĐÁY (#khung-nhap-tin-cuoc) */
#khung-nhap-tin-cuoc,
.khung-nhap-tin {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 14px !important;
  padding: 10px 14px !important;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04) !important;
  box-sizing: border-box !important;
  position: relative !important;
}

/* Thanh chip lệnh nhanh: Pill buttons */
.thanh-chip-lenh-nhanh {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-bottom: 8px !important;
}
.chip-lenh-nhanh {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 999px !important;
  padding: 4px 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #475569 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}
.chip-lenh-nhanh:hover {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15) !important;
}

/* Hàng 1: Gõ thẳng vào terminal */
.hang-nhap-terminal-truc-tiep {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: #090d16 !important;
  border: 1px solid #1e293b !important;
  border-radius: 8px !important;
  padding: 4px 8px !important;
  margin-bottom: 8px !important;
}
.nhan-hang-nhap-term {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  color: #38bdf8 !important;
  font-family: "SF Mono", Menlo, monospace !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  flex-shrink: 0 !important;
}
.o-nhap-terminal-truc-tiep {
  flex: 1 1 auto !important;
  background: transparent !important;
  border: none !important;
  color: #f8fafc !important;
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace !important;
  font-size: 13px !important;
  padding: 4px 6px !important;
  outline: none !important;
}
.o-nhap-terminal-truc-tiep::placeholder {
  color: #64748b !important;
  font-size: 12px !important;
}
.btn-go-thang {
  border-radius: 6px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  padding: 4px 10px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  flex-shrink: 0 !important;
}
.btn-go-thang.dang-bat {
  background: rgba(56, 189, 248, 0.16) !important;
  border: 1px solid rgba(56, 189, 248, 0.45) !important;
  color: #38bdf8 !important;
}

/* Hàng 2: Ô nhập tuỳ biến / lời dặn / voice */
.hang-nhap-tuy-bien-cuoc {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}
.nhan-hang-nhap-tuy-bien {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
}
.o-nhap-tin-cuoc {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  color: #0f172a !important;
  resize: none !important;
  min-height: 48px !important;
  line-height: 1.45 !important;
  transition: all 0.16s ease !important;
}
.o-nhap-tin-cuoc:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
  outline: none !important;
}

/* Thanh hành động nhập: Nói · Dừng · Hủy · Gửi */
.thanh-hanh-dong-nhap {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}
#btn-mic-giong-noi {
  border-radius: 8px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  padding: 6px 12px !important;
  min-height: 38px !important;
  transition: all 0.15s ease !important;
}
#btn-mic-giong-noi:hover {
  background: #e2e8f0 !important;
}
#btn-ctrl-c {
  border-radius: 8px !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #dc2626 !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  padding: 6px 12px !important;
  min-height: 38px !important;
  transition: all 0.15s ease !important;
}
#btn-ctrl-c:hover {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
}
#btn-huy-giao-viec {
  border-radius: 8px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #64748b !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  padding: 6px 12px !important;
  min-height: 38px !important;
  transition: all 0.15s ease !important;
}
#btn-huy-giao-viec:hover {
  background: #f8fafc !important;
  color: #334155 !important;
}
#btn-gui-tin-nhan {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  padding: 8px 20px !important;
  min-height: 38px !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
  cursor: pointer !important;
  transition: all 0.18s ease !important;
}
#btn-gui-tin-nhan:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5) !important;
}

/* 7. KỆ PHẢI & DRAWER CHI TIẾT 3 TẦNG (#ke-phai-container, #drawer-chi-tiet-du-phong) */
.ke-phai-container,
#ke-phai-container,
#drawer-chi-tiet-du-phong {
  background: #ffffff !important;
  border-left: 1px solid #e2e8f0 !important;
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.08) !important;
}
.ke-phai-header,
.drawer-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 12px 16px !important;
}

/* 8. TINH CHỈNH CHI TIẾT THẺ GHẾ & KHUNG NHẬP */
html body .tabs-gom-nhom .tab-gom {
  border: none !important;
}
html body .tabs-gom-nhom .tab-gom.dang-chon {
  border: none !important;
  background: #ffffff !important;
  color: #0284c7 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12) !important;
}

/* Khắc phục nút trạng thái cam bị bung to thành khối 44px bằng bộ chọn 3 ID triệt tiêu [onclick] */
html body #dos-v12-shell #buong-hoi-thoai-chinh #danh-sach-the-cuoc .the-cuoc button.btn-trang-thai,
html body #dos-v12-shell #buong-hoi-thoai-chinh #danh-sach-the-cuoc .the-cuoc .cham-trang-thai-dot.btn-trang-thai,
html body .the-cuoc button[onclick].btn-trang-thai,
html body .the-cuoc .btn-trang-thai {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  min-height: 12px !important;
  max-width: 12px !important;
  max-height: 12px !important;
  border-radius: 50% !important;
  border: 2px solid #ffffff !important;
  padding: 0 !important;
  margin: 0 4px !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) !important;
  flex: 0 0 12px !important;
}

html body #dos-v12-shell #buong-hoi-thoai-chinh #danh-sach-the-cuoc .the-cuoc button.the-cuoc-actions-menu-btn,
html body .the-cuoc button[onclick].the-cuoc-actions-menu-btn,
html body .the-cuoc .the-cuoc-actions-menu-btn {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  border-radius: 6px !important;
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #64748b !important;
  font-size: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  touch-action: manipulation !important;
}

html body #dos-v12-shell #buong-hoi-thoai-chinh #danh-sach-the-cuoc .the-cuoc button.btn-avatar-ghe,
html body .the-cuoc button.btn-avatar-ghe {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  touch-action: manipulation !important;
}

/* Bố cục hàng chính trong thẻ ghế */
html body .the-cuoc .the-cuoc-hang-chinh {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  width: 100% !important;
}
html body .the-cuoc .the-cuoc-ten-cot {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  overflow: hidden !important;
}
html body .the-cuoc .the-cuoc-ten-dong-1 {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  width: 100% !important;
  gap: 3px !important;
}
html body .the-cuoc .the-cuoc-ten-chu {
  flex: 1 1 auto !important;
  min-width: 80px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--ink, var(--text, #0f172a)) !important;
  display: block !important;
}
html body .the-cuoc .chip-cach-vao {
  display: none !important;
}
html body .the-cuoc .the-trang-role-badge {
  flex-shrink: 0 !important;
  font-size: 9.5px !important;
  padding: 1px 4px !important;
}
html body .the-cuoc .the-cuoc-duoi {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex: 0 0 auto !important;
  width: auto !important;
}
html body .the-cuoc .the-cuoc-actions-menu-btn {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  border-radius: 6px !important;
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #64748b !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  touch-action: manipulation !important;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
html body .the-cuoc:hover .the-cuoc-actions-menu-btn {
  opacity: 1;
}
html body .the-cuoc .the-cuoc-drag-handle {
  display: none !important;
}
html body .the-cuoc .du-an-the-dieu-khien {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-top: 6px !important;
  padding-top: 6px !important;
  border-top: 1px solid #f1f5f9 !important;
  width: 100% !important;
  height: auto !important;
}
html body .the-cuoc .du-an-the-du-an {
  padding: 3px 8px !important;
  height: 26px !important;
  min-height: 26px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  color: #475569 !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  width: auto !important;
}
html body .the-cuoc .du-an-the-them {
  padding: 3px 8px !important;
  height: 26px !important;
  min-height: 26px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #0284c7 !important;
  background: #f0f9ff !important;
  border: 1px dashed #bae6fd !important;
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
}

/* Khung nhập đáy: Apple Liquid Glass Dock cố định đáy với env(safe-area-inset-bottom) */
html body #khung-nhap-tin-cuoc.khung-nhap-tin,
html body #khung-nhap-tin-cuoc,
#khung-nhap-tin-cuoc {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  height: auto !important;
  min-height: 56px !important;
  max-height: none !important;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 12px)) 8px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-top: 1px solid rgba(203, 213, 225, 0.8) !important;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08) !important;
  z-index: 1000 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

/* Ẩn các hàng thừa hoặc nút trôi nổi đè lên trên dock */
#khung-nhap-tin-cuoc #hang-nhap-terminal-truc-tiep,
#khung-nhap-tin-cuoc .hang-nhap-terminal-truc-tiep,
#khung-nhap-tin-cuoc #btn-go-thang,
#khung-nhap-tin-cuoc #thanh-phim-terminal-nhanh,
#khung-nhap-tin-cuoc #thanh-chip-lenh-nhanh,
#khung-nhap-tin-cuoc .nhan-hang-nhap-tuy-bien,
#khung-nhap-tin-cuoc .thong-tin-ban-nhap,
#khung-nhap-tin-cuoc #hang-phim-phu-mobile {
  display: none !important;
}

html body #khung-nhap-tin-cuoc #hang-nhap-tuy-bien-cuoc,
#hang-nhap-tuy-bien-cuoc {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  width: 100% !important;
  height: auto !important;
  min-height: 44px !important;
  gap: 5px !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
#nhap-tin-hoi-thoai {
  flex: 1 1 auto !important;
  min-width: 80px !important;
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 100px !important;
  padding: 10px 14px !important;
  font-size: 13.5px !important;
  line-height: 22px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 22px !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  box-sizing: border-box !important;
  resize: none !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
}
html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai:focus {
  border-color: #0284c7 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}
html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai::placeholder,
#nhap-tin-hoi-thoai::placeholder {
  color: #94a3b8 !important;
  font-size: 12.5px !important;
  line-height: 22px !important;
}

html body #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap {
  height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  flex: 0 0 auto !important;
}

html body #khung-nhap-tin-cuoc .cong-cu-nhap-nhom {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
}

html body #khung-nhap-tin-cuoc .btn-cong-cu,
html body #khung-nhap-tin-cuoc #btn-mic-giong-noi,
html body #khung-nhap-tin-cuoc #btn-ctrl-c {
  width: 36px !important;
  min-width: 36px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 15px !important;
  border-radius: 12px !important;
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #475569 !important;
  touch-action: manipulation !important;
}

html body #khung-nhap-tin-cuoc .btn-cong-cu .btn-nhan-chu,
html body #khung-nhap-tin-cuoc #btn-mic-giong-noi .btn-nhan-chu,
html body #khung-nhap-tin-cuoc #btn-ctrl-c .btn-nhan-chu {
  display: none !important;
}

html body #khung-nhap-tin-cuoc .nut-gui-nhom {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
}

html body #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 8px !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  border-radius: 12px !important;
}

html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan {
  height: 44px !important;
  min-height: 44px !important;
  min-width: 52px !important;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 22px !important;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
  touch-action: manipulation !important;
}

@media (max-width: 639px) {
  .banner-chuyen-terminal-tuong-tac {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    padding: 8px 12px !important;
  }
}

/* Đảm bảo nội dung tin nhắn không bị dock che khuất */
html body #khung-tin-nhan,
#khung-tin-nhan {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 12px)) !important;
}

/* Theme dark / obsidian / cyber / space cho Dock kính */
[data-theme="dark"] #khung-nhap-tin-cuoc,
[data-theme="obsidian"] #khung-nhap-tin-cuoc,
[data-theme="cyber"] #khung-nhap-tin-cuoc,
[data-theme="space"] #khung-nhap-tin-cuoc,
.theme-dark #khung-nhap-tin-cuoc {
  background: rgba(15, 23, 42, 0.94) !important;
  border-top: 1px solid rgba(51, 65, 85, 0.8) !important;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.4) !important;
}
[data-theme="dark"] #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
[data-theme="obsidian"] #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
[data-theme="cyber"] #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
[data-theme="space"] #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
.theme-dark #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai {
  background: rgba(30, 41, 59, 0.8) !important;
  border-color: rgba(71, 85, 105, 0.8) !important;
  color: #f8fafc !important;
}
[data-theme="dark"] #khung-nhap-tin-cuoc .btn-cong-cu,
[data-theme="obsidian"] #khung-nhap-tin-cuoc .btn-cong-cu,
[data-theme="cyber"] #khung-nhap-tin-cuoc .btn-cong-cu,
[data-theme="space"] #khung-nhap-tin-cuoc .btn-cong-cu,
.theme-dark #khung-nhap-tin-cuoc .btn-cong-cu {
  background: rgba(30, 41, 59, 0.8) !important;
  border-color: rgba(71, 85, 105, 0.8) !important;
  color: #cbd5e1 !important;
}

/* Vị trí tinh tế cho kim xăng AI trên thanh đỉnh */
#kim-xang-root,
.kim-xang-wrap,
html body #kim-xang-root {
  position: fixed !important;
  top: 8px !important;
  bottom: auto !important;
  left: auto !important;
  right: 230px !important;
  z-index: 20 !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
}

/* ==========================================================================
   TỐI ƯU MÀN HÌNH GẬP (SAMSUNG GALAXY Z FOLD) & CHUẨN ĐIỂM CHẠM >= 44PX (KV-044)
   - Màn ngoài: 320px - 400px (thanh thẻ cuộn mượt, ô nhập co giãn thông minh, không tràn ngang)
   - Màn trong: 800px - 900px (bố cục cân xứng, cuộn mượt mà, nội dung thoáng đãng)
   - Toàn bộ nút bấm & vùng chạm tương tác tối thiểu 44px
   - Cuộn mượt mà -webkit-overflow-scrolling: touch, chống giật khựng
   ========================================================================== */

/* 1. Chống tràn ngang và cuộn cảm ứng mượt mà toàn diện */
html, body, #app, .app-shell, #khung-chinh, #khung-hoi-thoai-grid {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  -webkit-overflow-scrolling: touch !important;
  scroll-behavior: smooth !important;
}

/* Khoảng thở đáy để khung nhập cố định 64px không che tin nhắn cuối */
#khung-tin-nhan,
.khung-tin-nhan,
#khung-hoi-thoai,
.khung-hoi-thoai {
  padding-bottom: 96px !important;
  -webkit-overflow-scrolling: touch !important;
  scroll-behavior: smooth !important;
}

/* 2. CHUẨN ĐIỂM CHẠM >= 44PX TOÀN BỘ NÚT BẤM (FITTS LAW) */

/* Nút quay về thế giới trên thanh đỉnh */
#btn-ve-the-gioi-top,
html body #btn-ve-the-gioi-top,
.btn-ve-the-gioi-top {
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: manipulation !important;
}

/* ==========================================================================
   WO-CLEAN-TOPBAR-TABS-AND-UNIFIED-THEMES (APPLE HIG CLEAN TOPBAR & TABS)
   ========================================================================== */
.thanh-dau-doc-cuoc,
#thanh-dau-doc-cuoc,
html body #thanh-dau-doc-cuoc,
html body .thanh-dau-doc-cuoc {
  min-height: 44px !important;
  height: 44px !important;
  max-height: 44px !important;
  padding: 0 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
  background: var(--paper, #f8fafc) !important;
  border-bottom: 1px solid var(--line, #e2e8f0) !important;
  transition: background 0.2s ease, border-color 0.2s ease !important;
}

/* Apple Capsule Control Strip */
.thanh-dau-phai,
#thanh-dau-doc-cuoc .thanh-dau-phai {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  box-sizing: border-box !important;
}

#btn-topbar-theme,
#btn-thao-tac-nhanh-topbar,
#btn-menu-thanh-dau-them,
#btn-mo-drawer-chi-tiet {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 17px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  background: rgba(2, 132, 199, 0.08) !important;
  border: 1px solid rgba(2, 132, 199, 0.25) !important;
  color: #0284c7 !important;
  transition: all 0.15s ease !important;
}

#btn-topbar-theme:hover,
#btn-thao-tac-nhanh-topbar:hover,
#btn-menu-thanh-dau-them:hover,
#btn-mo-drawer-chi-tiet:hover {
  background: rgba(2, 132, 199, 0.18) !important;
  border-color: #0284c7 !important;
  transform: translateY(-1px) !important;
}

#btn-mo-ke-phai {
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 17px !important;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 13px !important;
  box-sizing: border-box !important;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
}

#badge-ke-phai-top {
  background: #ffffff !important;
  color: #0284c7 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  min-width: 16px !important;
  height: 16px !important;
  padding: 0 4px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

@media (max-width: 768px) {
  .nut-an-tren-mobile {
    display: none !important;
  }
}

/* Session Tabs (#hang-the-trang-doc) */
#hang-the-trang-doc,
.hang-the-trang-doc,
html body #hang-the-trang-doc {
  min-height: 36px !important;
  height: 36px !important;
  max-height: 36px !important;
  padding: 3px 8px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  flex-wrap: nowrap !important;
  box-sizing: border-box !important;
  background: var(--paper, #f1f5f9) !important;
  border-bottom: 1px solid var(--line, #cbd5e1) !important;
}
#hang-the-trang-doc::-webkit-scrollbar {
  display: none !important;
}

.the-trang-item,
html body #hang-the-trang-doc .the-trang-item,
html body .the-trang-item {
  min-height: 30px !important;
  height: 30px !important;
  max-height: 30px !important;
  border-radius: 15px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 2px 10px !important;
  gap: 5px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  touch-action: manipulation !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  background: rgba(226, 232, 240, 0.7) !important;
  border: 1px solid rgba(203, 213, 225, 0.8) !important;
  color: #475569 !important;
  transition: all 0.15s ease !important;
}
.the-trang-item:hover {
  background: #ffffff !important;
  color: #0f172a !important;
}
.the-trang-item.dang-chon,
.the-trang-item.active {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 6px rgba(2, 132, 199, 0.3) !important;
}

.the-trang-item .cham-trang-thai-dot {
  width: 6px !important;
  height: 6px !important;
  min-width: 6px !important;
  min-height: 6px !important;
  border-radius: 50% !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

.the-trang-item .the-trang-btn-action,
.the-trang-item .the-trang-dong-btn {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  border-radius: 50% !important;
  font-size: 10px !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  padding: 0 !important;
  line-height: 1 !important;
  opacity: 0.65 !important;
  transition: all 0.15s ease !important;
}
.the-trang-item .the-trang-btn-action:hover,
.the-trang-item .the-trang-dong-btn:hover {
  opacity: 1 !important;
  transform: scale(1.15) !important;
}

/* Mode Switcher (#thanh-che-do-xem) */
#thanh-che-do-xem,
html body #thanh-che-do-xem,
.thanh-che-do-xem {
  min-height: 36px !important;
  height: 36px !important;
  max-height: 36px !important;
  padding: 2px 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
  background: var(--paper, #f8fafc) !important;
  border-bottom: 1px solid var(--line, #e2e8f0) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: var(--z-day-tabs, 12) !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
}

.segmented-control-bar,
.bo-chuyen-tang-tin.segmented-control-bar,
html body #thanh-che-do-xem .segmented-control-bar {
  display: inline-flex !important;
  align-items: center !important;
  padding: 2px !important;
  border-radius: 16px !important;
  background: rgba(0, 0, 0, 0.06) !important;
  gap: 2px !important;
  box-sizing: border-box !important;
}

.nut-tang-tin,
html body .nut-tang-tin,
html body #thanh-che-do-xem .nut-tang-tin,
html body #thanh-che-do-xem .segmented-control-bar button {
  min-height: 28px !important;
  height: 28px !important;
  max-height: 28px !important;
  padding: 0 10px !important;
  border-radius: 14px !important;
  border: none !important;
  background: transparent !important;
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
  box-shadow: none !important;
}
.nut-tang-tin:hover,
html body #thanh-che-do-xem .segmented-control-bar button:hover {
  color: #0f172a !important;
  background: rgba(0, 0, 0, 0.04) !important;
}
.nut-tang-tin.tang-active,
html body .nut-tang-tin.tang-active,
html body #thanh-che-do-xem .nut-tang-tin.tang-active,
html body #thanh-che-do-xem .segmented-control-bar button.tang-active,
html body #thanh-che-do-xem .segmented-control-bar button.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.35) !important;
}

.thanh-che-do-phu {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}
.btn-che-do-phu-item,
html body #btn-xem-lai-so,
html body #btn-chuyen-buc-tranh-3-tang,
html body #thanh-che-do-xem .btn-che-do-phu-item,
html body #thanh-che-do-xem #btn-xem-lai-so,
html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(203, 213, 225, 0.6) !important;
  background: transparent !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  transition: all 0.15s ease !important;
  color: #475569 !important;
  box-shadow: none !important;
}
.btn-che-do-phu-item:hover,
html body #btn-xem-lai-so:hover,
html body #btn-chuyen-buc-tranh-3-tang:hover {
  background: rgba(2, 132, 199, 0.1) !important;
  border-color: #0284c7 !important;
  transform: translateY(-1px) !important;
}

/* ==========================================================================
   UNIFIED THEME SYSTEM FOR TOPBAR, TABS, SWITCHER (DARK / OBSIDIAN / CYBER / SPACE)
   ========================================================================== */
[data-theme="dark"] #thanh-dau-doc-cuoc,
[data-theme="dark"] #hang-the-trang-doc,
[data-theme="dark"] #thanh-che-do-xem,
[data-theme="obsidian"] #thanh-dau-doc-cuoc,
[data-theme="obsidian"] #hang-the-trang-doc,
[data-theme="obsidian"] #thanh-che-do-xem,
[data-theme="cyber"] #thanh-dau-doc-cuoc,
[data-theme="cyber"] #hang-the-trang-doc,
[data-theme="cyber"] #thanh-che-do-xem,
[data-theme="space"] #thanh-dau-doc-cuoc,
[data-theme="space"] #hang-the-trang-doc,
[data-theme="space"] #thanh-che-do-xem,
.theme-dark #thanh-dau-doc-cuoc,
.theme-dark #hang-the-trang-doc,
.theme-dark #thanh-che-do-xem,
.theme-obsidian #thanh-dau-doc-cuoc,
.theme-obsidian #hang-the-trang-doc,
.theme-obsidian #thanh-che-do-xem,
.theme-cyber #thanh-dau-doc-cuoc,
.theme-cyber #hang-the-trang-doc,
.theme-cyber #thanh-che-do-xem,
.theme-space #thanh-dau-doc-cuoc,
.theme-space #hang-the-trang-doc,
.theme-space #thanh-che-do-xem {
  background: rgba(15, 23, 42, 0.94) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.6) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .the-trang-item,
[data-theme="obsidian"] .the-trang-item,
[data-theme="cyber"] .the-trang-item,
[data-theme="space"] .the-trang-item,
.theme-dark .the-trang-item,
.theme-obsidian .the-trang-item,
.theme-cyber .the-trang-item,
.theme-space .the-trang-item {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(71, 85, 105, 0.6) !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .the-trang-item:hover,
[data-theme="obsidian"] .the-trang-item:hover,
[data-theme="cyber"] .the-trang-item:hover,
[data-theme="space"] .the-trang-item:hover,
.theme-dark .the-trang-item:hover,
.theme-obsidian .the-trang-item:hover,
.theme-cyber .the-trang-item:hover,
.theme-space .the-trang-item:hover {
  background: rgba(51, 65, 85, 0.9) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .the-trang-item.dang-chon,
[data-theme="dark"] .the-trang-item.active,
[data-theme="obsidian"] .the-trang-item.dang-chon,
[data-theme="obsidian"] .the-trang-item.active,
[data-theme="cyber"] .the-trang-item.dang-chon,
[data-theme="cyber"] .the-trang-item.active,
[data-theme="space"] .the-trang-item.dang-chon,
[data-theme="space"] .the-trang-item.active,
.theme-dark .the-trang-item.dang-chon,
.theme-dark .the-trang-item.active,
.theme-obsidian .the-trang-item.dang-chon,
.theme-obsidian .the-trang-item.active,
.theme-cyber .the-trang-item.dang-chon,
.theme-cyber .the-trang-item.active,
.theme-space .the-trang-item.dang-chon,
.theme-space .the-trang-item.active {
  background: rgba(2, 132, 199, 0.35) !important;
  border-color: #0284c7 !important;
  color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.3) !important;
}

[data-theme="dark"] .segmented-control-bar,
[data-theme="obsidian"] .segmented-control-bar,
[data-theme="cyber"] .segmented-control-bar,
[data-theme="space"] .segmented-control-bar,
.theme-dark .segmented-control-bar,
.theme-obsidian .segmented-control-bar,
.theme-cyber .segmented-control-bar,
.theme-space .segmented-control-bar {
  background: rgba(30, 41, 59, 0.8) !important;
  border: 1px solid rgba(51, 65, 85, 0.6) !important;
}
[data-theme="dark"] .nut-tang-tin,
[data-theme="obsidian"] .nut-tang-tin,
[data-theme="cyber"] .nut-tang-tin,
[data-theme="space"] .nut-tang-tin,
.theme-dark .nut-tang-tin,
.theme-obsidian .nut-tang-tin,
.theme-cyber .nut-tang-tin,
.theme-space .nut-tang-tin {
  color: #94a3b8 !important;
}
[data-theme="dark"] .nut-tang-tin:hover,
[data-theme="obsidian"] .nut-tang-tin:hover,
[data-theme="cyber"] .nut-tang-tin:hover,
[data-theme="space"] .nut-tang-tin:hover,
.theme-dark .nut-tang-tin:hover,
.theme-obsidian .nut-tang-tin:hover,
.theme-cyber .nut-tang-tin:hover,
.theme-space .nut-tang-tin:hover {
  color: #f8fafc !important;
  background: rgba(255, 255, 255, 0.06) !important;
}
[data-theme="dark"] .nut-tang-tin.tang-active,
[data-theme="obsidian"] .nut-tang-tin.tang-active,
[data-theme="cyber"] .nut-tang-tin.tang-active,
[data-theme="space"] .nut-tang-tin.tang-active,
.theme-dark .nut-tang-tin.tang-active,
.theme-obsidian .nut-tang-tin.tang-active,
.theme-cyber .nut-tang-tin.tang-active,
.theme-space .nut-tang-tin.tang-active {
  background: #0284c7 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .btn-che-do-phu-item,
[data-theme="obsidian"] .btn-che-do-phu-item,
[data-theme="cyber"] .btn-che-do-phu-item,
[data-theme="space"] .btn-che-do-phu-item,
.theme-dark .btn-che-do-phu-item,
.theme-obsidian .btn-che-do-phu-item,
.theme-cyber .btn-che-do-phu-item,
.theme-space .btn-che-do-phu-item,
[data-theme="dark"] html body #thanh-che-do-xem #btn-xem-lai-so,
[data-theme="obsidian"] html body #thanh-che-do-xem #btn-xem-lai-so,
[data-theme="cyber"] html body #thanh-che-do-xem #btn-xem-lai-so,
[data-theme="space"] html body #thanh-che-do-xem #btn-xem-lai-so,
.theme-dark html body #thanh-che-do-xem #btn-xem-lai-so,
.theme-obsidian html body #thanh-che-do-xem #btn-xem-lai-so,
.theme-cyber html body #thanh-che-do-xem #btn-xem-lai-so,
.theme-space html body #thanh-che-do-xem #btn-xem-lai-so,
[data-theme="dark"] html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang,
[data-theme="obsidian"] html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang,
[data-theme="cyber"] html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang,
[data-theme="space"] html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang,
.theme-dark html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang,
.theme-obsidian html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang,
.theme-cyber html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang,
.theme-space html body #thanh-che-do-xem #btn-chuyen-buc-tranh-3-tang {
  border-color: rgba(71, 85, 105, 0.6) !important;
  color: #cbd5e1 !important;
  background: rgba(30, 41, 59, 0.5) !important;
}

[data-theme="dark"] #btn-topbar-theme,
[data-theme="dark"] #btn-thao-tac-nhanh-topbar,
[data-theme="dark"] #btn-menu-thanh-dau-them,
[data-theme="obsidian"] #btn-topbar-theme,
[data-theme="obsidian"] #btn-thao-tac-nhanh-topbar,
[data-theme="obsidian"] #btn-menu-thanh-dau-them,
[data-theme="cyber"] #btn-topbar-theme,
[data-theme="cyber"] #btn-thao-tac-nhanh-topbar,
[data-theme="cyber"] #btn-menu-thanh-dau-them,
[data-theme="space"] #btn-topbar-theme,
[data-theme="space"] #btn-thao-tac-nhanh-topbar,
[data-theme="space"] #btn-menu-thanh-dau-them,
.theme-dark #btn-topbar-theme,
.theme-dark #btn-thao-tac-nhanh-topbar,
.theme-dark #btn-menu-thanh-dau-them,
.theme-obsidian #btn-topbar-theme,
.theme-obsidian #btn-thao-tac-nhanh-topbar,
.theme-obsidian #btn-menu-thanh-dau-them,
.theme-cyber #btn-topbar-theme,
.theme-cyber #btn-thao-tac-nhanh-topbar,
.theme-cyber #btn-menu-thanh-dau-them,
.theme-space #btn-topbar-theme,
.theme-space #btn-thao-tac-nhanh-topbar,
.theme-space #btn-menu-thanh-dau-them {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(71, 85, 105, 0.6) !important;
  color: #38bdf8 !important;
}

/* Nút đóng tab (the-trang-dong-btn) - Giữ kích thước hiển thị gọn gàng nhưng mở rộng hit-target chạm 44px qua ::after */
.the-trang-dong-btn {
  position: relative !important;
  touch-action: manipulation !important;
}
.the-trang-dong-btn::after {
  content: '' !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  pointer-events: auto !important;
}

/* Nút thêm thẻ tab mới */
.btn-them-the-trang,
html body #hang-the-trang-doc .btn-them-the-trang,
html body .btn-them-the-trang {
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: manipulation !important;
}

/* Khung nhập tin đáy và toàn bộ công cụ */
html body #khung-nhap-tin-cuoc.khung-nhap-tin,
html body #khung-nhap-tin-cuoc,
#khung-nhap-tin-cuoc {
  min-height: 56px !important;
  height: auto !important;
  max-height: none !important;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 12px)) 10px !important;
}

/* Ô nhập chữ */
html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
#nhap-tin-hoi-thoai {
  min-height: 44px !important;
  height: 44px !important;
  line-height: 24px !important;
}

/* Nút gửi tin */
html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan,
#btn-gui-tin-nhan {
  min-height: 42px !important;
  min-width: 48px !important;
  height: 42px !important;
  padding: 0 8px !important;
  touch-action: manipulation !important;
}

/* Nút công cụ, mic, ctrl-c, hủy */
html body #khung-nhap-tin-cuoc .btn-cong-cu,
html body #khung-nhap-tin-cuoc #btn-dinh-kem-anh,
html body #khung-nhap-tin-cuoc #btn-mic-giong-noi,
html body #khung-nhap-tin-cuoc #btn-ctrl-c,
html body #khung-nhap-tin-cuoc .nut-gui-nhom #btn-huy-giao-viec {
  min-height: 42px !important;
  height: 42px !important;
  min-width: 34px !important;
  width: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: manipulation !important;
}

/* Nút menu hành động và avatar trong danh sách */
html body #dos-v12-shell #buong-hoi-thoai-chinh #danh-sach-the-cuoc .the-cuoc button.btn-avatar-ghe,
html body .the-cuoc button.btn-avatar-ghe,
html body .the-cuoc .btn-avatar-ghe,
.the-cuoc-hang-chinh .btn-avatar-ghe,
.btn-avatar-ghe {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: manipulation !important;
}

html body .the-cuoc .the-cuoc-actions-menu-btn,
.the-cuoc-actions-menu-btn {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  touch-action: manipulation !important;
}
.the-cuoc-ten-chu, .the-cuoc-ten-wrap {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

/* Chấm trạng thái cam/xanh: giữ chấm đèn LED 12px thanh thoát, mở rộng hit-target 44px */
html body .the-cuoc .cham-trang-thai-dot.btn-trang-thai,
.cham-trang-thai-dot.btn-trang-thai {
  position: relative !important;
  touch-action: manipulation !important;
}
html body .the-cuoc .cham-trang-thai-dot.btn-trang-thai::after,
.cham-trang-thai-dot.btn-trang-thai::after {
  content: '' !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  pointer-events: auto !important;
}

/* 3. ĐÁP ỨNG ĐẶC THÙ CHO SAMSUNG GALAXY Z FOLD MÀN NGOÀI (320px - 400px) */
@media (max-width: 420px) {
  /* Thanh đỉnh: cuộn ngang mượt mà, không dồn ép, không đè chồng */
  html body #thanh-dau-doc-cuoc,
  html body .thanh-dau-doc-cuoc {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 0 8px !important;
  }
  html body #thanh-dau-doc-cuoc::-webkit-scrollbar,
  html body .thanh-dau-doc-cuoc::-webkit-scrollbar {
    display: none !important;
  }

  .thanh-dau-trai {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  html body #thanh-dau-doc-cuoc .thanh-dau-phai,
  html body .thanh-dau-phai,
  .thanh-dau-phai {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
    max-width: 140px !important;
    height: 100% !important;
    align-items: center !important;
    gap: 4px !important;
  }

  @media (max-width: 360px) {
    .thanh-dau-trai {
      max-width: 185px !important;
      overflow: hidden !important;
    }
    .thanh-dau-phai #btn-mo-ke-phai {
      display: none !important;
    }
    .thanh-dau-phai #wrap-menu-thanh-dau-them {
      display: none !important;
    }
  }

  .thanh-dau-phai > * {
    flex-shrink: 0 !important;
  }

  /* Gom các nút phụ vào menu ... nhưng GIỮ RÕ nút Kệ Phải, Theme và Chi tiết */
  .thanh-dau-phai #btn-thao-tac-nhanh-topbar,
  .thanh-dau-phai .btn-dieu-huong-ghe:not(#btn-mo-drawer-chi-tiet):not(#btn-mo-ke-phai):not(#btn-topbar-theme):not(#btn-menu-thanh-dau-them):not(#wrap-menu-thanh-dau-them):not(#wrap-theme-du-phong) {
    display: none !important;
  }

  .thanh-dau-phai #btn-mo-ke-phai {
    display: inline-flex !important;
    min-width: 38px !important;
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    font-size: 15px !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-phai #btn-mo-ke-phai .chu-dai-tren-mobile,
  .thanh-dau-phai #btn-mo-ke-phai .chu-ngan-tren-mobile {
    display: none !important;
  }

  .thanh-dau-phai #btn-topbar-theme {
    display: inline-flex !important;
    min-width: 38px !important;
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    font-size: 15px !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .thanh-dau-phai #btn-topbar-theme .chu-dai-tren-mobile {
    display: none !important;
  }

  .thanh-dau-phai #btn-mo-drawer-chi-tiet {
    min-width: 38px !important;
    width: auto !important;
    height: 38px !important;
    padding: 0 8px !important;
    font-size: 13px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  .thanh-dau-phai #btn-mo-drawer-chi-tiet .nhan-chi-tiet-top {
    display: inline !important;
    white-space: nowrap !important;
  }
  @media (max-width: 480px) {
    .thanh-dau-phai #btn-mo-drawer-chi-tiet .nhan-chi-tiet-top {
      display: none !important;
    }
    .thanh-dau-phai #btn-mo-drawer-chi-tiet {
      width: 38px !important;
      padding: 0 !important;
    }
  }
  .thanh-dau-phai #btn-menu-thanh-dau-them {
    min-width: 38px !important;
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Thu gọn nhãn chữ của nút mic/dừng, chỉ giữ icon để nhường chỗ cho ô nhập */
  .cong-cu-nhap-nhom .btn-nhan-chu {
    display: none !important;
  }
  
  #hang-nhap-tuy-bien-cuoc {
    gap: 6px !important;
  }

  /* Tiêu đề thanh đỉnh tự động cắt ngắn khi hẹp */
  .thanh-dau-doc-cuoc .tieu-de-topbar,
  #thanh-dau-doc-cuoc h2,
  #thanh-dau-doc-cuoc .brand-title,
  #thanh-dau-doc-cuoc .thanh-dau-ten-wrap {
    max-width: 48px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Kim xăng AI trên topbar cho màn ngoài Z Fold 4: cuộn cùng thanh-dau-phai hoặc né Chi tiết */
  .thanh-dau-phai #kim-xang-root,
  .thanh-dau-phai .kim-xang-wrap {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    flex-shrink: 0 !important;
    margin: 0 2px !important;
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 50% !important;
    z-index: 10 !important;
  }
  body > #kim-xang-root,
  body > .kim-xang-wrap,
  html body > #kim-xang-root,
  html body > div.kim-xang-wrap {
    right: 50px !important;
    top: 5px !important;
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 50% !important;
    z-index: 120 !important;
  }
  #kim-xang-root .kim-xang-bar,
  .kim-xang-wrap .kim-xang-bar {
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 50% !important;
    padding: 0 !important;
  }
  #btn-mo-drawer-tro-ly .nhan-tro-ly-top {
    display: none !important;
  }
  #btn-mo-drawer-tro-ly {
    min-width: 38px !important;
    width: 38px !important;
    padding: 0 !important;
  }

  /* Ẩn hoàn toàn tay nắm kẹp mép phải trên mobile để tránh che nội dung / terminal */
  .tay-nam-mo-ke-phai,
  #tay-nam-mo-ke-phai {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Dãy tab trợ lý/terminal cuộn ngang 1 dòng mượt mà trên mobile */
  #hang-the-trang-doc,
  .hang-the-trang-doc {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  #hang-the-trang-doc::-webkit-scrollbar,
  .hang-the-trang-doc::-webkit-scrollbar {
    display: none !important;
  }

  /* Drawer hoặc kệ phải mở toàn màn hình trên Z Fold gập ngoài */
  .ke-phai,
  #drawer-du-phong,
  .drawer-phai {
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

/* 4. ĐÁP ỨNG ĐẶC THÙ CHO SAMSUNG GALAXY Z FOLD MÀN TRONG (800px - 900px) */
@media (min-width: 768px) and (max-width: 960px) {
  /* Bố cục tỷ lệ gần vuông của Z Fold màn trong */
  #hang-the-trang-doc {
    padding: 6px 12px 0 12px !important;
  }
  
  .khung-hoi-thoai-grid {
    padding: 12px 16px !important;
  }

  /* Nội dung tin nhắn không bị tràn */
  .tin-nhan-noi-dung,
  .tin-nhan-noi-dung pre,
  .tin-nhan-noi-dung code {
    max-width: 100% !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }
}

/* ==========================================================================
   TAY NẮM MỞ KỆ PHẢI (RIGHT SIDEBAR) LUÔN TRUY CẬP ĐƯỢC (Việc 3)
   - Luôn hiện ở mép phải khi kệ đóng, chuẩn điểm chạm ≥ 44px
   ========================================================================== */
.tay-nam-mo-ke-phai {
  display: flex !important;
  position: fixed !important;
  right: 0 !important;
  top: 140px !important;
  width: 36px !important;
  height: 48px !important;
  min-width: 36px !important;
  min-height: 48px !important;
  background: #0284c7 !important;
  color: #ffffff !important;
  border-radius: 8px 0 0 8px !important;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.35) !important;
  z-index: 100 !important;
  cursor: pointer !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  border: none !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}
.tay-nam-mo-ke-phai:hover {
  background: #0369a1 !important;
  transform: translateX(-3px);
}
body.ke-phai-mo .tay-nam-mo-ke-phai,
.ke-phai-container.mo ~ .tay-nam-mo-ke-phai {
  display: none !important;
}

/* ==========================================================================
   HỆ THỐNG 4 THEME OS TÙY BIẾN CHO DU-PHONG (Việc 4)
   ========================================================================== */
.bang-chon-theme-os {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6) !important;
  padding: 8px !important;
}

.bang-chon-theme-os .dropdown-section-label {
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  color: #94a3b8 !important;
  padding: 6px 10px !important;
}

.theme-opt-btn {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  min-height: 42px !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: #f1f5f9 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border: 1px solid transparent !important;
  cursor: pointer !important;
  transition: all 0.12s ease !important;
  text-align: left !important;
}
.theme-opt-btn:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
}

/* 1. Trạm Vũ Trụ (Deep Space Nebula) */
[data-theme="space"],
body.theme-space {
  --theme-bg: #070a12;
  --theme-surface: #0e1424;
  --theme-surface-2: #141e34;
  --theme-border: rgba(99, 102, 241, 0.35);
  --theme-text: #f1f5f9;
  --theme-accent: #818cf8;
  background: radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.16), transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.14), transparent 50%),
              #070a12 !important;
  color: #f1f5f9 !important;
}
[data-theme="space"] .cot-danh-sach,
[data-theme="space"] .cot-noi-dung,
[data-theme="space"] #thanh-dau-doc-cuoc {
  background: #0e1424 !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

/* 2. Cyberpunk Neon (Matrix Terminal) */
[data-theme="cyber"],
body.theme-cyber {
  --theme-bg: #040608;
  --theme-surface: #091017;
  --theme-surface-2: #0d1926;
  --theme-border: rgba(0, 240, 255, 0.35);
  --theme-text: #e0fbfc;
  --theme-accent: #00f0ff;
  background: radial-gradient(circle at top right, rgba(0, 240, 255, 0.12), transparent 45%),
              radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 45%),
              #040608 !important;
  color: #e0fbfc !important;
}
[data-theme="cyber"] .cot-danh-sach,
[data-theme="cyber"] .cot-noi-dung,
[data-theme="cyber"] #thanh-dau-doc-cuoc {
  background: #091017 !important;
  border-color: rgba(0, 240, 255, 0.3) !important;
}

/* 3. Kính Mờ Tinh Tế (Apple Translucent Glass) */
[data-theme="glass"],
body.theme-glass {
  --theme-bg: #0f172a;
  --theme-surface: rgba(30, 41, 59, 0.65);
  --theme-surface-2: rgba(51, 65, 85, 0.55);
  --theme-border: rgba(255, 255, 255, 0.14);
  --theme-text: #f8fafc;
  --theme-accent: #38bdf8;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  color: #f8fafc !important;
}
[data-theme="glass"] .cot-danh-sach,
[data-theme="glass"] .cot-noi-dung,
[data-theme="glass"] #thanh-dau-doc-cuoc {
  background: rgba(30, 41, 59, 0.75) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* 4. Đêm Tối Giản (Obsidian Dark) */
[data-theme="obsidian"],
body.theme-obsidian {
  --theme-bg: #09090b;
  --theme-surface: #121215;
  --theme-surface-2: #18181b;
  --theme-border: #27272a;
  --theme-text: #f4f4f5;
  --theme-accent: #fafafa;
  background: #09090b !important;
  color: #f4f4f5 !important;
}
[data-theme="obsidian"] .cot-danh-sach,
[data-theme="obsidian"] .cot-noi-dung,
[data-theme="obsidian"] #thanh-dau-doc-cuoc {
  background: #121215 !important;
  border-color: #27272a !important;
}

/* ==========================================================================
   DISPLAY OS · ÁNH XẠ TOÀN DIỆN 4 THEME OS (WO-DU-PHONG-OVERHAUL-ALL)
   ========================================================================== */
[data-theme="space"], body.theme-space {
  --canvas: #070a12;
  --paper: #0e1424;
  --card-bg: #0e1424;
  --bg: #070a12;
  --ink: #f1f5f9;
  --ink-secondary: #cbd5e1;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: rgba(99, 102, 241, 0.25);
  --line-strong: rgba(99, 102, 241, 0.45);
  --border: rgba(99, 102, 241, 0.3);
  --bubble-jack: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  --bubble-agent: #0e1424;
  --accent: #818cf8;
}

[data-theme="cyber"], body.theme-cyber {
  --canvas: #040608;
  --paper: #091017;
  --card-bg: #091017;
  --bg: #040608;
  --ink: #e0fbfc;
  --ink-secondary: #98c1d9;
  --text: #e0fbfc;
  --muted: #64748b;
  --faint: #475569;
  --line: rgba(0, 240, 255, 0.22);
  --line-strong: rgba(0, 240, 255, 0.4);
  --border: rgba(0, 240, 255, 0.3);
  --bubble-jack: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  --bubble-agent: #091017;
  --accent: #00f0ff;
}

[data-theme="glass"], body.theme-glass {
  --canvas: #0f172a;
  --paper: rgba(30, 41, 59, 0.75);
  --card-bg: rgba(30, 41, 59, 0.75);
  --bg: #0f172a;
  --ink: #f8fafc;
  --ink-secondary: #e2e8f0;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --faint: #94a3b8;
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.25);
  --border: rgba(255, 255, 255, 0.18);
  --bubble-jack: rgba(2, 132, 199, 0.35);
  --bubble-agent: rgba(30, 41, 59, 0.65);
  --accent: #38bdf8;
}

[data-theme="obsidian"], body.theme-obsidian {
  --canvas: #09090b;
  --paper: #121215;
  --card-bg: #121215;
  --bg: #09090b;
  --ink: #f4f4f5;
  --ink-secondary: #d4d4d8;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: #27272a;
  --line-strong: #3f3f46;
  --border: #27272a;
  --bubble-jack: #1c1917;
  --bubble-agent: #121215;
  --accent: #f59e0b;
}

/* ==========================================================================
   KỆ PHẢI (RIGHT SIDE PANEL) & 4 TABS CHỨC NĂNG (WO-DU-PHONG-OVERHAUL-ALL)
   ========================================================================== */
.ke-phai-topbar-highlight {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3) !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.ke-phai-topbar-highlight:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
}

.badge-ke-phai-top {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 18px !important;
  height: 18px !important;
  padding: 0 5px !important;
  border-radius: 9999px !important;
  background: #ffffff !important;
  color: #0284c7 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
}

.ke-phai-nav-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 8px 12px !important;
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  overflow-x: auto !important;
  flex-shrink: 0 !important;
  scrollbar-width: none !important;
}
.ke-phai-nav-tabs::-webkit-scrollbar { display: none !important; }

.ke-phai-tab-btn {
  flex: 1 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.18s ease !important;
}

.ke-phai-tab-btn:hover {
  background: rgba(255, 255, 255, 0.7) !important;
  color: #0f172a !important;
}

.ke-phai-tab-btn.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  border-color: #bae6fd !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15) !important;
}

.ke-phai-tab-view {
  display: none !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  min-height: 0 !important;
}

.ke-phai-tab-view.active {
  display: flex !important;
  flex-direction: column !important;
}

/* Whiteboard Canvas Toolbar */
.whiteboard-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
.wb-tool-group {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
}
.wb-btn {
  padding: 5px 8px !important;
  border-radius: 6px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #334155 !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
}
.wb-color-btn {
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 0 0 1px #cbd5e1 !important;
}
.wb-color-btn.active {
  box-shadow: 0 0 0 2.5px #0284c7 !important;
  transform: scale(1.15) !important;
}
.wb-size-btn.active {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #bae6fd !important;
}
.wb-btn-save {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}
.whiteboard-canvas-wrap {
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px !important;
  background: #f1f5f9 !important;
  overflow: hidden !important;
}
#canvas-whiteboard-ke-phai {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
  touch-action: none !important;
  cursor: crosshair !important;
  width: 100% !important;
  height: 380px !important;
}

/* Tab 3 Quick Nhung */
.nhung-quick-input-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 12px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
.ke-phai-artifacts-list {
  padding: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

/* Tab 4 Inspector */
.ke-phai-inspector-hero {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 16px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
.kp-insp-avatar-wrap {
  width: 54px !important;
  height: 54px !important;
  border-radius: 14px !important;
  background: #e0f2fe !important;
  border: 1.5px solid #bae6fd !important;
  display: grid !important;
  place-items: center !important;
}
.kp-insp-facts {
  padding: 14px 16px !important;
  margin: 0 !important;
  display: grid !important;
  gap: 10px !important;
}
.kp-insp-facts > div {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  font-size: 13px !important;
}
.kp-insp-facts dt {
  color: #64748b !important;
  font-weight: 600 !important;
}
.kp-insp-facts dd {
  margin: 0 !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}

/* ==========================================================================
   MARKDOWN TYPOGRAPHY (WO-DU-PHONG-OVERHAUL-ALL)
   ========================================================================== */
.noi-dung-markdown-wrap {
  font-size: 13.5px !important;
  line-height: 1.6 !important;
  color: inherit !important;
}
.noi-dung-markdown-wrap p { margin: 4px 0 !important; }
.noi-dung-markdown-wrap pre {
  background: #0f172a !important;
  color: #f8fafc !important;
  padding: 12px 14px !important;
  border-radius: 8px !important;
  overflow-x: auto !important;
  font-family: ui-monospace, Menlo, monospace !important;
  font-size: 12.5px !important;
  margin: 8px 0 !important;
  position: relative !important;
}
.noi-dung-markdown-wrap code {
  font-family: ui-monospace, Menlo, monospace !important;
  background: rgba(15, 23, 42, 0.08) !important;
  color: #0369a1 !important;
  padding: 2px 5px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
}
.noi-dung-markdown-wrap pre code {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
}
.noi-dung-markdown-wrap table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 10px 0 !important;
  font-size: 13px !important;
  border: 1px solid #cbd5e1 !important;
}
.noi-dung-markdown-wrap th,
.noi-dung-markdown-wrap td {
  padding: 8px 12px !important;
  border: 1px solid #cbd5e1 !important;
}
.noi-dung-markdown-wrap th {
  background: #f1f5f9 !important;
  font-weight: 750 !important;
  color: #0f172a !important;
}
.noi-dung-markdown-wrap blockquote {
  margin: 8px 0 !important;
  padding: 8px 14px !important;
  border-left: 4px solid #38bdf8 !important;
  background: #f0f9ff !important;
  color: #0369a1 !important;
  font-style: italic !important;
  border-radius: 0 8px 8px 0 !important;
}

/* ==========================================================================
   LEFT PANEL & PARENT-CHILD TREE (WO-DU-PHONG-OVERHAUL-ALL)
   ========================================================================== */
.the-cuoc.drag-over-target {
  border: 2px dashed #0284c7 !important;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.35) !important;
  background: rgba(2, 132, 199, 0.08) !important;
  transform: scale(1.02) !important;
}

.the-cuoc.the-cuoc-con {
  margin-left: 20px !important;
  border-left: 3px solid #38bdf8 !important;
}

.thanh-gom-nhom {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  flex-wrap: nowrap !important;
  padding: 4px 2px !important;
}
.thanh-gom-nhom::-webkit-scrollbar { display: none !important; }

.tab-gom {
  flex: 0 0 auto !important;
  padding: 6px 12px !important;
  border-radius: 9999px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.18s ease !important;
}
.tab-gom:hover {
  border-color: #94a3b8 !important;
  background: #f8fafc !important;
}
.tab-gom.dang-chon,
.tab-gom.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25) !important;
}

/* ==========================================================================
   WO-DU-PHONG-RESIZE-AND-VISUAL-SUMMARY:
   CHỮA LỖI TOÀN DIỆN: VOICE TYPING, TERMINAL SCROLL, ACTIVE TAB CONTRAST,
   VISUAL ARTIFACT SUMMARY, QUICK PROMPT MANAGER & KIM XĂNG AI HUD
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PHỤC HỒI NÚT VOICE TYPING (🎙️ Mic) VÀ CÁC NÚT NHẬP LIỆU
   Khóa cơ học: Tuyệt đối không để nút biến mất khi resize hay trên tablet
   -------------------------------------------------------------------------- */
#hang-nhap-tuy-bien-cuoc,
.hang-nhap-tuy-bien-cuoc,
html body #khung-nhap-tin-cuoc #hang-nhap-tuy-bien-cuoc {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 8px !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

#hang-nhap-tuy-bien-cuoc .thanh-hanh-dong-nhap,
.thanh-hanh-dong-nhap,
html body #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  visibility: visible !important;
}

.cong-cu-nhap-nhom,
html body #khung-nhap-tin-cuoc .cong-cu-nhap-nhom {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  visibility: visible !important;
}

/* Khóa tối cao: Nút Mic 🎙️, Đính kèm 📎, Dừng 🛑 luôn hiện diện, touch target >= 44px */
#btn-mic-giong-noi,
button#btn-mic-giong-noi,
html body #btn-mic-giong-noi,
html body #khung-nhap-tin-cuoc #btn-mic-giong-noi,
#btn-dinh-kem-anh,
button#btn-dinh-kem-anh,
html body #btn-dinh-kem-anh,
html body #khung-nhap-tin-cuoc #btn-dinh-kem-anh,
#btn-ctrl-c,
button#btn-ctrl-c,
html body #btn-ctrl-c,
html body #khung-nhap-tin-cuoc #btn-ctrl-c {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-width: 44px !important;
  min-height: 44px !important;
  height: 44px !important;
  width: auto !important;
  padding: 0 10px !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  border-radius: 10px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #1e293b !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
}

#btn-mic-giong-noi:hover,
#btn-dinh-kem-anh:hover,
#btn-ctrl-c:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

#btn-mic-giong-noi:active,
#btn-mic-giong-noi.dang-nghe {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4) !important;
}

#btn-ctrl-c:hover {
  background: #fff1f2 !important;
  border-color: #f43f5e !important;
  color: #e11d48 !important;
}

/* Ô gõ co giãn thông minh không đè ép các nút */
#nhap-tin-hoi-thoai,
html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai {
  flex: 1 1 140px !important;
  min-width: 80px !important;
  min-height: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
}

/* Cụm nút gửi */
.nut-gui-nhom,
html body #khung-nhap-tin-cuoc .nut-gui-nhom {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  visibility: visible !important;
}

#btn-gui-tin-nhan,
html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan {
  display: inline-flex !important;
  visibility: visible !important;
  min-width: 64px !important;
  min-height: 44px !important;
  height: 44px !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 10px !important;
  flex: 0 0 auto !important;
}

@media (max-width: 640px) {
  #btn-mic-giong-noi,
  #btn-dinh-kem-anh,
  #btn-ctrl-c {
    min-width: 36px !important;
    width: 36px !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 !important;
  }
  #btn-mic-giong-noi .btn-nhan-chu,
  #btn-dinh-kem-anh .btn-nhan-chu,
  #btn-ctrl-c .btn-nhan-chu {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   2. SỬA LỖI KHÔNG SCROLL ĐƯỢC TRÊN TERMINAL & CHAT
   Mở khóa touch scroll cho màn hình cảm ứng tablet & mobile
   -------------------------------------------------------------------------- */
#man-hinh-terminal,
.man-hinh-terminal-that,
#danh-sach-dong-terminal,
#khung-tin-nhan,
.khung-tin-nhan,
#iframe-terminal-that,
iframe[id*="terminal"],
.terminal-frame,
html body #khung-tin-nhan.terminal-mot-dai #man-hinh-terminal,
html body #man-hinh-terminal {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  pointer-events: auto !important;
}

#danh-sach-dong-terminal {
  max-height: 100% !important;
  min-height: 200px !important;
}

/* --------------------------------------------------------------------------
   3. TƯƠNG PHẢN RỰC RỠ CHO ACTIVE TAB (Terminal Session Tabs)
   Apple Vivid Gradient vs Subtle Inactive Glass
   -------------------------------------------------------------------------- */
.the-trang-item.dang-chon,
.the-trang-item.active,
html body #hang-the-trang-doc .the-trang-item.dang-chon,
html body #hang-the-trang-doc .the-trang-item.active {
  background: linear-gradient(135deg, #0a84ff 0%, #0066cc 100%) !important;
  color: #ffffff !important;
  border: 1.5px solid #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.65), 0 2px 8px rgba(10, 132, 255, 0.5) !important;
  font-weight: 700 !important;
  z-index: 5 !important;
  transform: translateY(-1px) !important;
}

.the-trang-item.dang-chon .the-trang-ten,
.the-trang-item.active .the-trang-ten,
.the-trang-item.dang-chon .the-trang-ten-ky-thuat,
.the-trang-item.active .the-trang-ten-ky-thuat,
.the-trang-item.dang-chon .the-trang-ten-nguoi-dat,
.the-trang-item.active .the-trang-ten-nguoi-dat {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
}

.the-trang-item.dang-chon .cham-trang-thai-dot,
.the-trang-item.active .cham-trang-thai-dot {
  background: #38bdf8 !important;
  box-shadow: 0 0 10px #38bdf8, 0 0 4px #ffffff !important;
}

.the-trang-item.dang-chon .the-trang-btn-action,
.the-trang-item.dang-chon .the-trang-dong-btn {
  color: #ffffff !important;
  opacity: 0.9 !important;
}
.the-trang-item.dang-chon .the-trang-dong-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

/* Inactive Tab */
.the-trang-item:not(.dang-chon):not(.active),
html body #hang-the-trang-doc .the-trang-item:not(.dang-chon):not(.active) {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}

.the-trang-item:not(.dang-chon):not(.active) .the-trang-ten,
.the-trang-item:not(.dang-chon):not(.active) .the-trang-ten-ky-thuat {
  color: #94a3b8 !important;
  font-weight: 500 !important;
}

.the-trang-item:not(.dang-chon):not(.active):hover {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* --------------------------------------------------------------------------
   4. TẦNG TÓM TẮT: VISUAL ARTIFACT CONTAINER & STYLES
   -------------------------------------------------------------------------- */
.visual-artifact-container {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45) !important;
  animation: fadeInArtifact 0.2s ease-out !important;
}
@keyframes fadeInArtifact {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   5. NÂNG CẤP THANH QUICK PROMPT & THÊM PROMPT TÙY BIẾN
   Tương phản cao, icon sắc sảo, nút Thêm Prompt nổi bật
   -------------------------------------------------------------------------- */
#thanh-prompt-chips,
.thanh-prompt-chips {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  padding: 6px 4px !important;
  box-sizing: border-box !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
}

.chip-item {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 5px 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
  min-height: 30px !important;
  height: 30px !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
}

.chip-item.chip-review {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: 1px solid #38bdf8 !important;
}
.chip-item.chip-fix {
  background: #ea580c !important;
  color: #ffffff !important;
  border: 1px solid #fb923c !important;
}
.chip-item.chip-test {
  background: #16a34a !important;
  color: #ffffff !important;
  border: 1px solid #4ade80 !important;
}
.chip-item.chip-handoff {
  background: #7c3aed !important;
  color: #ffffff !important;
  border: 1px solid #a78bfa !important;
}
.chip-item.chip-status {
  background: #0d9488 !important;
  color: #ffffff !important;
  border: 1px solid #2dd4bf !important;
}
.chip-item.chip-theme {
  background: #db2777 !important;
  color: #ffffff !important;
  border: 1px solid #f472b6 !important;
}
.chip-item.chip-quant {
  background: #059669 !important;
  color: #ffffff !important;
  border: 1px solid #34d399 !important;
}
.chip-item.chip-custom {
  background: #334155 !important;
  color: #38bdf8 !important;
  border: 1px solid #0284c7 !important;
}
.chip-item.chip-them-prompt {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
  border: 1.5px dashed #38bdf8 !important;
}
.chip-item.chip-them-prompt:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-style: solid !important;
}

.chip-item:hover {
  transform: translateY(-1px) scale(1.02) !important;
  filter: brightness(1.1) !important;
}

.btn-xoa-chip-custom {
  position: absolute !important;
  top: -4px !important;
  right: -4px !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: #ef4444 !important;
  color: #ffffff !important;
  border: none !important;
  font-size: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  padding: 0 !important;
  line-height: 1 !important;
}

/* Modal thêm Prompt */
.modal-tuy-bien-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  z-index: 100000 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}

.modal-tuy-bien-backdrop.dang-mo,
.modal-tuy-bien-backdrop[style*="display: flex"] {
  display: flex !important;
}

.modal-tuy-bien-box {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 90% !important;
  max-width: 450px !important;
  max-height: 85vh !important;
  overflow-y: auto !important;
  background: #0f172a !important;
  border: 1.5px solid #38bdf8 !important;
  border-radius: 14px !important;
  padding: 20px !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 25px rgba(56, 189, 248, 0.35) !important;
  box-sizing: border-box !important;
  color: #f8fafc !important;
  z-index: 100001 !important;
  animation: scaleModal 0.18s ease-out !important;
}
@keyframes scaleModal {
  from { transform: translate(-50%, -50%) scale(0.95); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.modal-tuy-bien-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 14px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid #1e293b !important;
}

.modal-tuy-bien-close {
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  font-size: 16px !important;
  cursor: pointer !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
}
.modal-tuy-bien-close:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   6. TINH CHỈNH KIM XĂNG AI: CAPSULE HUD HIỆN ĐẠI [ ⛽ AI: 84% ]
   Thay thế icon cây xăng vuông thô cũ
   -------------------------------------------------------------------------- */
/* Ẩn hoàn toàn icon thô cũ */
#kim-xang-root,
.kim-xang-wrap,
html body #kim-xang-root,
html body .kim-xang-wrap {
  display: none !important;
}

.capsule-kim-xang-hud {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 10px !important;
  border-radius: 16px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  cursor: pointer !important;
  user-select: none !important;
  touch-action: manipulation !important;
  transition: all 0.15s ease !important;
  margin-right: 6px !important;
}

.capsule-kim-xang-hud:hover {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4) !important;
  transform: translateY(-1px) !important;
}

.capsule-icon {
  font-size: 14px !important;
  line-height: 1 !important;
}

.capsule-label {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #94a3b8 !important;
  letter-spacing: 0.02em !important;
}

.capsule-percent {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #38bdf8 !important;
}

.capsule-pin-track {
  width: 32px !important;
  height: 6px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border-radius: 3px !important;
  overflow: hidden !important;
  position: relative !important;
}

.capsule-pin-fill {
  height: 100% !important;
  background: linear-gradient(90deg, #22c55e 0%, #38bdf8 100%) !important;
  border-radius: 3px !important;
  box-shadow: 0 0 6px #38bdf8 !important;
}

/* Popover Kim Xăng AI */
.popover-kim-xang-box {
  position: absolute !important;
  top: 42px !important;
  left: 0 !important;
  width: 280px !important;
  max-width: 90vw !important;
  background: #0f172a !important;
  border: 1px solid #38bdf8 !important;
  border-radius: 12px !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75) !important;
  padding: 12px !important;
  z-index: 1250 !important;
  pointer-events: auto !important;
  color: #f8fafc !important;
  box-sizing: border-box !important;
  animation: fadeInArtifact 0.15s ease-out !important;
}

.popover-kx-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding-bottom: 8px !important;
  margin-bottom: 8px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.popover-kx-close {
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  font-size: 14px !important;
}

.popover-kx-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 6px !important;
  font-size: 11.5px !important;
}

.popover-kx-k {
  color: #94a3b8 !important;
}

.popover-kx-v {
  color: #f1f5f9 !important;
  font-weight: 600 !important;
}

.popover-kx-meter-wrap {
  width: 100% !important;
  height: 6px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 3px !important;
  overflow: hidden !important;
  margin: 6px 0 10px 0 !important;
}

.popover-kx-meter-bar {
  height: 100% !important;
  background: linear-gradient(90deg, #22c55e 0%, #38bdf8 100%) !important;
  border-radius: 3px !important;
}

.popover-kx-footer {
  margin-top: 10px !important;
  padding-top: 8px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ==========================================================================
   WO-DU-PHONG-RESIZE-AND-VISUAL-SUMMARY: KHẮC PHỤC TRIỆT ĐỂ 4 LỖI PHẢN HỒI TỪ JACK
   1. Chữ đè chữ ở cột trái (Tiêu đề nhóm & số phiên)
   2. Hàng thẻ tab terminal độc lập, cuộn ngang, Active tab Apple Electric Blue viền neon
   3. Khống chế dock nhập liệu #khung-nhap-tin-cuoc không đè che chân trang cột trái
   4. Modal Thêm Prompt nổi trung tâm 100vw x 100vh
   ========================================================================== */

/* 1. SỬA LỖI CHỮ ĐÈ CHỮ Ở CỘT TRÁI (TIÊU ĐỀ NHÓM & SỐ PHIÊN) */
.nhom-tieu-de-bar,
html body .nhom-tieu-de-bar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 6px 10px !important;
  min-height: 38px !important;
  background: var(--card-bg, #ffffff) !important;
  border: 1px solid var(--card-border, #cbd5e1) !important;
  border-radius: 8px !important;
  margin-bottom: 6px !important;
  gap: 8px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  position: static !important;
  width: 100% !important;
}

.btn-gap-mo-nhom,
html body .btn-gap-mo-nhom {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  min-height: 36px !important;
  cursor: pointer !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: 0.2px !important;
  border-radius: 4px !important;
  touch-action: manipulation !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-align: left !important;
  position: static !important;
}

.nhom-ten-chu,
html body .nhom-ten-chu {
  display: block !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  line-height: 1.3 !important;
  font-size: 12.5px !important;
  font-weight: 750 !important;
  color: #0f172a !important;
  position: static !important;
}

.mui-ten-gap-mo,
html body .mui-ten-gap-mo {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  font-size: 14px !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
  user-select: none !important;
  flex: 0 0 auto !important;
  position: static !important;
}

.nhom-so-phien,
html body .nhom-so-phien {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #475569 !important;
  background: rgba(15, 23, 42, 0.06) !important;
  padding: 2px 8px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  position: static !important;
}

/* Ho tro dong bo cac theme toi: Space, Cyber, Glass, Obsidian, Toi */
.theme-space .nhom-tieu-de-bar,
.theme-cyber .nhom-tieu-de-bar,
.theme-glass .nhom-tieu-de-bar,
.theme-obsidian .nhom-tieu-de-bar,
.theme-toi .nhom-tieu-de-bar,
[data-theme="space"] .nhom-tieu-de-bar,
[data-theme="cyber"] .nhom-tieu-de-bar,
[data-theme="glass"] .nhom-tieu-de-bar,
[data-theme="obsidian"] .nhom-tieu-de-bar,
[data-theme="toi"] .nhom-tieu-de-bar,
[data-theme="dark"] .nhom-tieu-de-bar {
  background: rgba(15, 23, 42, 0.85) !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
}

.theme-space .nhom-ten-chu,
.theme-cyber .nhom-ten-chu,
.theme-glass .nhom-ten-chu,
.theme-obsidian .nhom-ten-chu,
.theme-toi .nhom-ten-chu,
[data-theme="space"] .nhom-ten-chu,
[data-theme="cyber"] .nhom-ten-chu,
[data-theme="glass"] .nhom-ten-chu,
[data-theme="obsidian"] .nhom-ten-chu,
[data-theme="toi"] .nhom-ten-chu,
[data-theme="dark"] .nhom-ten-chu,
.theme-space .btn-gap-mo-nhom,
.theme-cyber .btn-gap-mo-nhom,
.theme-glass .btn-gap-mo-nhom,
.theme-obsidian .btn-gap-mo-nhom,
.theme-toi .btn-gap-mo-nhom {
  color: #f8fafc !important;
}

.theme-space .nhom-so-phien,
.theme-cyber .nhom-so-phien,
.theme-glass .nhom-so-phien,
.theme-obsidian .nhom-so-phien,
.theme-toi .nhom-so-phien,
[data-theme="space"] .nhom-so-phien,
[data-theme="cyber"] .nhom-so-phien,
[data-theme="glass"] .nhom-so-phien,
[data-theme="obsidian"] .nhom-so-phien,
[data-theme="toi"] .nhom-so-phien,
[data-theme="dark"] .nhom-so-phien {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
}

/* 2. DÃY TABS TRỢ LÝ ĐANG MỞ (#hang-the-trang-doc): CUỘN ĐỘC LẬP & TƯƠNG PHẢN RỰC RỠ */
#hang-the-trang-doc,
.hang-the-trang-doc,
html body #hang-the-trang-doc {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  gap: 6px !important;
  padding: 4px 8px !important;
  box-sizing: border-box !important;
  touch-action: pan-x !important;
}
#hang-the-trang-doc::-webkit-scrollbar,
.hang-the-trang-doc::-webkit-scrollbar {
  display: none !important;
}

/* Tab item không bị bóp nghẹt */
.the-trang-item,
html body #hang-the-trang-doc .the-trang-item {
  flex: 0 0 auto !important;
  min-width: max-content !important;
  margin: 0 2px !important;
  padding: 4px 12px !important;
  min-height: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
}

/* Tab Active: Xanh Apple Electric Blue rực rỡ, chữ trắng đậm, viền neon */
.the-trang-item.dang-chon,
.the-trang-item.active,
html body #hang-the-trang-doc .the-trang-item.dang-chon,
html body #hang-the-trang-doc .the-trang-item.active {
  background: linear-gradient(135deg, #0a84ff 0%, #0066cc 100%) !important;
  color: #ffffff !important;
  border: 2px solid #38bdf8 !important;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.8), 0 2px 8px rgba(10, 132, 255, 0.6) !important;
  font-weight: 800 !important;
  z-index: 5 !important;
  transform: translateY(-1px) !important;
}

.the-trang-item.dang-chon .the-trang-ten,
.the-trang-item.active .the-trang-ten,
.the-trang-item.dang-chon .the-trang-ten-ky-thuat,
.the-trang-item.active .the-trang-ten-ky-thuat,
.the-trang-item.dang-chon .the-trang-ten-nguoi-dat,
.the-trang-item.active .the-trang-ten-nguoi-dat {
  color: #ffffff !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.the-trang-item.dang-chon .cham-trang-thai-dot,
.the-trang-item.active .cham-trang-thai-dot {
  background: #38bdf8 !important;
  box-shadow: 0 0 10px #38bdf8, 0 0 4px #ffffff !important;
}

.the-trang-item.dang-chon .the-trang-dong-btn {
  color: #ffffff !important;
  opacity: 0.9 !important;
}

/* Tab Inactive: Kính mờ dịu mắt, không lấn át */
.the-trang-item:not(.dang-chon):not(.active),
html body #hang-the-trang-doc .the-trang-item:not(.dang-chon):not(.active) {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
  opacity: 0.85 !important;
}

.the-trang-item:not(.dang-chon):not(.active):hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #f8fafc !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  opacity: 1 !important;
}

.the-trang-item:not(.dang-chon):not(.active) .the-trang-ten,
.the-trang-item:not(.dang-chon):not(.active) .the-trang-ten-ky-thuat {
  color: #94a3b8 !important;
  font-weight: 500 !important;
}

/* 3. KHỐNG CHẾ KHUNG NHẬP ĐÁY KHÔNG ĐÈ CHE CHÂN TRANG CỘT TRÁI */
@media (min-width: 768px) {
  html body #khung-nhap-tin-cuoc.khung-nhap-tin,
  html body #khung-nhap-tin-cuoc,
  #khung-nhap-tin-cuoc {
    left: 280px !important;
    right: 0 !important;
    width: calc(100% - 280px) !important;
    max-width: calc(100vw - 280px) !important;
  }
  html body.sidebar-gap #khung-nhap-tin-cuoc,
  html body .khung-hoi-thoai-grid.sidebar-gap ~ #khung-nhap-tin-cuoc {
    left: 68px !important;
    width: calc(100% - 68px) !important;
    max-width: calc(100vw - 68px) !important;
  }
}

/* Dock tinh gọn tối đa, không che mất nội dung */
html body #khung-nhap-tin-cuoc.khung-nhap-tin,
html body #khung-nhap-tin-cuoc,
#khung-nhap-tin-cuoc {
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 8px)) 10px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border-top: 1px solid rgba(203, 213, 225, 0.8) !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
  z-index: 100 !important;
}

[data-theme="dark"] #khung-nhap-tin-cuoc,
[data-theme="obsidian"] #khung-nhap-tin-cuoc,
.theme-dark #khung-nhap-tin-cuoc {
  background: rgba(15, 23, 42, 0.92) !important;
  border-top-color: rgba(51, 65, 85, 0.8) !important;
}

/* Đảm bảo danh sách cột trái cuộn được đến tận đáy */
.cot-danh-sach,
#vung-danh-sach-cuoc,
#danh-sach-cuoc-tro-chuyen {
  padding-bottom: 90px !important;
}

/* ==========================================================================
   WO-DU-PHONG-UX-OVERHAUL-PERFECTION: CÁC NÂNG CẤP HOÀN THIỆN ĐỈNH CAO
   ========================================================================== */

/* 1. LỖI RENDER LÒI CHỮ GÓC DƯỚI TRÁI: ẨN DỮ LIỆU CHƯA RÕ TUỔI */
#dos-tuoi-the-ngoai-zoom,
.dos-data-age[data-dos-age-level="unknown"],
div:has(> [data-dos-age-at=""]) {
  display: none !important;
  visibility: hidden !important;
}

/* 2. CẢI THIỆN LAYOUT CỘT TRÁI: DẢI CHIP LỌC SEGMENTED PILL ĐỀU ĐẶN */
.tabs-gom-nhom,
html body .tabs-gom-nhom {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  background: rgba(0, 0, 0, 0.06) !important;
  border-radius: 10px !important;
  padding: 4px !important;
  gap: 4px !important;
  box-sizing: border-box !important;
}
.tabs-gom-nhom::-webkit-scrollbar {
  display: none !important;
}
.tab-gom,
html body .tab-gom {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  text-align: center !important;
  border: none !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--text-muted, #64748b) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
  min-height: 32px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  touch-action: manipulation !important;
}
.tab-gom.dang-chon,
html body .tab-gom.dang-chon {
  background: var(--paper, #ffffff) !important;
  color: var(--primary, #0284c7) !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12) !important;
}
[data-theme="dark"] .tabs-gom-nhom,
[data-theme="obsidian"] .tabs-gom-nhom,
.theme-dark .tabs-gom-nhom {
  background: rgba(30, 41, 59, 0.8) !important;
}
[data-theme="dark"] .tab-gom.dang-chon,
[data-theme="obsidian"] .tab-gom.dang-chon,
.theme-dark .tab-gom.dang-chon {
  background: #0284c7 !important;
  color: #ffffff !important;
}

/* 3. CỤM NÚT TÁC VỤ THÔNG MINH TẠI DÒNG TRẠNG THÁI */
.cum-tac-vu-thong-minh {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin-left: 8px !important;
  vertical-align: middle !important;
}
.btn-tac-vu-nhanh {
  padding: 2px 8px !important;
  min-height: 24px !important;
  height: 24px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  background: rgba(56, 189, 248, 0.12) !important;
  color: #38bdf8 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
}
.btn-tac-vu-nhanh:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  transform: translateY(-1px) !important;
  color: #ffffff !important;
}

/* 4. QUY HOẠCH FLOATING ELEMENTS: TRIỆT TIÊU TOÀN BỘ NÚT RÁC MÉP PHẢI */
#kim-xang-root,
.kim-xang-wrap:not(.capsule-kim-xang-wrap),
#gop-y-lazy-trigger,
button#gop-y-lazy-trigger {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 5. DẢI QUICK PROMPT ACCORDION (COLLAPSIBLE / EXPANDABLE) */
.prompt-chips-accordion {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  margin-bottom: 2px !important;
}
.prompt-toggle-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 2px 4px !important;
}
.btn-toggle-prompts {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 3px 10px !important;
  min-height: 26px !important;
  height: 26px !important;
  border-radius: 13px !important;
  background: rgba(56, 189, 248, 0.12) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  color: #38bdf8 !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: all 0.15s ease !important;
}
.btn-toggle-prompts:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: #38bdf8 !important;
}
#thanh-prompt-chips.da-thu-gon {
  max-height: 0 !important;
  opacity: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  transition: max-height 0.2s ease, opacity 0.15s ease, padding 0.15s ease !important;
}
#thanh-prompt-chips.dang-mo-rong {
  max-height: 48px !important;
  opacity: 1 !important;
  padding: 4px 6px !important;
  overflow-x: auto !important;
  pointer-events: auto !important;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease !important;
}
.chip-item.chip-thu-gon {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}
.chip-item.chip-thu-gon:hover {
  background: rgba(148, 163, 184, 0.3) !important;
  color: #f8fafc !important;
}

/* 6. MENU ICON CHUẨN APPLE HIG */
#btn-ve-the-gioi-top,
#btn-mo-drawer-tro-ly,
#btn-ghe-truoc,
#btn-ghe-sau,
#btn-term-font-down,
#btn-term-font-up,
#btn-term-chep,
#btn-topbar-theme,
#btn-thao-tac-nhanh-topbar,
#btn-menu-thanh-dau-them,
#btn-mo-drawer-chi-tiet,
.btn-dieu-huong-ghe {
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  touch-action: manipulation !important;
  transition: all 0.15s ease !important;
}
#btn-ve-the-gioi-top:hover,
#btn-mo-drawer-tro-ly:hover,
#btn-ghe-truoc:hover,
#btn-ghe-sau:hover,
#btn-term-font-down:hover,
#btn-term-font-up:hover,
#btn-term-chep:hover,
#btn-topbar-theme:hover,
#btn-thao-tac-nhanh-topbar:hover,
#btn-menu-thanh-dau-them:hover,
#btn-mo-drawer-chi-tiet:hover,
.btn-dieu-huong-ghe:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
  transform: translateY(-1px) !important;
}

/* 7. TAY NẮM KẸP MÉP PHẢI (RIGHT DOCK HANDLE): TINH GỌN, THANH THOÁT, MỎNG NHẸ */
.tay-nam-mo-ke-phai,
#tay-nam-mo-ke-phai {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: fixed !important;
  right: 0 !important;
  top: 220px !important;
  width: 28px !important;
  min-width: 28px !important;
  height: 44px !important;
  min-height: 44px !important;
  border-radius: 8px 0 0 8px !important;
  background: rgba(14, 165, 233, 0.45) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  border-right: none !important;
  color: #ffffff !important;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.3) !important;
  z-index: 1000 !important;
  cursor: pointer !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  touch-action: manipulation !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}

/* Chuẩn Fitts's Law >= 44px qua vùng chạm ảo */
.tay-nam-mo-ke-phai::after,
#tay-nam-mo-ke-phai::after {
  content: '' !important;
  position: absolute !important;
  top: 50% !important;
  right: 0 !important;
  transform: translateY(-50%) !important;
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  pointer-events: auto !important;
}

.tay-nam-mo-ke-phai:hover {
  transform: translateX(-3px) !important;
  background: rgba(14, 165, 233, 0.8) !important;
  filter: brightness(1.15) !important;
}

body.ke-phai-mo .tay-nam-mo-ke-phai,
body.drawer-dang-mo .tay-nam-mo-ke-phai,
.cot-danh-sach.drawer-mo ~ .tay-nam-mo-ke-phai,
.ke-phai-container.mo ~ .tay-nam-mo-ke-phai {
  display: none !important;
}

/* NÚT KỆ PHẢI TRÊN TOPBAR HÀI HÒA CẠNH THEME 🎨 */
#btn-mo-ke-phai,
html body #btn-mo-ke-phai,
.btn-mo-ke-phai-top {
  min-width: 44px !important;
  min-height: 44px !important;
  height: 44px !important;
  padding: 0 10px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #38bdf8 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: all 0.15s ease !important;
}

#btn-mo-ke-phai:hover,
.btn-mo-ke-phai-top:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

#badge-ke-phai-top {
  background: #38bdf8 !important;
  color: #0f172a !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  min-width: 16px !important;
  height: 16px !important;
  padding: 0 4px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

/* 8. APPLE GLASSMORPHISM CHO RIGHT SIDEBAR & 4 TABS (WO-DU-PHONG-SPLIT-VIEW-AND-JACK-HOTFIXES) */
#ke-phai-container.mo,
.ke-phai-container.mo {
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(28px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
  border-left: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.08) !important;
  color: #0f172a !important;
}
.ke-phai-nav-tabs {
  display: flex !important;
  background: rgba(248, 250, 252, 0.88) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  padding: 6px 8px !important;
  gap: 6px !important;
}
.ke-phai-tab-btn {
  flex: 1 1 0 !important;
  min-height: 38px !important;
  height: 38px !important;
  border-radius: 9px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.ke-phai-tab-btn:hover {
  color: #0f172a !important;
  background: rgba(15, 23, 42, 0.04) !important;
}
.ke-phai-tab-btn.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  font-weight: 700 !important;
  border: 1px solid rgba(2, 132, 199, 0.2) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(2, 132, 199, 0.08) !important;
}



/* ==========================================================================
   MARKDOWN TYPOGRAPHY & HIGH CONTRAST (WO-EXECUTIVE-READABILITY-PERFECTION)
   ========================================================================== */
.noi-dung-markdown-wrap {
  font-size: 14px !important;
  line-height: 1.65 !important;
  color: inherit !important;
}
.noi-dung-markdown-wrap h1, 
.noi-dung-markdown-wrap h2, 
.noi-dung-markdown-wrap h3, 
.noi-dung-markdown-wrap h4 {
  color: #0284c7 !important;
  font-weight: 800 !important;
  margin: 10px 0 6px 0 !important;
  letter-spacing: -0.01em !important;
}
.noi-dung-markdown-wrap h1 { font-size: 16px !important; }
.noi-dung-markdown-wrap h2 { font-size: 15px !important; }
.noi-dung-markdown-wrap h3 { font-size: 14.5px !important; }
.noi-dung-markdown-wrap strong {
  font-weight: 800 !important;
  color: inherit !important;
}
.noi-dung-markdown-wrap ul, 
.noi-dung-markdown-wrap ol {
  margin: 6px 0 !important;
  padding-left: 22px !important;
}
.noi-dung-markdown-wrap li {
  margin: 4px 0 !important;
  line-height: 1.55 !important;
  color: inherit !important;
}
.noi-dung-markdown-wrap li::marker {
  color: #0284c7 !important;
  font-weight: bold !important;
}
/* Format màu sắc chuẩn cho nội dung log & markdown trong buồng trò chuyện */
.dong-terminal {
  font-size: 13.5px !important;
  line-height: 1.55 !important;
}

/* Khi khung terminal ở nền tối (#090d16 / #0b0f19) */
#danh-sach-dong-terminal .dong-terminal,
#man-hinh-terminal .dong-terminal,
.dong-chi-tiet-day-du,
.dong-code-gap {
  color: #f1f5f9 !important;
  background: transparent !important;
}

.dong-chi-tiet-day-du .dong-code-gap {
  background: rgba(15, 23, 42, 0.75) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(56, 189, 248, 0.15) !important;
  padding: 6px 10px !important;
  margin: 4px 0 !important;
  border-radius: 6px !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

/* Markdown bên trong terminal nền tối */
#danh-sach-dong-terminal .noi-dung-markdown-wrap,
#man-hinh-terminal .noi-dung-markdown-wrap {
  color: #f8fafc !important;
}
#danh-sach-dong-terminal .noi-dung-markdown-wrap strong,
#man-hinh-terminal .noi-dung-markdown-wrap strong {
  color: #38bdf8 !important;
  font-weight: 700 !important;
}
#danh-sach-dong-terminal .noi-dung-markdown-wrap h1,
#danh-sach-dong-terminal .noi-dung-markdown-wrap h2,
#danh-sach-dong-terminal .noi-dung-markdown-wrap h3,
#danh-sach-dong-terminal .noi-dung-markdown-wrap h4,
#man-hinh-terminal .noi-dung-markdown-wrap h1,
#man-hinh-terminal .noi-dung-markdown-wrap h2,
#man-hinh-terminal .noi-dung-markdown-wrap h3,
#man-hinh-terminal .noi-dung-markdown-wrap h4 {
  color: #38bdf8 !important;
  font-weight: 700 !important;
}
#danh-sach-dong-terminal .noi-dung-markdown-wrap li,
#man-hinh-terminal .noi-dung-markdown-wrap li {
  color: #cbd5e1 !important;
}
#danh-sach-dong-terminal .noi-dung-markdown-wrap code,
#man-hinh-terminal .noi-dung-markdown-wrap code {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

/* ==========================================================================
   JACK TABLET FEEDBACK FIXES (9 ĐIỂM KHOANH ĐỎ - WO-DU-PHONG-UX-OVERHAUL)
   ========================================================================== */

/* 1. KHẮC PHỤC TRIỆT ĐỂ LỖI KỆ PHẢI KHÔNG MỞ RA (VẤN ĐỀ 6) */
#ke-phai-container.mo,
.ke-phai-container.mo {
  transform: translateX(0) !important;
  visibility: visible !important;
  display: flex !important;
  z-index: 1200 !important;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45) !important;
  pointer-events: auto !important;
}

/* 2. CHỮA LỖI MÙ MÀU & MẤT TƯƠNG PHẢN CỘT TRÁI (VẤN ĐỀ 3) */
.cot-danh-sach,
#hang-the-trang-doc,
.khung-doc-va-the-wrap .hang-the-trang-doc {
  background: #f8fafc !important;
  border-right: 1px solid #cbd5e1 !important;
}
.hang-the-trang-doc .the-trang-item,
.cot-danh-sach .the-trang-item,
.the-danh-sach-ghe {
  color: #0f172a !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
  font-weight: 600 !important;
}
.hang-the-trang-doc .the-trang-item:hover,
.the-danh-sach-ghe:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}
.hang-the-trang-doc .the-trang-item.dang-chon,
.hang-the-trang-doc .the-trang-item.active,
.the-danh-sach-ghe.dang-chon {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
}
.the-trang-item .the-trang-ten,
.the-danh-sach-ghe .ten-ghe {
  color: inherit !important;
  font-weight: 700 !important;
}
.the-trang-item .the-trang-phu,
.the-danh-sach-ghe .mo-ta-ghe {
  color: #475569 !important;
}
.the-trang-item.dang-chon .the-trang-phu,
.the-danh-sach-ghe.dang-chon .mo-ta-ghe {
  color: #e0f2fe !important;
}

/* 3. Ô NHẬP PROMPT TỰ CO GIÃN & NÚT PHÓNG TO TOÀN DIỆN (VẤN ĐỀ 4) */
#nhap-tin-hoi-thoai.o-nhap-tin-cuoc {
  min-height: 52px !important;
  max-height: 220px !important;
  line-height: 1.5 !important;
  font-size: 14px !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}
#nhap-tin-hoi-thoai.o-nhap-tin-cuoc:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2) !important;
  outline: none !important;
}
#nhap-tin-hoi-thoai.o-nhap-tin-cuoc.toan-man-mo {
  min-height: 180px !important;
  height: 240px !important;
}

/* 4. CỤM NÚT HÀNH ĐỘNG GÓC DƯỚI PHẢI CHUẨN APPLE HIG (VẤN ĐỀ 5) */
.thanh-hanh-dong-nhap {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding: 8px 4px 4px 4px !important;
}
.cong-cu-nhap-nhom {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.cong-cu-nhap-nhom .btn-cong-cu {
  min-height: 40px !important;
  height: 40px !important;
  padding: 0 12px !important;
  border-radius: 20px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: all 0.15s ease !important;
}
.cong-cu-nhap-nhom .btn-cong-cu:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
.nut-gui-nhom {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.nut-gui-nhom #btn-gui-tin-nhan {
  min-height: 40px !important;
  height: 40px !important;
  padding: 0 18px !important;
  border-radius: 20px !important;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: all 0.15s ease !important;
}
.nut-gui-nhom #btn-gui-tin-nhan:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45) !important;
}
.nut-gui-nhom #btn-huy-giao-viec {
  min-height: 40px !important;
  height: 40px !important;
  padding: 0 14px !important;
  border-radius: 20px !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #64748b !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}

/* 5. TỐI ƯU HÓA ĐẶC BIỆT CHO MÀN HÌNH MOBILE (<= 640px) */
@media (max-width: 640px) {
  .khung-nhap-tin,
  .hang-nhap-tuy-bien-cuoc {
    padding: 6px 8px !important;
  }
  .thanh-hanh-dong-nhap {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .cong-cu-nhap-nhom {
    gap: 4px !important;
  }
  .cong-cu-nhap-nhom .btn-cong-cu {
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }
  .nut-gui-nhom {
    margin-left: auto !important;
  }
  .nut-gui-nhom #btn-gui-tin-nhan {
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 16px !important;
    font-size: 12.5px !important;
  }
  .nut-gui-nhom #btn-huy-giao-viec {
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }
  /* Tay nắm Kệ Phải trên mobile gọn gàng không che nội dung */
  .tay-nam-mo-ke-phai,
  #tay-nam-mo-ke-phai {
    top: 96px !important;
    height: 38px !important;
    min-height: 38px !important;
    width: 24px !important;
    font-size: 12px !important;
  }
}


/* ==========================================================================
   WO-DU-PHONG-THEME-TRANG-VA-KE-PHAI-RESIZE:
   THEME SÁNG MẶC ĐỊNH & ĐỘ TƯƠNG PHẢN WCAG AAA CHUẨN APPLE
   ========================================================================== */

/* 1. NỀN VÀ KHUNG GIAO DIỆN THEME SÁNG (MẶC ĐỊNH KHI CHƯA CÓ HOẶC LÀ LIGHT) */
html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]),
body:not(.theme-space):not(.theme-cyber):not(.theme-glass):not(.theme-obsidian):not(.theme-dark):not(.theme-toi),
[data-theme="light"],
[data-theme="sang"],
body.theme-light,
body.theme-sang {
  --bg: #ffffff !important;
  --canvas: #f8fafc !important;
  --paper: #ffffff !important;
  --card-bg: #ffffff !important;
  --text: #0f172a !important;
  --text-main: #0f172a !important;
  --ink: #0f172a !important;
  --ink-secondary: #334155 !important;
  --text-muted: #334155 !important;
  --card-border: #cbd5e1 !important;
  --primary: #0284c7 !important;
  --primary-hover: #0369a1 !important;
  background: #f8fafc !important;
  color: #0f172a !important;
}

/* Thân trang và các cột chính trong Theme Sáng */
html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) body,
[data-theme="light"] body,
body.theme-light {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) .cot-danh-sach,
[data-theme="light"] .cot-danh-sach,
body.theme-light .cot-danh-sach {
  background: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) .cot-noi-dung,
[data-theme="light"] .cot-noi-dung,
body.theme-light .cot-noi-dung {
  background: #f8fafc !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) #thanh-dau-doc-cuoc,
[data-theme="light"] #thanh-dau-doc-cuoc,
body.theme-light #thanh-dau-doc-cuoc {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) #thanh-dau-ten-ghe,
[data-theme="light"] #thanh-dau-ten-ghe,
body.theme-light #thanh-dau-ten-ghe {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) #thanh-dau-lan-cuoi,
[data-theme="light"] #thanh-dau-lan-cuoi,
body.theme-light #thanh-dau-lan-cuoi {
  color: #475569 !important;
}

/* 2. ĐỘ TƯƠNG PHẢN WCAG AAA CHO CÁC CHIP PHÂN LOẠI & THANH TÌM KIẾM (KHOANH ĐỎ SỐ 2 CỦA JACK) */
.tabs-gom-nhom,
html body .tabs-gom-nhom {
  background: #e2e8f0 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 4px !important;
  gap: 6px !important;
}

/* Tab không chọn (Inactive): chữ xám đậm #334155 (tương phản 9.4:1), viền định hình sắc nét */
.tab-gom,
html body .tab-gom {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  transition: all 0.15s ease !important;
}

.tab-gom:hover,
html body .tab-gom:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

/* Tab đang chọn (Active): Nền xanh sâu #0284c7, chữ trắng tinh khiết #ffffff, bóng nổi sắc nét */
.tab-gom.dang-chon,
.tab-gom.active,
html body .tab-gom.dang-chon,
html body .tab-gom.active {
  background: #0284c7 !important;
  border: 1px solid #0369a1 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35) !important;
}

/* Ô tìm kiếm trợ lý: Viền định hình #94a3b8 rõ nét, chữ đen đậm #0f172a */
#tim-cuoc-tro-chuyen,
.o-tim-kiem-cuoc,
html body #tim-cuoc-tro-chuyen {
  background: #ffffff !important;
  border: 1.5px solid #94a3b8 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

#tim-cuoc-tro-chuyen:focus,
html body #tim-cuoc-tro-chuyen:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2) !important;
  outline: none !important;
}

/* Thẻ nhóm (Ban Điều Phối, Hạm Đội Dev Fleet, Trợ Lý Khác): Nền trắng tinh khiết, viền 1px, chữ đen #0f172a */
html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) .nhom-tieu-de-bar,
[data-theme="light"] .nhom-tieu-de-bar,
body.theme-light .nhom-tieu-de-bar {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) .nhom-ten-chu,
[data-theme="light"] .nhom-ten-chu,
body.theme-light .nhom-ten-chu {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]) .nhom-so-phien,
[data-theme="light"] .nhom-so-phien,
body.theme-light .nhom-so-phien {
  background: #f1f5f9 !important;
  color: #475569 !important;
  font-weight: 700 !important;
  border: 1px solid #e2e8f0 !important;
}

/* 3. KHÔI PHỤC VÀ TỐI ƯU KỆ PHẢI (RESIZE PANEL / KHOANH ĐỎ SỐ 4 & BẢN ĐỒ CON) */
#ke-phai-container,
.ke-phai-container {
  width: var(--ke-phai-chieu-rong, 380px) !important;
  min-width: 320px !important;
  max-width: min(850px, calc(100vw - 420px)) !important;
  background: #ffffff !important;
  border-left: 1px solid #cbd5e1 !important;
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.08) !important;
  color: #0f172a !important;
}

/* Header Kệ Phải */
.ke-phai-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.ke-phai-tieu-de {
  color: #0f172a !important;
  font-weight: 800 !important;
}

.ke-phai-so-luong {
  color: #475569 !important;
  font-weight: 600 !important;
}

/* Nav tabs bên trong Kệ Phải */
.ke-phai-nav-tabs,
html body .ke-phai-nav-tabs {
  display: flex !important;
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  padding: 6px 8px !important;
  gap: 6px !important;
}

.ke-phai-tab-btn,
html body .ke-phai-tab-btn {
  flex: 1 1 0 !important;
  min-height: 38px !important;
  height: 38px !important;
  border-radius: 8px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.ke-phai-tab-btn:hover,
html body .ke-phai-tab-btn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

.ke-phai-tab-btn.active,
html body .ke-phai-tab-btn.active {
  background: #0284c7 !important;
  border-color: #0369a1 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

/* Nút bấm Kệ Phải trên Topbar nổi bật rõ nét */
#btn-mo-ke-phai,
.btn-mo-ke-phai-top {
  background: #0284c7 !important;
  border: 1px solid #0369a1 !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

#btn-mo-ke-phai:hover,
.btn-mo-ke-phai-top:hover {
  background: #0369a1 !important;
}

.badge-ke-phai-top {
  background: #ffffff !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
}

/* Mép kéo co giãn mượt mà từ 320px đến 800px */
.mep-keo-ke-phai,
#mep-keo-ke-phai {
  position: absolute !important;
  top: 0 !important;
  left: -4px !important;
  width: 8px !important;
  height: 100% !important;
  cursor: col-resize !important;
  background: transparent !important;
  z-index: 1210 !important;
  touch-action: none !important;
  transition: background 0.15s ease !important;
}

.mep-keo-ke-phai:hover,
.mep-keo-ke-phai.dang-keo-mep {
  background: rgba(2, 132, 199, 0.4) !important;
}

/* Tách biệt rõ ràng tay nắm Kệ Phải mép phải, không đè lên thanh tab trên mobile (media_1790039505397.jpg) */
@media (max-width: 640px) {
  .tay-nam-mo-ke-phai,
  #tay-nam-mo-ke-phai {
    top: 150px !important;
    right: 0 !important;
    z-index: 150 !important;
  }
}
@media (min-width: 641px) {
  .tay-nam-mo-ke-phai,
  #tay-nam-mo-ke-phai {
    top: 180px !important;
    right: 0 !important;
    z-index: 150 !important;
  }
}

/* 4. FLUID GRID KHI KỆ PHẢI MỞ (CHUẨN SLIDE-OVER OVERLAY, KHÔNG BAO GIỜ BỊ BÓP NÉN) */
body.ke-phai-mo:not(.ke-phai-toan-man) .khung-hoi-thoai-grid,
html body.ke-phai-mo:not(.ke-phai-toan-man) #khung-hoi-thoai-grid {
  right: 0 !important;
  width: 100% !important;
}

body.ke-phai-mo:not(.ke-phai-toan-man) #khung-nhap-tin-cuoc,
html body.ke-phai-mo:not(.ke-phai-toan-man) .khung-nhap-tin {
  right: 0 !important;
  width: auto !important;
}


/* FIX CHO ẢNH BÚT TÍCH media_1790039505397.jpg:
   Tách biệt hoàn toàn tay nắm Kệ Phải mép phải, không được để đè lên thanh tab */
@media (max-width: 640px) {
  .tay-nam-mo-ke-phai,
  #tay-nam-mo-ke-phai,
  html body .tay-nam-mo-ke-phai {
    display: none !important;
  }
}


/* ==========================================================================
   WO-DU-PHONG-THEME-TRANG-VA-KE-PHAI-RESIZE (CHỈ ĐẠO BỔ SUNG TỪ JACK 08:27)
   1. CHUẨN HÓA CỤM NÚT TOPBAR PHẢI THEO APPLE CAPSULE HUD (ĐIỂM 3)
   2. 6 THEME VĂN HÓA SỐNG ĐỘNG ĐỒNG BỘ TOÀN CẢNH (ĐIỂM 2)
   3. KHỐI TÓM TẮT VISUAL DIGEST TƯƠNG THÍCH THEME SÁNG (ĐIỂM 1)
   ========================================================================== */

/* 1. CHUẨN HÓA CỤM NÚT TOPBAR BÊN PHẢI (APPLE CAPSULE HUD) */
.thanh-dau-phai {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Chuẩn hóa nút Kệ Phải, Theme, Thao Tác Nhanh, Bức Tranh cùng chiều cao 36px, viền và bóng đổ đồng điệu */
#btn-mo-ke-phai,
.btn-mo-ke-phai-top,
#btn-topbar-theme,
#btn-thao-tac-nhanh-topbar,
#btn-mo-drawer-chi-tiet,
#btn-menu-thanh-dau-them,
.thanh-dau-phai .btn-dieu-huong-ghe {
  min-height: 36px !important;
  height: 36px !important;
  padding: 0 12px !important;
  border-radius: 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  touch-action: manipulation !important;
  transition: all 0.16s ease !important;
  box-sizing: border-box !important;
}

/* Nút Kệ Phải dạng Capsule rực rỡ */
#btn-mo-ke-phai,
.btn-mo-ke-phai-top {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

#btn-mo-ke-phai:hover,
.btn-mo-ke-phai-top:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.4) !important;
}

/* Badge số lượng trên Kệ Phải */
.badge-ke-phai-top {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 18px !important;
  height: 18px !important;
  padding: 0 5px !important;
  border-radius: 9px !important;
  background: #ffffff !important;
  color: #0284c7 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
}

/* Nút Theme, Thao tác nhanh, Bức tranh kính mờ Apple */
#btn-topbar-theme,
#btn-thao-tac-nhanh-topbar,
#btn-mo-drawer-chi-tiet,
#btn-menu-thanh-dau-them {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
}

#btn-topbar-theme:hover,
#btn-thao-tac-nhanh-topbar:hover,
#btn-mo-drawer-chi-tiet:hover,
#btn-menu-thanh-dau-them:hover {
  background: #ffffff !important;
  border-color: #94a3b8 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12) !important;
}

/* Khi ở theme tối, các nút tự động thích ứng kính mờ tối */
[data-theme="space"] #btn-topbar-theme,
[data-theme="space"] #btn-thao-tac-nhanh-topbar,
[data-theme="space"] #btn-mo-drawer-chi-tiet,
[data-theme="space"] #btn-menu-thanh-dau-them,
[data-theme="cyber"] #btn-topbar-theme,
[data-theme="cyber"] #btn-thao-tac-nhanh-topbar,
[data-theme="cyber"] #btn-mo-drawer-chi-tiet,
[data-theme="cyber"] #btn-menu-thanh-dau-them,
[data-theme="obsidian"] #btn-topbar-theme,
[data-theme="obsidian"] #btn-thao-tac-nhanh-topbar,
[data-theme="obsidian"] #btn-mo-drawer-chi-tiet,
[data-theme="obsidian"] #btn-menu-thanh-dau-them {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(71, 85, 105, 0.8) !important;
  color: #f8fafc !important;
}

/* 2. ĐỒNG BỘ 6 THEME VĂN HÓA (ĐÔNG SƠN, NEO-EDO, VEDIC, THỦY MẶC, OLYMPUS, SYNTHWAVE) */

/* Theme Đông Sơn (Việt Nam - Đồng Hoàng Gia) */
[data-theme="dong-son"], body.theme-dong-son {
  --bg: #1c150c !important;
  --paper: #281e11 !important;
  --card-bg: #281e11 !important;
  --text: #fef3c7 !important;
  --card-border: #b45309 !important;
  --primary: #d97706 !important;
  background: radial-gradient(circle at top right, rgba(217, 119, 6, 0.15), transparent 45%), #1c150c !important;
  color: #fef3c7 !important;
}
[data-theme="dong-son"] .cot-danh-sach,
[data-theme="dong-son"] .cot-noi-dung,
[data-theme="dong-son"] #thanh-dau-doc-cuoc,
[data-theme="dong-son"] #ke-phai-container {
  background: #281e11 !important;
  border-color: #78350f !important;
  color: #fef3c7 !important;
}

/* Theme Neo-Edo (Nhật Bản - Đỏ Torii & Mực Sumi-e) */
[data-theme="neo-edo"], body.theme-neo-edo {
  --bg: #181113 !important;
  --paper: #241619 !important;
  --card-bg: #241619 !important;
  --text: #ffe4e6 !important;
  --card-border: #e11d48 !important;
  --primary: #e11d48 !important;
  background: radial-gradient(circle at top, rgba(225, 29, 72, 0.15), transparent 45%), #181113 !important;
  color: #ffe4e6 !important;
}
[data-theme="neo-edo"] .cot-danh-sach,
[data-theme="neo-edo"] .cot-noi-dung,
[data-theme="neo-edo"] #thanh-dau-doc-cuoc,
[data-theme="neo-edo"] #ke-phai-container {
  background: #241619 !important;
  border-color: #881337 !important;
  color: #ffe4e6 !important;
}

/* Theme Vedic (Ấn Độ - Saffron & Tím Mandala) */
[data-theme="vedic"], body.theme-vedic {
  --bg: #160d24 !important;
  --paper: #211337 !important;
  --card-bg: #211337 !important;
  --text: #fae8ff !important;
  --card-border: #9333ea !important;
  --primary: #c026d3 !important;
  background: radial-gradient(circle at top right, rgba(192, 38, 211, 0.15), transparent 45%), #160d24 !important;
  color: #fae8ff !important;
}
[data-theme="vedic"] .cot-danh-sach,
[data-theme="vedic"] .cot-noi-dung,
[data-theme="vedic"] #thanh-dau-doc-cuoc,
[data-theme="vedic"] #ke-phai-container {
  background: #211337 !important;
  border-color: #581c87 !important;
  color: #fae8ff !important;
}

/* Theme Thủy Mặc (Trung Hoa - Jade Ngọc Bích) */
[data-theme="thuy-mac"], body.theme-thuy-mac {
  --bg: #0b1714 !important;
  --paper: #122420 !important;
  --card-bg: #122420 !important;
  --text: #dcfce7 !important;
  --card-border: #059669 !important;
  --primary: #10b981 !important;
  background: radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.15), transparent 45%), #0b1714 !important;
  color: #dcfce7 !important;
}
[data-theme="thuy-mac"] .cot-danh-sach,
[data-theme="thuy-mac"] .cot-noi-dung,
[data-theme="thuy-mac"] #thanh-dau-doc-cuoc,
[data-theme="thuy-mac"] #ke-phai-container {
  background: #122420 !important;
  border-color: #064e3b !important;
  color: #dcfce7 !important;
}

/* Theme Olympus (Hy Lạp - Biển Aegean) */
[data-theme="olympus"], body.theme-olympus {
  --bg: #0c1829 !important;
  --paper: #13253e !important;
  --card-bg: #13253e !important;
  --text: #e0f2fe !important;
  --card-border: #0284c7 !important;
  --primary: #38bdf8 !important;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.15), transparent 45%), #0c1829 !important;
  color: #e0f2fe !important;
}
[data-theme="olympus"] .cot-danh-sach,
[data-theme="olympus"] .cot-noi-dung,
[data-theme="olympus"] #thanh-dau-doc-cuoc,
[data-theme="olympus"] #ke-phai-container {
  background: #13253e !important;
  border-color: #0c4a6e !important;
  color: #e0f2fe !important;
}

/* Theme Synthwave (Âu Mỹ - Kính Mờ Neon) */
[data-theme="synthwave"], body.theme-synthwave {
  --bg: #130924 !important;
  --paper: #1f1038 !important;
  --card-bg: #1f1038 !important;
  --text: #f5d0fe !important;
  --card-border: #f43f5e !important;
  --primary: #d946ef !important;
  background: radial-gradient(circle at top right, rgba(217, 70, 239, 0.18), transparent 45%), #130924 !important;
  color: #f5d0fe !important;
}
[data-theme="synthwave"] .cot-danh-sach,
[data-theme="synthwave"] .cot-noi-dung,
[data-theme="synthwave"] #thanh-dau-doc-cuoc,
[data-theme="synthwave"] #ke-phai-container {
  background: #1f1038 !important;
  border-color: #831843 !important;
  color: #f5d0fe !important;
}

/* 3. KHỐI TÓM TẮT & FLOWCHART TRỰC QUAN TRÊN THEME SÁNG */
html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]):not([data-theme="dong-son"]):not([data-theme="neo-edo"]):not([data-theme="vedic"]):not([data-theme="thuy-mac"]):not([data-theme="olympus"]):not([data-theme="synthwave"]) #danh-sach-dong-terminal,
[data-theme="light"] #danh-sach-dong-terminal,
body.theme-light #danh-sach-dong-terminal {
  background: #f8fafc !important;
  color: #0f172a !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]):not([data-theme="dong-son"]):not([data-theme="neo-edo"]):not([data-theme="vedic"]):not([data-theme="thuy-mac"]):not([data-theme="olympus"]):not([data-theme="synthwave"]) .visual-artifact-container,
[data-theme="light"] .visual-artifact-container,
body.theme-light .visual-artifact-container {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
}

html:not([data-theme="space"]):not([data-theme="cyber"]):not([data-theme="glass"]):not([data-theme="obsidian"]):not([data-theme="dark"]):not([data-theme="toi"]):not([data-theme="dong-son"]):not([data-theme="neo-edo"]):not([data-theme="vedic"]):not([data-theme="thuy-mac"]):not([data-theme="olympus"]):not([data-theme="synthwave"]) .pipeline-step-card,
[data-theme="light"] .pipeline-step-card,
body.theme-light .pipeline-step-card {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

/* ==========================================================================
   A8. PHÂN CẤP NHẬN THỨC & MÀU ƯU TIÊN CHO SESSION TABS (media_1790040694463.jpg)
   Xóa bỏ thiết kế tất cả các tab màu xám xịt như nhau.
   ========================================================================== */

/* Badge P0 / P1 nhỏ nhắn trên góc tab */
.tab-badge-priority {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 9.5px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  padding: 2px 4px !important;
  border-radius: 4px !important;
  letter-spacing: 0.04em !important;
  flex-shrink: 0 !important;
}

.tab-badge-priority.p0-badge {
  background: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6) !important;
  animation: p0-pulse 2s infinite ease-in-out !important;
}

.tab-badge-priority.p1-badge {
  background: #f59e0b !important;
  color: #ffffff !important;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.4) !important;
}

@keyframes p0-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
  50% { transform: scale(1.06); box-shadow: 0 0 10px rgba(239, 68, 68, 0.9); }
}

/* Role Badges: Điều phối, Thợ, Kiểm tra, Kiến trúc */
.the-trang-role-badge {
  display: inline-block !important;
  font-size: 9px !important;
  font-weight: 800 !important;
  padding: 1px 4px !important;
  border-radius: 3px !important;
  margin-right: 4px !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
}

.the-trang-role-badge.tab-role-orchestrator {
  background: rgba(147, 51, 234, 0.15) !important;
  color: #7e22ce !important;
  border: 1px solid rgba(147, 51, 234, 0.3) !important;
}

.the-trang-role-badge.tab-role-dev {
  background: rgba(2, 132, 199, 0.12) !important;
  color: #0369a1 !important;
  border: 1px solid rgba(2, 132, 199, 0.25) !important;
}

.the-trang-role-badge.tab-role-tester {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #b91c1c !important;
  border: 1px solid rgba(220, 38, 38, 0.25) !important;
}

.the-trang-role-badge.tab-role-architect {
  background: rgba(225, 29, 72, 0.12) !important;
  color: #be123c !important;
  border: 1px solid rgba(225, 29, 72, 0.25) !important;
}

/* Đèn LED nhịp thở theo trạng thái sống */
.tab-led-pulse {
  position: relative !important;
}
.tab-led-pulse.tt-dang-chay::after,
.tab-led-pulse.tt-dang-lam::after {
  content: "" !important;
  position: absolute !important;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: 50% !important;
  background: inherit !important;
  opacity: 0.6 !important;
  animation: led-breathe 1.8s infinite ease-out !important;
}

@keyframes led-breathe {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Styling cho từng cấp độ Priority của Thẻ Trang */
/* P0: Khẩn cấp / Chờ Jack / Cần duyệt */
html body #hang-the-trang-doc .the-trang-item.tab-priority-p0 {
  border-color: #f87171 !important;
  background: #fef2f2 !important;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.18) !important;
}
html body #hang-the-trang-doc .the-trang-item.tab-priority-p0:hover {
  border-color: #ef4444 !important;
  background: #fee2e2 !important;
}

/* P1: Đang thi công tích cực */
html body #hang-the-trang-doc .the-trang-item.tab-priority-p1 {
  border-color: #fcd34d !important;
  background: #fffbeb !important;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.15) !important;
}
html body #hang-the-trang-doc .the-trang-item.tab-priority-p1:hover {
  border-color: #f59e0b !important;
}

/* Idle / Ngủ đông: Nền nhạt, độ tương phản dịu mắt để nhường sự chú ý */
html body #hang-the-trang-doc .the-trang-item.tab-priority-idle {
  opacity: 0.72 !important;
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}
html body #hang-the-trang-doc .the-trang-item.tab-priority-idle:hover {
  opacity: 1 !important;
  border-color: #cbd5e1 !important;
}

/* TAB ACTIVE (ĐANG CHỌN) — NỔI BẬT NHẤT */
html body #hang-the-trang-doc .the-trang-item.dang-chon,
html body #hang-the-trang-doc .the-trang-item.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35) !important;
}

html body #hang-the-trang-doc .the-trang-item.dang-chon .the-trang-ten,
html body #hang-the-trang-doc .the-trang-item.active .the-trang-ten {
  color: #ffffff !important;
}

html body #hang-the-trang-doc .the-trang-item.dang-chon .the-trang-role-badge,
html body #hang-the-trang-doc .the-trang-item.active .the-trang-role-badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

/* ==========================================================================
   A9. THẾ GIỚI SỐNG GIỮA CÁC AGENTS (LIVING AGENTS ECOSYSTEM)
   Mascot Nuance toàn thân, bóng thở mềm mại, không hộp cắt cụt.
   ========================================================================== */
.agent-mascot-breathing {
  animation: mascot-breathe 3.5s infinite ease-in-out !important;
  transform-origin: bottom center !important;
}

@keyframes mascot-breathe {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-1.5px) scale(1.02);
  }
}

/* Hiệu ứng tương tác sống (living spatial pulse) khi chuyển giao hoặc nhấp */
.agent-handoff-pulse {
  animation: handoff-glow 0.8s ease-out !important;
}

@keyframes handoff-glow {
  0% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(2, 132, 199, 0); }
  100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

/* ==========================================================================
   A10. TOPOLOGY FLOW GRAPH & PULSE LINES (media_1790041200000.jpg)
   Sơ đồ mạng lưới hình học có luồng dữ liệu xung nhịp chạy liên tục
   ========================================================================== */
@keyframes pulseLine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

@keyframes activeNodeGlow {
  0%, 100% {
    box-shadow: 0 0 14px rgba(2, 132, 199, 0.45);
    border-color: #38bdf8;
  }
  50% {
    box-shadow: 0 0 22px rgba(2, 132, 199, 0.85);
    border-color: #60a5fa;
  }
}

/* ==========================================================================
   QUÉT SẠCH 5 CỤM LỖI UI/UX KHOANH ĐỎ TỪ JACK (media_1790041490767.jpg)
   ========================================================================== */

/* CỤM 1: CHIP THÔNG TIN VÀ NÚT THU GỌN SIDEBAR */
.dem-so-ghe-badge,
html body #dem-so-ghe,
html body .dem-so-ghe-badge {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
}

#btn-toggle-sidebar-gap,
.btn-toggle-sidebar {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.15s ease !important;
}
#btn-toggle-sidebar-gap:hover,
.btn-toggle-sidebar:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

/* CỤM 2: DẢI TAB NGANG (#thanh-che-do-xem) CHUYỂN SANG NỀN KÍNH MỜ SÁNG APPLE */
#thanh-che-do-xem,
html body #thanh-che-do-xem,
.thanh-che-do-xem {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

#bo-chuyen-tang-tin,
.bo-chuyen-tang-tin.segmented-control-bar,
html body #thanh-che-do-xem .segmented-control-bar {
  background: #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 2px !important;
  gap: 2px !important;
  border: 1px solid #cbd5e1 !important;
}

html body #thanh-che-do-xem .nut-tang-tin {
  background: transparent !important;
  color: #475569 !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  border: none !important;
  padding: 4px 12px !important;
  min-height: 28px !important;
  height: 28px !important;
  transition: all 0.15s ease !important;
}

html body #thanh-che-do-xem .nut-tang-tin:hover {
  color: #0f172a !important;
  background: rgba(255, 255, 255, 0.6) !important;
}

html body #thanh-che-do-xem .nut-tang-tin.tang-active {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.35) !important;
}

/* 2 nút icon bên phải của dải tab (#btn-xem-lai-so, #btn-chuyen-buc-tranh-3-tang) */
html body #btn-xem-lai-so,
html body #btn-chuyen-buc-tranh-3-tang,
html body #thanh-che-do-xem .btn-che-do-phu-item {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  border-radius: 6px !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}
html body #btn-xem-lai-so:hover,
html body #btn-chuyen-buc-tranh-3-tang:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

/* CỤM 3: ẨN HOẶC CHUẨN HÓA CÁC NÚT ĐIỀU HƯỚNG CŨ RÁC TRÊN TOPBAR BÊN PHẢI */
.thanh-dau-phai .btn-dieu-huong-ghe:not(#btn-topbar-theme):not(#btn-mo-ke-phai):not(#btn-thao-tac-nhanh-topbar):not(#btn-mo-drawer-chi-tiet):not(#btn-menu-thanh-dau-them) {
  display: none !important;
}

/* CỤM 4: KHỐI HỎI AI NỀN TRẮNG SÁNG KÍNH MỜ APPLE */
#khung-hoi-ai-ke-phai,
.muc-ke-phai.muc-hoi-ai,
html body #khung-hoi-ai-ke-phai {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 14px !important;
  margin-bottom: 14px !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
  color: #0f172a !important;
}

#khung-hoi-ai-ke-phai h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

#o-hoi-ai-input,
html body #o-hoi-ai-input {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  border-radius: 8px !important;
  padding: 10px !important;
  font-size: 13px !important;
}
#o-hoi-ai-input:focus {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
  outline: none !important;
}

/* CỤM 5: CHUẨN HÓA KHỐI TRỢ LÝ Ở TAB INSPECTOR & KỆ PHẢI */
.ke-phai-inspector-hero,
html body .ke-phai-inspector-hero {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 14px 16px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.kp-insp-avatar-wrap,
html body .kp-insp-avatar-wrap {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  border-radius: 12px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
}

#kp-insp-ten {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin: 0 0 2px 0 !important;
}

#kp-insp-vai {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #64748b !important;
}

/* ==========================================================================
   PERFORMANCE & GPU ACCELERATION OPTIMIZATIONS (WO-DU-PHONG-UX-OVERHAUL-PERFECTION)
   - Layout & Paint containment for high FPS scrolling
   - will-change hardware layers for Whiteboard canvas & large panels
   - Translate3d transitions to avoid DOM reflow thrashing
   ========================================================================== */
#man-hinh-terminal,
#khung-tin-nhan,
.cot-noi-dung,
.khung-noi-dung-chinh {
  contain: content;
  -webkit-overflow-scrolling: touch;
}

#ke-phai-container {
  contain: layout style;
  will-change: transform;
}

#canvas-whiteboard-ke-phai,
#canvas-ve-tay-ke-phai {
  touch-action: none !important;
  will-change: transform;
  transform: translateZ(0);
}

.ke-phai-tab-view {
  contain: layout style;
}

/* ==========================================================================
   WO-DU-PHONG-FOLDER-TREE-AND-HORIZONTAL-TABS:
   1. HERO AGENT IDENTITY CARD (TOP BUỒNG ĐỌC)
   2. COLLAPSED SIDEBAR TOUCH TARGET & CENTERING FIX
   3. KỆ PHẢI FOLDER TREE ARTIFACTS & SNAPSHOTS
   4. FLOATING PINNED AGENT & FILE CAPSULE DOCK
   ========================================================================== */

/* 1. HERO AGENT IDENTITY CARD (SLIM COMPACT BAR) */
.hero-agent-card {
  display: none !important; /* Jack Feedback: Ẩn dải thẻ Hero thừa thải để Split-View áp sát đỉnh, tối đa hóa không gian nhìn */
}

.hero-agent-avatar-wrap {
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px !important;
  border-radius: 6px !important;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.1);
  position: relative;
}

.hero-agent-avatar-img {
  width: 22px !important;
  height: 22px !important;
  object-fit: contain;
}

.hero-agent-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 8px !important;
  height: 8px !important;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.6);
}

.hero-agent-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.hero-agent-meta-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0 !important;
  flex-shrink: 0;
}

.hero-agent-role-badge {
  font-size: 10px !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px !important;
  border-radius: 4px !important;
  background: #0284c7;
  color: #ffffff;
}

.hero-agent-tier-badge {
  font-size: 9.5px !important;
  font-weight: 700;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.hero-agent-title {
  font-size: 13px !important;
  font-weight: 800;
  color: #0f172a !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.hero-agent-desc {
  font-size: 11px !important;
  font-weight: 500;
  color: #64748b !important;
  margin-top: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.hero-agent-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-hero-pin {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0284c7;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
}
.btn-hero-pin:hover {
  background: #f0f9ff;
  border-color: #0284c7;
}

/* 2. SỬA LỖI COLLAPSED SIDEBAR KHÔNG BỊ BẸP NÚT (ẢNH media_1790047659974.jpg) */
.cot-danh-sach.da-gap {
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

.cot-danh-sach.da-gap .cot-danh-sach-top-bar {
  width: 100% !important;
  padding: 8px 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.cot-danh-sach.da-gap #btn-toggle-sidebar-gap,
.cot-danh-sach.da-gap .btn-toggle-sidebar {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 22px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08) !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

.cot-danh-sach.da-gap .danh-sach-the-cuoc {
  width: 100% !important;
  padding: 8px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
}

.cot-danh-sach.da-gap .the-cuoc {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  border-radius: 12px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  touch-action: manipulation !important;
}

.cot-danh-sach.da-gap .the-cuoc-avatar,
.cot-danh-sach.da-gap .the-cuoc-hang-chinh {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.cot-danh-sach.da-gap .the-cuoc-avatar img,
.cot-danh-sach.da-gap .the-cuoc-hang-chinh img {
  width: 36px !important;
  height: 36px !important;
  border-radius: 8px !important;
  object-fit: contain !important;
}

/* 3. FOLDER TREE KỆ PHẢI (RIGHT PANEL) */
.ke-phai-folder-tree-wrap {
  padding: 10px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  margin-bottom: 12px;
}

.tree-folder-group {
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.tree-folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f1f5f9;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e2e8f0;
}

.tree-folder-header:hover {
  background: #e2e8f0;
}

.tree-folder-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}

.tree-folder-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tree-folder-items {
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
}

.tree-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  font-size: 12px;
  transition: all 0.15s ease;
}

.tree-file-item:hover {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.tree-file-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 4. FLOATING PINNED AGENT & FILE CAPSULE DOCK */
.floating-capsule-dock {
  position: fixed;
  bottom: 88px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1200;
  pointer-events: none;
}

.floating-capsule-item {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid #0284c7;
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.25), 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  animation: capsuleFloatIn 0.3s ease-out;
}

.floating-capsule-item:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

.capsule-mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #0284c7;
}

.capsule-mini-text {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capsule-mini-close {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.capsule-mini-close:hover {
  background: #cbd5e1;
  color: #0f172a;
}

@keyframes capsuleFloatIn {
  from { opacity: 0; transform: translateY(10px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   FLOATING COMPANION AGENTS & COGNITIVE PRIORITY SYNC (JACK CHỈ ĐẠO)
   - Đồng bộ màu sắc P0 (đỏ neon), P1 (vàng), Idle (kính mờ) cả ở Cột Trái và Tabs
   - Floating Companion Agent (La Bàn / Thợ) có bóng thở 72 bpm & chat bubble
   ========================================================================== */

/* Thẻ cuộc cột trái đồng bộ màu sắc Priority */
html body .the-cuoc.the-priority-p0 {
  border-left: 4px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.15) !important;
}
html body .the-cuoc.the-priority-p0 .p0-badge {
  background: #ef4444 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border-radius: 4px !important;
  padding: 1px 6px !important;
  font-size: 10px !important;
}

html body .the-cuoc.the-priority-p1 {
  border-left: 4px solid #f59e0b !important;
  background: rgba(245, 158, 11, 0.08) !important;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.12) !important;
}
html body .the-cuoc.the-priority-p1 .p1-badge {
  background: #f59e0b !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border-radius: 4px !important;
  padding: 1px 6px !important;
  font-size: 10px !important;
}

html body .the-cuoc.the-priority-idle {
  opacity: 0.75 !important;
  background: rgba(148, 163, 184, 0.08) !important;
  border-left: 4px solid #cbd5e1 !important;
}

/* Vai trò (Role badges) đồng bộ */
.the-role-orchestrator, .tab-role-orchestrator {
  color: #7c3aed !important;
  border-color: #7c3aed !important;
}
.the-role-tester, .tab-role-tester {
  color: #ea580c !important;
  border-color: #ea580c !important;
}
.the-role-architect, .tab-role-architect {
  color: #db2777 !important;
  border-color: #db2777 !important;
}
.the-role-dev, .tab-role-dev {
  color: #0284c7 !important;
  border-color: #0284c7 !important;
}

/* Floating Companion Agent widget */
.floating-companion-agent {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1150;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
}

.floating-companion-agent:hover .companion-avatar-body {
  transform: scale(1.08);
}

.companion-avatar-body {
  position: relative;
  cursor: grab;
}

.companion-avatar-body:active {
  cursor: grabbing;
}

.compass-spin-subtle {
  animation: compassSpinSubtle 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  transform-origin: center center;
}

@keyframes compassSpinSubtle {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(18deg); }
  50% { transform: rotate(-12deg); }
  75% { transform: rotate(8deg); }
  100% { transform: rotate(0deg); }
}

.companion-pulse-led {
  animation: ledPulse 1.8s infinite ease-in-out;
}

@keyframes ledPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 6px #22c55e; }
  50% { transform: scale(1.25); box-shadow: 0 0 12px #22c55e, 0 0 18px rgba(34, 197, 94, 0.6); }
}

@keyframes nuance-breathing {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.04); }
}

/* Companion Mini Chat Box */
.companion-mini-chat-box {
  background: #ffffff !important;
  border: 1.5px solid #0284c7 !important;
  border-radius: 16px !important;
  padding: 12px 14px !important;
  width: 290px !important;
  box-shadow: 0 8px 30px rgba(2, 132, 199, 0.2), 0 2px 10px rgba(15, 23, 42, 0.08) !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: capsuleFloatIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.companion-mini-chat-box input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  box-sizing: border-box;
}

.companion-mini-chat-box input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* CHẾ ĐỘ 3 TẦNG: KHI Ở TẦNG TÓM TẮT HOẶC TERMINAL, ẨN DÒNG TIN CHAT NHẬT KÝ */
html body.che-do-tom-tat #khung-tin-nhan .dong-tin,
html body.che-do-tom-tat #khung-tin-nhan .dong-tin-system,
html body.che-do-tom-tat #khung-tin-nhan .khong-co-cuoc-tro-chuyen,
html body.che-do-tom-tat #khung-tin-nhan #khung-tai-tin-cu,
html body.che-do-ban-tho #khung-tin-nhan .dong-tin,
html body.che-do-ban-tho #khung-tin-nhan .dong-tin-system,
html body.che-do-ban-tho #khung-tin-nhan .khong-co-cuoc-tro-chuyen,
html body.che-do-ban-tho #khung-tin-nhan #khung-tai-tin-cu {
  display: none !important;
}

html body.che-do-day-du #man-hinh-terminal {
  display: none !important;
}

html body.che-do-tom-tat #man-hinh-terminal,
html body.che-do-tom-tat #danh-sach-dong-terminal {
  display: block !important;
  flex: 1 1 100% !important;
  height: auto !important;
  min-height: 200px !important;
  overflow: visible !important;
}

/* ==========================================================================
   A10. CHUẨN HÓA SESSION TAB BAR CHUẨN APPLE IDE (KHẮC PHỤC KHOANH ĐỎ HÌNH 2)
   Gọt mỏng, tinh tế, bỏ avatar to tướng và bỏ badge "Thợ" thô kệch.
   ========================================================================== */
#hang-the-trang-doc {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 10px !important;
  height: 40px !important;
  max-height: 40px !important;
  overflow-x: auto !important;
  background: rgba(248, 250, 252, 0.9) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
}
#hang-the-trang-doc::-webkit-scrollbar {
  display: none !important;
}

#hang-the-trang-doc .the-trang-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  padding: 0 10px !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

#hang-the-trang-doc .the-trang-item:hover {
  background: #f0f9ff !important;
  border-color: #38bdf8 !important;
  transform: translateY(-1px) !important;
}

#hang-the-trang-doc .the-trang-item.dang-chon,
#hang-the-trang-doc .the-trang-item.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3) !important;
}

#hang-the-trang-doc .the-trang-mini-icon {
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

#hang-the-trang-doc .the-trang-ten {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  white-space: nowrap !important;
  letter-spacing: -0.01em !important;
}

#hang-the-trang-doc .the-trang-item.dang-chon .the-trang-ten,
#hang-the-trang-doc .the-trang-item.active .the-trang-ten {
  color: #ffffff !important;
}

#hang-the-trang-doc .the-trang-item .the-trang-btn-action,
#hang-the-trang-doc .the-trang-item .the-trang-dong-btn {
  opacity: 0 !important;
  transition: opacity 0.15s ease !important;
  font-size: 11px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  padding: 0 !important;
  color: inherit !important;
}

#hang-the-trang-doc .the-trang-item:hover .the-trang-btn-action,
#hang-the-trang-doc .the-trang-item:hover .the-trang-dong-btn,
#hang-the-trang-doc .the-trang-item.dang-chon .the-trang-dong-btn,
#hang-the-trang-doc .the-trang-item .btn-ghim-the.da-ghim {
  opacity: 0.85 !important;
}
#hang-the-trang-doc .the-trang-item .the-trang-dong-btn:hover {
  opacity: 1 !important;
  color: #ef4444 !important;
}

/* Nâng cấp giao diện Floating Companion La Bàn Đa Phương Thức */
.companion-command-console {
  display: none !important;
  position: absolute !important;
  bottom: 70px !important;
  right: 0 !important;
  left: auto !important;
  width: 440px !important;
  max-width: 92vw !important;
  height: 520px !important;
  max-height: 80vh !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  border: 1.5px solid #0284c7 !important;
  border-radius: 20px !important;
  box-shadow: 0 16px 40px rgba(2, 132, 199, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.8) inset !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 1200 !important;
  animation: console-appear 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes console-appear {
  0% { transform: scale(0.92) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.companion-console-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 16px !important;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border-bottom: 1px solid #bae6fd !important;
}

.companion-console-body {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  padding: 14px 16px !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: #0f172a !important;
}

.companion-console-footer {
  padding: 10px 14px !important;
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

/* ==========================================================================
   WO-DU-PHONG-SPLIT-VIEW-AND-JACK-HOTFIXES (SOTA ARCHITECTURE UPGRADES)
   ========================================================================== */

/* 1. KHẮC PHỤC TRIỆT ĐỂ LỖI ẨN CAPSULE RÁC DOS-2 Ở GÓC DƯỚI BÊN PHẢI */
#floating-capsule-dock,
.floating-capsule-dock,
.floating-capsule-item {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  position: absolute !important;
  bottom: -9999px !important;
  right: -9999px !important;
}

/* 2. AVATAR DOCK TRÒN ĐƯỜNG KÍNH 40PX CÓ LED THỞ XANH Ở ĐỈNH DANH SÁCH BÊN TRÁI */
.avatar-dock-container {
  display: flex !important;
  flex-direction: column !important;
  padding: 8px 12px 10px 12px !important;
  background: rgba(248, 250, 252, 0.95) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  user-select: none !important;
}

.avatar-dock-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 8px !important;
}

.avatar-dock-count {
  font-size: 10.5px !important;
  font-weight: 700 !important;
  color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.08) !important;
  padding: 2px 7px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(2, 132, 199, 0.15) !important;
}

.avatar-dock-items {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 4px 2px 6px 2px !important;
  scrollbar-width: none !important;
}

.avatar-dock-items::-webkit-scrollbar {
  display: none !important;
}

.avatar-dock-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 4px !important;
  cursor: pointer !important;
  position: relative !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.avatar-dock-item:active {
  transform: scale(0.94) !important;
}

.avatar-dock-circle {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  overflow: visible !important;
}

.avatar-dock-item:hover .avatar-dock-circle {
  transform: translateY(-2px) scale(1.06) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35), 0 0 0 1.5px #0284c7 !important;
}

.avatar-dock-item.active .avatar-dock-circle {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2.5px #0284c7, 0 4px 12px rgba(2, 132, 199, 0.35) !important;
  background: #ffffff !important;
}

.avatar-dock-img {
  width: 28px !important;
  height: 28px !important;
  object-fit: contain !important;
  pointer-events: none !important;
}

.avatar-dock-icon {
  font-size: 19px !important;
  line-height: 1 !important;
  pointer-events: none !important;
}

.avatar-dock-led-dot {
  position: absolute !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 11px !important;
  height: 11px !important;
  background: #22c55e !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  box-shadow: 0 0 6px #22c55e !important;
  animation: ledThoXanh 2s ease-in-out infinite !important;
  pointer-events: none !important;
}

@keyframes ledThoXanh {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
    box-shadow: 0 0 2px rgba(34, 197, 94, 0.3);
  }
}

.avatar-dock-name {
  font-size: 10.5px !important;
  font-weight: 700 !important;
  color: #475569 !important;
  max-width: 52px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  text-align: center !important;
  line-height: 1.2 !important;
}

.avatar-dock-item:hover .avatar-dock-name {
  color: #0284c7 !important;
}

.avatar-dock-item.active .avatar-dock-name {
  color: #0284c7 !important;
  font-weight: 800 !important;
}

/* 3. CỐ ĐỊNH AVATAR TOPBAR VÀO PILL - TRIỆT TIÊU LỖI TRÔI Y: 2 */
.thanh-dau-agent-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 3px 10px 3px 4px !important;
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  border-radius: 20px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  max-width: 260px !important;
}

#thanh-dau-avatar,
.thanh-dau-avatar-wrapper {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12) !important;
  flex-shrink: 0 !important;
  background: #f1f5f9 !important;
}

#thanh-dau-avatar img,
.thanh-dau-avatar-wrapper img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* 4. SPLIT-VIEW CHIA ĐÔI MÀN HÌNH (RAW TERMINAL & TIẾN TRÌNH JOF FLOWCHART) */
.bo-dieu-khien-split-view {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  padding: 2px 4px !important;
  background: rgba(15, 23, 42, 0.04) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 8px !important;
  margin-left: 6px !important;
}

.btn-split-mode {
  padding: 3px 8px !important;
  min-height: 26px !important;
  height: 26px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #475569 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
}

.btn-split-mode:hover {
  background: rgba(15, 23, 42, 0.06) !important;
  color: #0f172a !important;
}

.btn-split-mode.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.2) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  font-weight: 700 !important;
}

.khung-split-view-wrapper {
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
  position: relative !important;
}

.split-pane-terminal {
  flex: 1 1 50% !important;
  min-width: 240px !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  position: relative !important;
  background: #0f172a !important;
}

.split-pane-flow {
  flex: 1 1 50% !important;
  min-width: 260px !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border-left: 1px solid rgba(15, 23, 42, 0.08) !important;
}

.split-pane-flow-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 6px 12px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  flex-shrink: 0 !important;
}

.split-view-divider {
  width: 8px !important;
  cursor: col-resize !important;
  background: rgba(241, 245, 249, 0.85) !important;
  border-left: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-right: 1px solid rgba(15, 23, 42, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 20 !important;
  transition: background 0.15s ease !important;
  user-select: none !important;
  touch-action: none !important;
  flex-shrink: 0 !important;
}

.split-view-divider:hover,
.split-view-divider.dang-keo {
  background: #38bdf8 !important;
}

.split-divider-handle {
  width: 3px !important;
  height: 36px !important;
  background: #94a3b8 !important;
  border-radius: 2px !important;
  transition: background 0.15s ease !important;
}

.split-view-divider:hover .split-divider-handle,
.split-view-divider.dang-keo .split-divider-handle {
  background: #ffffff !important;
}

/* 5. TỐI ƯU TAB TÓM TẮT & NHẬT KÝ (MUTUALLY EXCLUSIVE & HIGH CONTRAST) */
.bo-chuyen-tang-tin .btn-tang.active,
.bo-chuyen-tang-tin .btn-tang.dang-chon {
  background: #ffffff !important;
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.25) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
  font-weight: 700 !important;
}

.the-trang-item.dang-chon,
.the-trang-item.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

/* 6. EXCALIDRAW SOTA TRONG KỆ PHẢI (ZERO BLOAT) */
#tab-view-ban-ve {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
}

#iframe-excalidraw-ke-phai,
#iframe-excalidraw-live {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  background: #ffffff !important;
  flex: 1 1 auto !important;
  display: block !important;
}

.ke-phai-header-single {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 10px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  gap: 8px !important;
}

.ke-phai-segmented-tabs .ke-phai-tab-btn {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.ke-phai-segmented-tabs .ke-phai-tab-btn:hover {
  color: #0f172a !important;
  background: rgba(255, 255, 255, 0.6) !important;
}

.ke-phai-segmented-tabs .ke-phai-tab-btn.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* 7. CỐ ĐỊNH BỐ CỤC SPLIT-VIEW (1 - 2) - KHÔNG BAO GIỜ BỊ ĐÈ MẤT */
.khung-split-view-wrapper {
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 480px !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
  position: relative !important;
}

.split-pane-terminal {
  flex: 1 1 50% !important;
  min-width: 220px !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  position: relative !important;
  background: #ffffff !important;
}

#danh-sach-dong-terminal {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}

.split-pane-flow {
  flex: 1 1 50% !important;
  min-width: 240px !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  background: #ffffff !important;
  border-left: 1px solid rgba(15, 23, 42, 0.08) !important;
  padding: 10px 14px !important;
  box-sizing: border-box !important;
}

/* Các chế độ mở rộng Split-View */
.khung-split-view-wrapper.split-mode-term .split-pane-terminal {
  flex: 1 1 100% !important;
  width: 100% !important;
  display: flex !important;
}
.khung-split-view-wrapper.split-mode-term .split-pane-flow,
.khung-split-view-wrapper.split-mode-term .split-view-divider {
  display: none !important;
}

.khung-split-view-wrapper.split-mode-flow .split-pane-flow {
  flex: 1 1 100% !important;
  width: 100% !important;
  display: flex !important;
}
.khung-split-view-wrapper.split-mode-flow .split-pane-terminal,
.khung-split-view-wrapper.split-mode-flow .split-view-divider {
  display: none !important;
}

.khung-split-view-wrapper.split-mode-equal .split-pane-terminal {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 50% !important;
}

.khung-split-view-wrapper.split-mode-equal .split-pane-flow,
.split-pane-flow,
#split-pane-flow {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 50% !important;
  overflow-y: auto !important;
  padding: 10px !important;
  box-sizing: border-box !important;
}
.khung-split-view-wrapper.split-mode-equal .split-view-divider {
  display: flex !important;
}

/* 8. FLOATING LIVING MASCOT (AGENT SỐNG LƠ LỬNG 72 BPM) */
.floating-living-mascot {
  position: fixed !important;
  bottom: 84px !important;
  right: 20px !important;
  display: none !important;
  flex-direction: column !important;
  align-items: center !important;
  z-index: 1500 !important;
  user-select: none !important;
  cursor: grab !important;
  transition: transform 0.15s ease-out !important;
}

.floating-living-mascot.hien-mascot {
  display: flex !important;
}

.floating-living-mascot:active {
  cursor: grabbing !important;
}

.mascot-living-halo {
  position: absolute !important;
  top: -4px !important;
  left: -4px !important;
  right: -4px !important;
  bottom: -4px !important;
  border-radius: 50% !important;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, rgba(2, 132, 199, 0) 70%) !important;
  animation: mascotHaloBreath 1.8s ease-in-out infinite !important;
  pointer-events: none !important;
}

@keyframes mascotHaloBreath {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.22);
    opacity: 0.95;
  }
}

.mascot-living-core {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(24px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(190%) !important;
  border: 2.5px solid #ffffff !important;
  box-shadow: 0 8px 30px rgba(2, 132, 199, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.floating-living-mascot:hover .mascot-living-core {
  transform: scale(1.08) translateY(-2px) !important;
  box-shadow: 0 12px 36px rgba(2, 132, 199, 0.45), 0 0 0 1.5px #0284c7 !important;
}

.mascot-living-core img {
  width: 38px !important;
  height: 38px !important;
  object-fit: contain !important;
  pointer-events: none !important;
}

.mascot-living-dot {
  position: absolute !important;
  bottom: 1px !important;
  right: 1px !important;
  width: 12px !important;
  height: 12px !important;
  background: #22c55e !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  box-shadow: 0 0 8px #22c55e !important;
  animation: ledThoXanh 1.8s ease-in-out infinite !important;
  pointer-events: none !important;
}

.mascot-living-badge {
  font-size: 10.5px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  background: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  padding: 2px 8px !important;
  border-radius: 12px !important;
  margin-top: 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  white-space: nowrap !important;
  pointer-events: none !important;
}

.mascot-living-close {
  position: absolute !important;
  top: -4px !important;
  right: -4px !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(15, 23, 42, 0.15) !important;
  background: #ffffff !important;
  color: #64748b !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
}

.floating-living-mascot:hover .mascot-living-close {
  display: flex !important;
}

/* ==========================================================================
   JACK SPEC: SYSTEM HEALTH DOCK & LEFT SIDEBAR ZERO GAP
   ========================================================================== */
.cot-danh-sach {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

.danh-sach-the-cuoc {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

.sidebar-system-health-dock {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 10px !important;
  background: rgba(248, 250, 252, 0.95) !important;
  border-top: 1px solid #cbd5e1 !important;
  font-size: 11px !important;
  color: #475569 !important;
  flex-shrink: 0 !important;
  margin-top: auto !important;
  user-select: none !important;
}

.health-dock-item {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
}

.health-dock-dot {
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #22c55e !important;
  box-shadow: 0 0 6px #22c55e !important;
  animation: ledThoXanh 1.8s ease-in-out infinite !important;
}

.health-dock-divider {
  color: #94a3b8 !important;
  font-weight: 700 !important;
}

.health-dock-badge {
  font-size: 9px !important;
  font-weight: 800 !important;
  color: #0284c7 !important;
  background: #e0f2fe !important;
  border: 1px solid #bae6fd !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  letter-spacing: 0.03em !important;
}

/* ==========================================================================
   JACK SPEC: VISUAL DAG FLOWCHART JOF v4 (COMPACT STEPPER)
   ========================================================================== */
.flowchart-dag-container {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 2px !important;
  padding: 8px 10px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 10px !important;
  margin-bottom: 10px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03) !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.dag-step-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 3px 6px !important;
  border-radius: 6px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0 !important;
  flex: 1 1 0 !important;
  justify-content: center !important;
  min-width: 0 !important;
}

.dag-step-pill.done {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  color: #16a34a !important;
}

.dag-step-pill.active {
  background: #e0f2fe !important;
  border-color: #38bdf8 !important;
  color: #0284c7 !important;
  box-shadow: 0 0 0 1px #0284c7 !important;
}

.dag-step-pill.pending {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #94a3b8 !important;
}

.dag-step-pill .step-num {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 14px !important;
  height: 14px !important;
  border-radius: 50% !important;
  font-size: 9px !important;
  font-weight: 800 !important;
}

.dag-step-pill.done .step-num {
  background: #16a34a !important;
  color: #ffffff !important;
}

.dag-step-pill.active .step-num {
  background: #0284c7 !important;
  color: #ffffff !important;
}

.dag-step-pill.pending .step-num {
  background: #cbd5e1 !important;
  color: #ffffff !important;
}

.dag-step-pill .step-txt {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.dag-sep {
  font-size: 11px !important;
  font-weight: 800 !important;
  color: #cbd5e1 !important;
  user-select: none !important;
  flex-shrink: 0 !important;
}

.the-tac-vu-agent-selected {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

/* ==========================================================================
   JACK SPEC: APPLE GLASSMORPHISM INPUT CAPSULE (#khung-nhap-tin-cuoc)
   ========================================================================== */
#khung-nhap-tin-cuoc,
.khung-nhap-tin {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 20px !important;
  padding: 10px 14px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
}

#khung-nhap-tin-cuoc:focus-within {
  border-color: #38bdf8 !important;
  box-shadow: 0 12px 36px rgba(2, 132, 199, 0.15), 0 0 0 1.5px #0284c7 !important;
}

#nhap-tin-hoi-thoai,
.o-nhap-tin-cuoc {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 13.5px !important;
  color: #0f172a !important;
  line-height: 1.5 !important;
  resize: none !important;
}

.thanh-hanh-dong-nhap {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding-top: 8px !important;
  border-top: 1px solid rgba(15, 23, 42, 0.06) !important;
  margin-top: 4px !important;
}

.cong-cu-nhap-nhom .btn-cong-cu {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 6px 12px !important;
  min-height: 36px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  background: rgba(255, 255, 255, 0.7) !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.cong-cu-nhap-nhom .btn-cong-cu:hover {
  background: #ffffff !important;
  border-color: #38bdf8 !important;
  color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15) !important;
}

#btn-gui-tin-nhan,
.btn-primary#btn-gui-tin-nhan {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 8px 18px !important;
  min-height: 38px !important;
  border-radius: 19px !important;
  border: none !important;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

#btn-gui-tin-nhan:hover {
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45) !important;
}

#btn-gui-tin-nhan:active {
  transform: scale(0.97) !important;
}

/* ==========================================================================
   JACK SPEC: 3 TABS SEGMENTED PILL APPLE (TÓM TẮT · NHẬT KÝ · TERMINAL)
   ========================================================================== */
.bo-chuyen-tang-tin.segmented-control-bar {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  padding: 3px !important;
  background: rgba(241, 245, 249, 0.92) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 12px !important;
}

.bo-chuyen-tang-tin .nut-tang-tin {
  padding: 6px 14px !important;
  min-height: 32px !important;
  border-radius: 9px !important;
  border: none !important;
  background: transparent !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.bo-chuyen-tang-tin .nut-tang-tin:hover {
  color: #0f172a !important;
  background: rgba(255, 255, 255, 0.6) !important;
}

.bo-chuyen-tang-tin .nut-tang-tin.active,
.bo-chuyen-tang-tin .nut-tang-tin.dang-chon,
.bo-chuyen-tang-tin .nut-tang-tin.tang-active {
  background: #ffffff !important;
  color: #0284c7 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(2, 132, 199, 0.15) !important;
}

.bo-chuyen-tang-tin .nut-tang-tin:not(.active):not(.dang-chon):not(.tang-active) {
  background: transparent !important;
  color: #475569 !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

/* ==========================================================================
   JACK SPEC: SMART LIVE CONSOLE STREAM FALLBACK (#khung-terminal-console-fallback)
   ========================================================================== */
.khung-terminal-console-fallback {
  display: flex !important;
  flex-direction: column !important;
  position: absolute !important;
  inset: 0 !important;
  background: #090d16 !important;
  color: #e2e8f0 !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SFMono-Regular", Menlo, Monaco, Consolas, monospace !important;
  z-index: 5 !important;
  overflow: hidden !important;
}

.console-fallback-topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 12px !important;
  background: #111827 !important;
  border-bottom: 1px solid #1f2937 !important;
  flex-shrink: 0 !important;
}

.console-fallback-body {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 12px 14px !important;
  font-size: 11.5px !important;
  line-height: 1.6 !important;
  color: #cbd5e1 !important;
}

/* ==========================================================================
   JACK SPEC: FLOATING LIVING MASCOT & 3-ACTION MINI MENU
   ========================================================================== */
#floating-living-mascot.hien-mascot,
.floating-living-mascot.hien-mascot {
  display: flex !important;
  position: fixed !important;
  bottom: 84px !important;
  right: 24px !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.08) !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: 9999 !important;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

#floating-living-mascot:hover {
  transform: scale(1.08) !important;
}

.mascot-mini-menu {
  position: absolute !important;
  bottom: 64px !important;
  right: 0 !important;
  min-width: 170px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06) !important;
  padding: 8px !important;
  flex-direction: column !important;
  gap: 4px !important;
  z-index: 10000 !important;
}

.mascot-menu-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 4px 6px 6px 6px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  color: #0284c7 !important;
}

.mascot-menu-action {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 6px 10px !important;
  min-height: 34px !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
  color: #1e293b !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  width: 100% !important;
  text-align: left !important;
  transition: background 0.15s ease !important;
}

.mascot-menu-action:hover {
  background: #f0f9ff !important;
  color: #0284c7 !important;
}

/* ==========================================================================
   JACK SPEC: TYPOGRAPHY APPLE HIG & COT 2 COMPACT TEXT
   ========================================================================== */
.the-tac-vu-agent-selected {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif !important;
}

#tieu-de-nhiem-vu {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}

#noi-dung-nhiem-vu {
  font-size: 11.5px !important;
  line-height: 1.45 !important;
  color: #475569 !important;
}

.the-nhat-ky-card {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif !important;
  font-size: 11.5px !important;
  line-height: 1.45 !important;
}

/* ==========================================================================
   TRIỆT TIÊU TRIỆT ĐỂ LỖI NUT-TANG-DAY-DU BỊ XANH CÙNG LÚC TỪ LUAT-NHIN.CSS
   ========================================================================== */
html body #thanh-che-do-xem #nut-tang-day-du:not(.tang-active):not(.active):not(.dang-chon),
html body #thanh-che-do-xem #nut-tang-tom-tat:not(.tang-active):not(.active):not(.dang-chon),
html body #thanh-che-do-xem #nut-tang-ban-tho:not(.tang-active):not(.active):not(.dang-chon),
html body #thanh-che-do-xem .nut-tang-tin:not(.tang-active):not(.active):not(.dang-chon),
#thanh-che-do-xem #nut-tang-day-du:not(.tang-active):not(.active):not(.dang-chon) {
  background: transparent !important;
  border-color: transparent !important;
  color: #475569 !important;
  box-shadow: none !important;
}

/* ==========================================================================
   JACK SPEC: UN-CRAMP LAYOUT ON TABLET (<= 1366px) - SLIDE-OVER DRAWER SHEET
   ========================================================================== */
/* Áp dụng chế độ Slide-Over Drawer trên mọi thiết bị để không bao giờ bóp nghẹt Split-View */
body.ke-phai-mo,
body.ke-phai-mo:not(.ke-phai-toan-man) {
  padding-right: 0 !important;
}

body.ke-phai-mo #ke-phai-backdrop,
#ke-phai-backdrop.hien,
.ke-phai-container.mo ~ #ke-phai-backdrop {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.4) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  z-index: 1199 !important;
}

#ke-phai-container.ke-phai-container,
.ke-phai-container {
  position: fixed !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 460px !important;
  max-width: 90vw !important;
  z-index: 1200 !important;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(28px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
  background: rgba(255, 255, 255, 0.95) !important;
}

#ke-phai-container.toan-man,
.ke-phai-container.toan-man {
  width: 100vw !important;
  max-width: 100vw !important;
  left: 0 !important;
  right: 0 !important;
}

#ke-phai-btn-toan-man,
#ke-phai-btn-dong {
  position: relative;
  min-width: 32px !important;
  min-height: 32px !important;
  width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

#ke-phai-btn-toan-man::after,
#ke-phai-btn-dong::after {
  content: "";
  position: absolute;
  inset: -6px; /* Vùng chạm touch target 44x44px chuẩn Apple HIG */
}

@media (max-width: 1366px) {
  .ke-phai-tab-btn {
    padding: 0 4px !important;
    font-size: 11px !important;
  }
}

/* ==========================================================================
   JACK DIRECTIVE: VIP STATION COMPASS, DUAL COLUMN TABS & CONVERSATION STREAM
   ========================================================================== */

/* 1. VIP STATION: LA BÀN COMPASS TRÊN SIDEBAR TRÁI */
.vip-station-compass {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  margin: 6px 8px !important;
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.95) 0%, rgba(224, 242, 254, 0.9) 100%) !important;
  border: 1.5px solid #38bdf8 !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.12) !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  position: relative !important;
  z-index: 5 !important;
}

.vip-station-compass:hover {
  transform: translateY(-1px) !important;
  border-color: #0284c7 !important;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.2) !important;
}

.vip-station-compass .compass-avatar-wrap {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  border: 1.5px solid #0284c7 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  flex-shrink: 0 !important;
}

.vip-station-compass .compass-vip-avatar {
  width: 28px !important;
  height: 28px !important;
  object-fit: contain !important;
}

.vip-station-compass .compass-vip-led {
  position: absolute !important;
  bottom: 0px !important;
  right: 0px !important;
  width: 9px !important;
  height: 9px !important;
  border-radius: 50% !important;
  background: #22c55e !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 0 6px #22c55e !important;
}

.vip-station-compass .compass-vip-info {
  flex: 1 !important;
  min-width: 0 !important;
}

.vip-station-compass .compass-vip-tag {
  font-size: 9.5px !important;
  font-weight: 900 !important;
  color: #0284c7 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
}

.vip-station-compass .compass-vip-title {
  margin: 0 !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.vip-station-compass .compass-vip-status {
  font-size: 11px !important;
  color: #475569 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.vip-station-compass .btn-compass-vip-call {
  padding: 5px 10px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  border: none !important;
  border-radius: 6px !important;
  background: #0284c7 !important;
  color: #ffffff !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
  flex-shrink: 0 !important;
}

/* 2. TAB CONTROL CỘT 1 (CHAT / TERMINAL) & CỘT 2 (SƠ ĐỒ / TÓM TẮT / NHẬT KÝ) */
.bo-chuyen-tab-cot1 .tab-cot1-btn,
.bo-chuyen-tab-cot2 .tab-cot2-btn {
  transition: all 0.15s ease !important;
}

.bo-chuyen-tab-cot1 .tab-cot1-btn:hover,
.bo-chuyen-tab-cot2 .tab-cot2-btn:hover {
  background: rgba(255, 255, 255, 0.6) !important;
  color: #0284c7 !important;
}

.bo-chuyen-tab-cot1 .tab-cot1-btn.active,
.bo-chuyen-tab-cot2 .tab-cot2-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
}

/* 3. MASCOT THU NHỎ (KHÔNG BIẾN MẤT KHI BẤM) */
.floating-living-mascot.mascot-thu-nho {
  width: 44px !important;
  height: 44px !important;
  padding: 2px !important;
  border-radius: 50% !important;
  opacity: 0.85 !important;
}

.floating-living-mascot.mascot-thu-nho .mascot-living-badge,
.floating-living-mascot.mascot-thu-nho .mascot-mini-menu {
  display: none !important;
}

/* ==========================================================================
   WO-DU-PHONG-MOBILE-RESPONSIVE-OVERHAUL:
   1. SINGLE COLUMN & MOBILE VIEW SWITCHER (APPLE HIG SEGMENTED CONTROL)
   2. TỐI ƯU DOCK ĐÁY NHẬP LỆNH & THU GỌN MASCOT NEO TRÊN
   3. TỐI ƯU TAB PHIÊN CUỘN NGANG & HEADER 44PX CHỐNG TRÀN
   4. KỆ PHẢI DRAWER SLIDE-OVER CÓ LỐI THOÁT TRÊN MOBILE
   ========================================================================== */

/* 1. MẶC ĐỊNH TRÊN DESKTOP / TABLET (> 640px) */
.mobile-view-switcher {
  display: none !important;
}

.mascot-sub-action {
  font-size: 11px !important;
  padding: 5px 6px !important;
  min-height: 32px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  color: #0284c7 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.mascot-sub-action:hover {
  background: #f0f9ff !important;
  border-color: #38bdf8 !important;
  color: #0369a1 !important;
}

/* 2. CHUYỂN ĐỔI TOÀN DIỆN CHO MOBILE & GẬP Z FOLD 4 (<= 903px) */
@media (max-width: 903px) {
  /* a. THANH CHUYỂN ĐỔI GÓC NHÌN MOBILE SWITCHER */
  .mobile-view-switcher,
  #mobile-view-switcher {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(241, 245, 249, 0.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    padding: 3px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    margin: 6px 8px 8px 8px !important;
    gap: 4px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
    flex-shrink: 0 !important;
    z-index: 20 !important;
  }

  .mobile-view-switcher .btn-switch-tab {
    flex: 1 1 50% !important;
    min-height: 40px !important;
    height: 40px !important;
    padding: 0 8px !important;
    border-radius: 9px !important;
    border: none !important;
    background: transparent !important;
    color: #475569 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    touch-action: manipulation !important;
  }

  .mobile-view-switcher .btn-switch-tab.active {
    background: #ffffff !important;
    color: #0284c7 !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(2, 132, 199, 0.15) !important;
  }

  /* b. TRIỆT TIÊU SPLIT-VIEW TRÊN MOBILE -> CHUYỂN SANG SINGLE COLUMN 100% */
  .khung-split-view-wrapper,
  #khung-split-view-wrapper {
    flex-direction: column !important;
    width: 100% !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  .split-view-divider,
  #split-view-divider,
  .bo-dieu-khien-split-view,
  #bo-dieu-khien-split-view {
    display: none !important;
  }

  .split-pane-terminal,
  #split-pane-terminal {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    flex: 1 1 100% !important;
    box-sizing: border-box !important;
    border-radius: 10px !important;
    margin: 0 !important;
  }

  .split-pane-flow,
  #split-pane-flow {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    flex: 1 1 100% !important;
    box-sizing: border-box !important;
    border-radius: 10px !important;
    margin: 0 !important;
  }

  /* c. DOCK ĐÁY NHẬP LỆNH: 100% THOÁNG ĐÃNG, CHỐNG AUTO-ZOOM IOS & TOUCH TARGET >= 44PX */
  #khung-nhap-tin-cuoc,
  .khung-nhap-tin {
    z-index: 50 !important;
    padding: 8px 10px !important;
    border-radius: 16px !important;
    margin: 6px 6px !important;
    position: relative !important;
  }

  html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
  html body #khung-nhap-tin-cuoc #nhap-terminal-truc-tiep,
  html body #khung-nhap-tin-cuoc textarea,
  html body #nhap-tin-hoi-thoai,
  html body #nhap-terminal-truc-tiep,
  html body .o-nhap-tin-cuoc,
  html body .o-nhap-terminal-truc-tiep,
  textarea#nhap-tin-hoi-thoai,
  input#nhap-terminal-truc-tiep {
    font-size: 14px !important;
    line-height: 1.45 !important;
  }

  .thanh-hanh-dong-nhap {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    padding-top: 6px !important;
  }

  .cong-cu-nhap-nhom {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  #btn-mic-giong-noi,
  #btn-dinh-kem-anh,
  #btn-ctrl-c {
    min-width: 36px !important;
    min-height: 36px !important;
    height: 36px !important;
    width: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation !important;
  }

  .nut-gui-nhom {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-left: auto !important;
  }

  html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan,
  html body #btn-gui-tin-nhan,
  html body .btn-primary#btn-gui-tin-nhan,
  #btn-gui-tin-nhan {
    min-width: 54px !important;
    width: auto !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 12px !important;
    border-radius: 19px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation !important;
  }

  html body #khung-nhap-tin-cuoc #btn-huy-giao-viec,
  #btn-huy-giao-viec {
    min-height: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    width: 38px !important;
    border-radius: 19px !important;
    padding: 0 !important;
    touch-action: manipulation !important;
  }

  /* d. THU GỌN FLOATING MASCOT NEO GỌN Ở GÓC TRÊN, KHÔNG ĐÈ LÊN DOCK ĐÁY */
  html body #floating-living-mascot,
  html body #floating-living-mascot.hien-mascot,
  html body #floating-living-mascot.mascot-thu-nho,
  #floating-living-mascot.hien-mascot,
  .floating-living-mascot.hien-mascot,
  #floating-living-mascot,
  .floating-living-mascot,
  .floating-companion-agent {
    position: fixed !important;
    top: 52px !important;
    right: 8px !important;
    bottom: auto !important;
    left: auto !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    z-index: 100 !important;
  }

  #floating-living-mascot .mascot-living-core,
  .floating-living-mascot .mascot-living-core,
  .floating-companion-agent .companion-avatar-body {
    width: 34px !important;
    height: 34px !important;
    border-width: 1.5px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
  }

  #floating-living-mascot .mascot-living-core img,
  .floating-living-mascot .mascot-living-core img,
  .floating-companion-agent .companion-avatar-body img {
    width: 22px !important;
    height: 22px !important;
  }

  #floating-living-mascot .mascot-living-dot,
  .floating-living-mascot .mascot-living-dot,
  .floating-companion-agent .companion-pulse-led {
    width: 8px !important;
    height: 8px !important;
    border-width: 1px !important;
  }

  #floating-living-mascot .mascot-living-badge,
  .floating-living-mascot .mascot-living-badge {
    display: none !important;
  }

  .mascot-mini-menu {
    position: absolute !important;
    top: 42px !important;
    bottom: auto !important;
    right: 0 !important;
    left: auto !important;
    min-width: 220px !important;
    max-width: 90vw !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22) !important;
    z-index: 1000 !important;
  }

  /* e. DÃY TAB PHIÊN CUỘN NGANG MƯỢT MÀ CHUẨN APPLE HIG */
  #hang-the-trang-doc,
  .hang-the-trang-doc {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 4px 8px !important;
    box-sizing: border-box !important;
    gap: 6px !important;
  }

  #hang-the-trang-doc::-webkit-scrollbar,
  .hang-the-trang-doc::-webkit-scrollbar {
    display: none !important;
  }

  #hang-the-trang-doc .the-trang-item,
  .the-trang-item {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-height: 36px !important;
    height: 36px !important;
    touch-action: manipulation !important;
  }

  /* f. TOPBAR 44PX GỌN GÀNG, KHÔNG XUẤT HIỆN 2 HÀNG */
  #thanh-dau-doc-cuoc,
  .thanh-dau-doc-cuoc {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 8px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .thanh-dau-trai {
    min-height: 44px !important;
    max-height: 44px !important;
    overflow: hidden !important;
  }

  .cum-tac-vu-thong-minh {
    display: none !important;
  }

  #thanh-dau-lan-cuoi {
    display: none !important;
  }

  /* g. KỆ PHẢI TRÊN MOBILE DẠNG DRAWER SLIDE-OVER CÓ NÚT ĐÓNG RÕ RÀNG */
  #ke-phai-container.mo,
  .ke-phai-container.mo {
    width: 88vw !important;
    max-width: 360px !important;
    right: 0 !important;
    left: auto !important;
    top: 0 !important;
    bottom: 0 !important;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35) !important;
    border-left: 1px solid rgba(15, 23, 42, 0.12) !important;
    z-index: 1200 !important;
  }

  #ke-phai-btn-dong {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* h. WORK ORDER: WO-DU-PHONG-MOBILE-INPUT-SCROLL-AND-AGENT-TAB-SYNC (JACK HOTFIX)
     1. KHUNG CHAT & TERMINAL SCROLL CẢM ỨNG MƯỢT MÀ TRÊN MOBILE */
  #buong-hoi-thoai-chinh,
  #khung-hoi-thoai-grid,
  .khung-hoi-thoai-grid,
  .split-pane-chat,
  .split-pane-terminal,
  #khung-tin-nhan,
  .khung-tin-nhan,
  #man-hinh-terminal,
  .man-hinh-terminal-that,
  #vung-chua-hoi-thoai,
  .vung-chua-hoi-thoai,
  #danh-sach-dong-terminal {
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    pointer-events: auto !important;
  }

  #khung-tin-nhan,
  .khung-tin-nhan,
  html body #khung-tin-nhan {
    padding-bottom: 160px !important;
  }

  /* 2. Ô NHẬP LỜI DẶN CO GIÃN THOẢI MÁI TRÊN MOBILE, KHÔNG BỊ BÓP RÚM (WO-LANDING-THEME-AND-MOBILE-POLISH) */
  #khung-nhap-loi-dan,
  #hang-nhap-tuy-bien-cuoc,
  .hang-nhap-tuy-bien-cuoc,
  html body #khung-nhap-tin-cuoc #hang-nhap-tuy-bien-cuoc {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  /* Dòng 1: Textarea #nhap-tin-hoi-thoai chiếm trọn 100% chiều ngang */
  #nhap-tin-hoi-thoai,
  html body #khung-nhap-tin-cuoc #nhap-tin-hoi-thoai,
  html body #nhap-tin-hoi-thoai,
  textarea#nhap-tin-hoi-thoai {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 48px !important;
    min-height: 44px !important;
    max-height: 120px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
    resize: vertical !important;
  }

  /* Dòng 2: Cụm hành động dàn đều thoải mái, không bị bóp nghẹt */
  .thanh-hanh-dong-nhap,
  html body #khung-nhap-tin-cuoc .thanh-hanh-dong-nhap {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    gap: 8px !important;
    margin-top: 6px !important;
    padding-top: 0 !important;
    box-sizing: border-box !important;
  }

  .cong-cu-nhap-nhom,
  html body #khung-nhap-tin-cuoc .cong-cu-nhap-nhom {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
  }

  #btn-mic-giong-noi,
  button#btn-mic-giong-noi,
  html body #btn-mic-giong-noi,
  html body #khung-nhap-tin-cuoc #btn-mic-giong-noi,
  #btn-dinh-kem-anh,
  button#btn-dinh-kem-anh,
  html body #btn-dinh-kem-anh,
  html body #khung-nhap-tin-cuoc #btn-dinh-kem-anh,
  #btn-ctrl-c,
  button#btn-ctrl-c,
  html body #btn-ctrl-c,
  html body #khung-nhap-tin-cuoc #btn-ctrl-c {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 44px !important;
    box-sizing: border-box !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
  }

  #btn-mic-giong-noi .btn-nhan-chu,
  #btn-dinh-kem-anh .btn-nhan-chu,
  #btn-ctrl-c .btn-nhan-chu,
  html body #khung-nhap-tin-cuoc .btn-nhan-chu {
    display: none !important;
  }

  .nut-gui-nhom,
  html body #khung-nhap-tin-cuoc .nut-gui-nhom {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }

  html body #khung-nhap-tin-cuoc #btn-gui-tin-nhan,
  html body #btn-gui-tin-nhan,
  button#btn-gui-tin-nhan,
  #btn-gui-tin-nhan {
    min-width: 72px !important;
    width: auto !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 16px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    flex: 0 0 auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
  }

  html body #khung-nhap-tin-cuoc #btn-huy-giao-viec,
  html body #btn-huy-giao-viec,
  button#btn-huy-giao-viec,
  #btn-huy-giao-viec {
    height: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    border-radius: 12px !important;
    padding: 0 !important;
    flex: 0 0 44px !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
  }

  /* i. TỐI ƯU CỬ CHỈ CHẠM KIM XĂNG, NÚT LA BÀN & TAB KỆ PHẢI (APPLE HIG TOUCH TARGET >= 44PX) */
  #capsule-kim-xang-ai,
  .capsule-kim-xang-hud,
  .capsule-kim-xang-wrap {
    min-height: 44px !important;
    min-width: 44px !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #popover-kim-xang-ai,
  .popover-kim-xang-box {
    z-index: 1250 !important;
    pointer-events: auto !important;
  }

  .popover-kx-close,
  .popover-kx-footer button {
    min-height: 44px !important;
    min-width: 44px !important;
    touch-action: manipulation !important;
  }

  #vip-station-compass,
  .vip-station-compass,
  .btn-compass-vip-call,
  .cot-trai-lien-ket-ke-phai button {
    min-height: 44px !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .ke-phai-tab-btn,
  #ke-phai-nav-tabs .ke-phai-tab-btn,
  .tab-cot1-btn,
  .tab-cot2-btn {
    min-height: 44px !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }
}

/* ==========================================================================
   WO-FIX-LAYOUT-THEME-CONTRAST-AND-3D-PORTAL (JACK DIRECTIVE - ITEM C)
   TABLET & DESKTOP COCKPIT LAYOUT HARMONIZATION:
   1. HORIZONTAL SESSION TAB BAR (#hang-the-trang-doc): Cố định không đè topbar
   2. FLOATING LIVING MASCOT: Neo cố định góc dưới phải, không che input/nút gửi
   3. SPLIT-VIEW 50/50: Cột 1 & Cột 2 cân bằng 100% chiều cao, thẳng thớm
   ========================================================================== */

/* 1. Dải tab ngang phiên làm việc (#hang-the-trang-doc) */
#hang-the-trang-doc,
.hang-the-trang-doc,
.danh-sach-the-trang-terminal {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  min-height: 40px !important;
  height: 40px !important;
  max-height: 40px !important;
  padding: 3px 8px !important;
  margin-top: 2px !important;
  margin-bottom: 4px !important;
  gap: 6px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12) !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 100 !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
}

[data-theme="dark"] #hang-the-trang-doc,
[data-theme="obsidian"] #hang-the-trang-doc,
[data-theme="cyber"] #hang-the-trang-doc,
[data-theme="space"] #hang-the-trang-doc,
.theme-dark #hang-the-trang-doc,
.theme-obsidian #hang-the-trang-doc {
  background: #0f172a !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.6) !important;
}

#hang-the-trang-doc::-webkit-scrollbar,
.hang-the-trang-doc::-webkit-scrollbar {
  display: none !important;
}

/* Thẻ tab bên trong dải ngang chuẩn Apple Pill */
#hang-the-trang-doc .the-trang-item,
.hang-the-trang-doc .the-trang-item {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  height: 30px !important;
  min-height: 30px !important;
  min-width: fit-content !important;
  padding: 0 12px !important;
  border-radius: 15px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background: rgba(226, 232, 240, 0.65) !important;
  border: 1px solid rgba(203, 213, 225, 0.8) !important;
  color: #334155 !important;
  user-select: none !important;
}

[data-theme="dark"] #hang-the-trang-doc .the-trang-item,
[data-theme="obsidian"] #hang-the-trang-doc .the-trang-item,
.theme-dark #hang-the-trang-doc .the-trang-item,
.theme-obsidian #hang-the-trang-doc .the-trang-item {
  background: rgba(30, 41, 59, 0.8) !important;
  border: 1px solid rgba(51, 65, 85, 0.6) !important;
  color: #e2e8f0 !important;
}

#hang-the-trang-doc .the-trang-item:hover,
.hang-the-trang-doc .the-trang-item:hover {
  background: rgba(203, 213, 225, 0.95) !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

[data-theme="dark"] #hang-the-trang-doc .the-trang-item:hover,
[data-theme="obsidian"] #hang-the-trang-doc .the-trang-item:hover {
  background: rgba(51, 65, 85, 0.95) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
}

#hang-the-trang-doc .the-trang-item.dang-chon,
#hang-the-trang-doc .the-trang-item.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.4) !important;
}

/* 2. Floating Living Mascot - Chuẩn Jack Spec (KHÔNG ĐÈ NÚT GỬI, DUY NHẤT 1 MASCOT) */
#floating-companion-agent-widget,
.floating-companion-agent {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

#floating-living-mascot,
#floating-living-mascot.hien-mascot,
.floating-living-mascot,
.floating-living-mascot.hien-mascot {
  position: fixed !important;
  top: 52px !important;
  right: 12px !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 1000 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  pointer-events: auto !important;
  margin: 0 !important;
  width: 44px !important;
  height: 44px !important;
}

#floating-living-mascot .mascot-living-core,
.floating-living-mascot .mascot-living-core {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  border: 2px solid #0284c7 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.35) !important;
  position: relative !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

#floating-living-mascot .mascot-living-core img,
.floating-living-mascot .mascot-living-core img {
  width: 28px !important;
  height: 28px !important;
  object-fit: contain !important;
}

#floating-living-mascot .mascot-living-dot,
.floating-living-mascot .mascot-living-dot {
  position: absolute !important;
  bottom: 2px !important;
  right: 2px !important;
  width: 9px !important;
  height: 9px !important;
  border-radius: 50% !important;
  background: #22c55e !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.8) !important;
}

#floating-living-mascot .mascot-living-badge,
.floating-living-mascot .mascot-living-badge {
  display: none !important;
}

/* 3. Split-View 50/50 cân đối và thẳng thớm trên Desktop (>= 904px) */
@media (min-width: 904px) {
  .khung-than-split-container {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  .khung-split-view-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    gap: 8px !important;
  }

  .split-pane.split-pane-terminal,
  .split-pane.split-pane-left {
    flex: 1 1 50% !important;
    width: 50% !important;
    min-width: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .split-pane.split-pane-flow,
  .split-pane.split-pane-right {
    flex: 1 1 50% !important;
    width: 50% !important;
    min-width: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
  }
}

/* ==========================================================================
   WO-DU-PHONG-ZFOLD4-LAYOUT-AND-MASCOT-REPAIR:
   1. PHÂN TẦNG ĐỘC LẬP: TOPBAR 44PX + TABS NGANG 40PX
   2. CỘT TRÁI RESPONSIVE DRAWER & AVATAR DOCK KHÔNG TRÀN
   3. POPUP/DIALOG HƯỚNG DẪN MICRO CHO IP LAN HTTP
   ========================================================================== */
@media (max-width: 903px) {
  /* Dải tab ngang phân tầng độc lập không bị đè kẹp */
  #hang-the-trang-doc,
  .hang-the-trang-doc {
    display: flex !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 2px 8px !important;
    margin: 2px 0 4px 0 !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    align-items: center !important;
    border-radius: 8px !important;
  }

  /* Cột trái khi mở drawer trên Z Fold 4 / Mobile */
  .cot-danh-sach.drawer-mo {
    padding: 8px !important;
    box-sizing: border-box !important;
  }

  .cot-danh-sach.drawer-mo .avatar-dock-container {
    padding: 6px 8px !important;
    border-radius: 10px !important;
    margin-bottom: 6px !important;
  }

  .cot-danh-sach.drawer-mo .vip-station-compass {
    margin: 4px 0 6px 0 !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
  }

  .cot-danh-sach.drawer-mo .vip-station-compass .compass-vip-status {
    display: none !important;
  }

  .cot-danh-sach.drawer-mo .cot-trai-lien-ket-ke-phai {
    padding: 4px 6px !important;
    gap: 4px !important;
  }

  /* Khung nhập tin nhắn và nút gửi không bị tràn lề phải trên mobile/fold */
  body #khung-nhap-tin-cuoc.khung-nhap-tin,
  html body #khung-nhap-tin-cuoc.khung-nhap-tin,
  html body #khung-nhap-tin-cuoc,
  #khung-nhap-tin-cuoc,
  .khung-nhap-tin {
    left: 12px !important;
    right: 12px !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  .hang-nhap-tuy-bien-cuoc,
  .thanh-hanh-dong-nhap {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .nut-gui-nhom,
  html body #khung-nhap-tin-cuoc .nut-gui-nhom {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    margin-left: auto !important;
    box-sizing: border-box !important;
  }
}

/* Ẩn dòng cảnh báo micro thô ráp nếu có */
#canh-bao-https-micro,
.canh-bao-https-micro,
.canh-bao-micro-inline {
  display: none !important;
}

/* Touch target nút mic và các nút hành động luôn chuẩn Apple HIG >= 44px */
#btn-mic-giong-noi,
#btn-dinh-kem-anh,
#btn-ctrl-c {
  min-width: 44px !important;
  min-height: 44px !important;
}

/* ==========================================================================
   CỐ ĐỊNH LAYOUT MOBILE SAMSUNG GALAXY Z FOLD 4 & RETINA TOUCH SCROLL
   (WO-DU-PHONG-Z-FOLD-4-TOUCH-SCROLL-AND-DOCK-CLEARANCE)
   ========================================================================== */
#khung-tin-nhan,
.khung-tin-nhan,
#vung-chua-hoi-thoai,
.vung-chua-hoi-thoai,
html body #khung-tin-nhan,
html body #vung-chua-hoi-thoai {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}

#khung-tin-nhan,
.khung-tin-nhan,
html body #khung-tin-nhan {
  padding-bottom: 160px !important;
  box-sizing: border-box !important;
}

/* ==========================================================================
   VISUALIZATION: USER IMAGES & PRETTY CONVERSATION CARDS (JACK SPEC)
   ========================================================================== */
.khung-anh-user-inline {
  margin: 12px 0;
  max-width: 520px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(2, 132, 199, 0.35);
  background: rgba(15, 23, 42, 0.04);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  position: relative;
  transition: all 0.25s ease;
}
.khung-anh-user-inline:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(2, 132, 199, 0.2);
  border-color: #0284c7;
}
.link-anh-user-zoom {
  display: block;
  position: relative;
  text-decoration: none;
  cursor: zoom-in;
}
.anh-user-thumbnail {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  display: block;
  background: #0f172a;
}
.badge-zoom-anh {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.summary-fold-box {
  margin: 10px 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.8);
  padding: 8px 12px;
  font-size: 12.5px;
}
[data-theme="dark"] .summary-fold-box,
[data-theme="obsidian"] .summary-fold-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
.summary-fold-box summary {
  cursor: pointer;
  font-weight: 800;
  color: #0284c7;
  user-select: none;
}
.summary-fold-body {
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  background: rgba(0, 0, 0, 0.03);
  padding: 8px;
  border-radius: 6px;
}
.dong-tin-user .bong-tin {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(245, 158, 11, 0.05) 100%) !important;
  border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03) !important;
}
[data-theme="dark"] .dong-tin-user .bong-tin,
[data-theme="obsidian"] .dong-tin-user .bong-tin {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.15) 0%, rgba(245, 158, 11, 0.08) 100%) !important;
  border-color: rgba(2, 132, 199, 0.4) !important;
}


