/* BCC Nexus — bảng công cụ trong viền ô hỏi + nhãn chế độ + bản vẽ trong chat (mockup anh Hiệp chốt 03/11/2026).
   Chạy trên điện thoại (html.bms-phone-v2) và khung Nexus bên phải trên máy tính. Phần tử do bms-phone-nexus-modes.js
   và bms-nexus-drawing.js chèn. Nạp trước bms-phone-shell.css nên dùng :not(#\#) + !important để thắng quy tắc cũ. */
:where(.ph-nx-picker):is(.ph-nx-picker, .ph-nx-moderow)[hidden], :where(.ph-nx-moderow):is(.ph-nx-picker, .ph-nx-moderow)[hidden] { display: none !important; }

/* ---- ô hỏi: mở công cụ hoặc đang ở một chế độ thì viền tròn giãn thành khung chữ nhật */
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-composer:not(#\#):is(.nx-tools-open, [data-nx-mode]) { border-radius: 18px !important; align-items: center; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-composer:not(#\#).nx-tools-open { box-shadow: 0 10px 30px rgba(37, 99, 235, .18) !important; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-composer:not(#\#) { transition: border-radius .22s ease, box-shadow .22s ease, border-color .2s ease; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-composer:not(#\#) > .ph-nx-picker { order: -2; grid-column: 1 / -1; position: static !important; z-index: auto; width: auto !important; max-width: none !important; max-height: none !important; overflow: visible !important; margin: -5px -5px 4px; padding: 0 !important; border-bottom: 1px solid #e5e7eb; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; animation: nxToolsIn .2s ease both; font-family: Roboto, Arial, sans-serif; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-composer:not(#\#) > .ph-nx-moderow { order: -1; grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 3px 2px; animation: none; }
@keyframes nxToolsIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #popNexusWindow .pop-nexus-composer > .ph-nx-picker { animation: none !important; } }

/* ---- lưới công cụ */
#popNexusWindow .nx-tools .nt-h { display: flex; align-items: center; gap: 10px; padding: 10px 10px 6px 14px; }
#popNexusWindow .nx-tools .nt-h strong { flex: 0 0 auto; font: 500 14px/20px Roboto, Arial, sans-serif; color: #111827; }
#popNexusWindow .nx-tools .nt-srch { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 8px; background: #f3f4f6; color: #6b7280; }
#popNexusWindow .nx-tools .nt-srch svg { flex: 0 0 18px; width: 18px; height: 18px; fill: none !important; stroke: currentColor; }
#popNexusWindow .nx-tools .nt-srch input:not(#\#) { flex: 1 1 auto; min-width: 0; height: 34px; min-height: 0; margin: 0; padding: 0; border: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important; font: 400 14px Roboto, Arial, sans-serif; color: #111827; }
html.bms-phone-v2 #popNexusWindow .nx-tools .nt-srch input:not(#\#) { font-size: 16px; }
#popNexusWindow .nx-tools .nt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; max-height: 300px; overflow-y: auto; padding: 2px 6px 8px; overscroll-behavior: contain; }
#popNexusWindow .nx-tools .nt-tile:not(#\#) { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: auto; height: auto !important; min-height: 0 !important; margin: 0; padding: 10px 2px 8px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: #111827; font-family: Roboto, Arial, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; --tc: #2563eb; }
#popNexusWindow .nx-tools .nt-tile[hidden] { display: none !important; }
#popNexusWindow .nx-tools .nt-tile:active, #popNexusWindow .nx-tools .nt-tile.open { background: #eaf1ff; }
@media (hover: hover) { #popNexusWindow .nx-tools .nt-tile:hover { background: #f3f6fb; } }
#popNexusWindow .nx-tools .nt-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: #eaf1ff; color: #2563eb; transition: background .15s ease, color .15s ease; }
#popNexusWindow .nx-tools .nt-ic svg { width: 24px; height: 24px; fill: none !important; stroke: currentColor; }
#popNexusWindow .nx-tools .nt-l { font: 400 12px/14px Roboto, Arial, sans-serif; text-align: center; overflow-wrap: anywhere; }
#popNexusWindow .nx-tools .nt-tile[data-nx-tool="feedback"] { --tc: #2563eb; }
#popNexusWindow .nx-tools .nt-tile[data-nx-tool="history"] { --tc: #7c3aed; }
#popNexusWindow .nx-tools .nt-tile[data-nx-tool="diag"] { --tc: #d97706; }
#popNexusWindow .nx-tools .nt-tile[data-nx-tool="drawing"] { --tc: #0f766e; }
#popNexusWindow .nx-tools .nt-tile.is-mode.cur .nt-ic { background: var(--tc); color: #fff; }
#popNexusWindow .nx-tools .nt-tile.cur .nt-l { font-weight: 500; }
#popNexusWindow .nx-tools .nt-tile.cur::after { content: attr(data-cur); position: absolute; top: 2px; left: 2px; padding: 0 5px; border-radius: 7px; background: var(--tc); color: #fff; font: 500 9px/14px Roboto, Arial, sans-serif; }
#popNexusWindow .nx-tools .ph-nx-apps:not([hidden]) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 0 12px 8px; }
#popNexusWindow .nx-tools .ph-nx-apps .ph-nx-app svg { fill: currentColor !important; stroke: none; }

/* ---- chế độ đang dùng: viền + nhãn mang màu của chế độ */
#popNexusWindow .pop-nexus-composer { --nxm: #2563eb; --nxs: #eef4ff; }
#popNexusWindow .pop-nexus-composer[data-nx-mode="feedback"] { --nxm: #2563eb; --nxs: #eef4ff; }
#popNexusWindow .pop-nexus-composer[data-nx-mode="history"] { --nxm: #7c3aed; --nxs: #f4efff; }
#popNexusWindow .pop-nexus-composer[data-nx-mode="diag"] { --nxm: #d97706; --nxs: #fff7e8; }
#popNexusWindow .pop-nexus-composer[data-nx-mode="drawing"] { --nxm: #0f766e; --nxs: #e9f8f6; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-composer[data-nx-mode]:not(#\#) { border: 2px solid var(--nxm) !important; background: linear-gradient(var(--nxs), #fff 46px) !important; }
#popNexusWindow .ph-nx-moderow .nx-mode-pill:not(#\#) { display: inline-flex; align-items: center; gap: 6px; height: 28px !important; padding: 0 3px 0 8px; border-radius: 8px; background: var(--nxm); color: #fff; font: 500 13px/1 Roboto, Arial, sans-serif; cursor: default; }
#popNexusWindow .ph-nx-moderow .nx-mode-pill::after { content: none; }
#popNexusWindow .ph-nx-moderow .nm-ic { display: inline-grid; }
#popNexusWindow .ph-nx-moderow .nm-ic svg { width: 16px; height: 16px; fill: none !important; stroke: currentColor; }
#popNexusWindow .ph-nx-moderow .nm-x:not(#\#) { display: inline-grid; place-items: center; width: 22px; height: 22px !important; min-height: 0 !important; margin: 0; padding: 0; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .2); color: #fff; box-shadow: none; cursor: pointer; }
#popNexusWindow .ph-nx-moderow .nm-x svg { width: 14px; height: 14px; fill: none !important; stroke: currentColor; }
#popNexusWindow .ph-nx-moderow .ph-nx-chip.shot:not(#\#) { height: 28px !important; padding: 0 9px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #374151; font: 500 12px/1 Roboto, Arial, sans-serif; }
#popNexusWindow .ph-nx-moderow .ph-nx-chip.shot svg { width: 15px; height: 15px; fill: none !important; stroke: currentColor; }
/* chấm nhỏ trên logo mang icon chế độ */
#popNexusWindow .pop-nexus-composer[data-nx-mode] :where(.ph-nx-avatar):is(.ph-nx-avatar, .pop-nexus-tools-toggle), #popNexusWindow .pop-nexus-composer[data-nx-mode] :where(.pop-nexus-tools-toggle):is(.ph-nx-avatar, .pop-nexus-tools-toggle) { position: relative; overflow: visible !important; }
#popNexusWindow .pop-nexus-composer .nx-lb { position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; width: 18px; height: 18px; border: 2px solid #fff; border-radius: 50%; background: var(--nxm); color: #fff; pointer-events: none; }
#popNexusWindow .pop-nexus-composer .nx-lb svg { width: 10px !important; height: 10px !important; fill: none !important; stroke: currentColor !important; stroke-width: 2.4; }
/* Xử lý bản vẽ: nút kẹp giấy đổi màu để nhắc gửi file ở đây */
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-composer[data-nx-mode="drawing"] .pop-nexus-attach:not(#\#) { color: var(--nxm) !important; background: var(--nxs) !important; }

/* ---- bản vẽ trong chat (thẻ danh sách / kết quả) */
/* gọn: thẻ bản vẽ không lồng khung (anh Hiệp 03/11/2026) — bong bóng trong suốt, thẻ chỉ có đường kẻ ngăn dòng */
/* cân lề: thẻ bản vẽ thẳng hàng với ô hỏi ở cả hai bên (ẩn logo đầu dòng của tin này) */
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-message:has(> div.nd-wide):not(#\#) > :not(div) { display: none !important; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-message:has(> div.nd-wide):not(#\#) { gap: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-message > div.nd-wide:not(#\#) { width: 100%; margin: 0 !important; padding: 2px 0 4px !important; border-radius: 0 !important; background: transparent !important; }
:is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-message > div.nd-wide > :where(p):is(p, time):not(#\#), :is(html.bms-phone-v2.ph-nexus-open, html:not(.bms-phone-v2) #floatingActionsContainer.is-topbar-docked) #popNexusWindow .pop-nexus-message > div.nd-wide > :where(time):is(p, time):not(#\#) { padding: 0 2px; }
#popNexusWindow .nd-card { margin: 6px 0 2px; border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; background: transparent; min-width: 0; font-family: Roboto, Arial, sans-serif; }
#popNexusWindow .nd-h { display: flex; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid #f1f3f6; font-size: 12px; color: #6b7280; }
#popNexusWindow .nd-row + .nd-row { border-top: 1px solid #f1f3f6; }
#popNexusWindow .nd-top:not(#\#) { display: flex; align-items: center; gap: 8px; width: 100%; height: auto !important; min-height: 48px !important; margin: 0; padding: 8px 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #111827; text-align: left; cursor: pointer; }
#popNexusWindow .nd-top > svg { flex: 0 0 14px; color: #9ca3af; transition: transform .15s ease; }
#popNexusWindow .nd-row.open .nd-top > svg { transform: rotate(180deg); }
#popNexusWindow .nd-nm { flex: 1 1 auto; min-width: 0; }
#popNexusWindow .nd-nm b { display: block; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
#popNexusWindow .nd-nm small { display: block; overflow: hidden; font-size: 11px; line-height: 15px; color: #6b7280; text-overflow: ellipsis; white-space: nowrap; }
#popNexusWindow .nd-pill { flex: none; padding: 2px 8px; border-radius: 8px; background: #f3f4f6; color: #374151; font-size: 11px; line-height: 16px; white-space: nowrap; }
#popNexusWindow .nd-pill.run { background: #e0f2fe; color: #075985; }
#popNexusWindow .nd-pill.warn { background: #fef3c7; color: #92400e; }
#popNexusWindow .nd-pill.ok { background: #dcfce7; color: #166534; }
#popNexusWindow .nd-pill.bad { background: #fee2e2; color: #991b1b; }
#popNexusWindow .nd-body { display: none; padding: 0 2px 12px; }
#popNexusWindow .nd-row.open .nd-body { display: block; }
#popNexusWindow .nd-th:not(#\#) { position: relative; display: block; width: 100%; height: auto !important; min-height: 0 !important; margin: 0; padding: 0; border: 1px solid #e5e7eb; border-radius: 4px; background: #fff; overflow: hidden; cursor: zoom-in; box-shadow: none; }
#popNexusWindow .nd-th > svg:first-child { display: block; width: 100%; height: auto; aspect-ratio: 420 / 297; }
#popNexusWindow .nd-zm { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(17, 24, 39, .7); color: #fff; }
#popNexusWindow .nd-meta { margin: 6px 0; font-size: 11px; line-height: 16px; color: #6b7280; }
#popNexusWindow .nd-warn { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0; padding: 6px 8px; border-radius: 4px; background: #fff7e8; color: #92400e; font-size: 12px; line-height: 17px; }
#popNexusWindow .nd-warn > svg { flex: 0 0 15px; margin-top: 1px; }
#popNexusWindow .nd-warn ul { margin: 2px 0 0; padding-left: 16px; }
#popNexusWindow .nd-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
#popNexusWindow .nd-acts button:not(#\#) { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; height: 34px !important; min-height: 0 !important; margin: 0; padding: 0 6px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; box-shadow: none; color: #374151; font: 500 12px/1 Roboto, Arial, sans-serif; white-space: nowrap; cursor: pointer; }
#popNexusWindow .nd-acts button.pri:not(#\#) { border-color: #0f766e; background: #0f766e; color: #fff; }
#popNexusWindow .nd-acts button:disabled { opacity: .45; cursor: not-allowed; }
#popNexusWindow .nd-acts button > span { overflow: hidden; text-overflow: ellipsis; }
#popNexusWindow .nd-acts svg, #popNexusWindow .nd-card svg:not(.nd-th svg) { fill: none; stroke: currentColor; }
#popNexusWindow .nd-prog { height: 4px; margin: 4px 0 6px; border-radius: 2px; background: #e5e7eb; overflow: hidden; }
#popNexusWindow .nd-prog i { display: block; width: 40%; height: 100%; border-radius: 2px; background: #0f766e; animation: ndProg 1.4s ease-in-out infinite; }
@keyframes ndProg { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { #popNexusWindow .nd-prog i { animation: none; width: 100%; opacity: .5; } }
#popNexusWindow .nd-file > p::before { content: ""; display: inline-block; width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 11.5-8.5 8.5a5 5 0 0 1-7-7l9-9a3.3 3.3 0 0 1 4.7 4.7l-9 9a1.6 1.6 0 0 1-2.3-2.3l8-8'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 11.5-8.5 8.5a5 5 0 0 1-7-7l9-9a3.3 3.3 0 0 1 4.7 4.7l-9 9a1.6 1.6 0 0 1-2.3-2.3l8-8'/%3E%3C/svg%3E") center / contain no-repeat; }
#popNexusWindow .nd-people { display: flex; flex-direction: column; gap: 4px; margin: 6px 4px 2px; }
#popNexusWindow .nd-people button:not(#\#) { display: flex; flex-direction: column; align-items: flex-start; width: 100%; height: auto !important; min-height: 44px !important; margin: 0; padding: 6px 10px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; box-shadow: none; color: #111827; text-align: left; cursor: pointer; }
#popNexusWindow .nd-people b { font-size: 13px; font-weight: 500; }
#popNexusWindow .nd-people small { font-size: 11px; color: #6b7280; }

/* khung tên ngay trong thẻ bản vẽ (chế độ thu nhỏ), tự lưu */
#popNexusWindow .nd-acts button.on:not(#\#) { border-color: #0f766e; background: #e9f8f6; color: #0f766e; }
#popNexusWindow .nd-tb { margin-top: 12px; padding: 10px 0 0; border-top: 1px solid #e5e7eb; }
#popNexusWindow .nd-tb-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
#popNexusWindow .nd-tb-h b { font-size: 13px; font-weight: 500; color: #111827; }
#popNexusWindow .nd-tb-h small { font-size: 11px; color: #6b7280; text-align: right; }
#popNexusWindow .nd-tb-g { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#popNexusWindow .nd-tb label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#popNexusWindow .nd-tb label.w { grid-column: 1 / -1; }
#popNexusWindow .nd-tb label > span { font-size: 11px; line-height: 14px; color: #6b7280; }
#popNexusWindow .nd-tb :where(input):is(input, select, textarea):not(#\#), #popNexusWindow .nd-tb :where(select):is(input, select, textarea):not(#\#), #popNexusWindow .nd-tb :where(textarea):is(input, select, textarea):not(#\#) { box-sizing: border-box; width: 100%; min-width: 0; height: 34px !important; min-height: 0 !important; margin: 0; padding: 0 8px; border: 1px solid #d1d5db !important; border-radius: 6px; background: #fff !important; box-shadow: none !important; color: #111827; font: 400 13px Roboto, Arial, sans-serif; }
#popNexusWindow .nd-tb textarea:not(#\#) { height: auto !important; padding: 6px 8px; line-height: 18px; resize: vertical; }
#popNexusWindow .nd-tb :where(input):is(input, select, textarea):focus, #popNexusWindow .nd-tb :where(select):is(input, select, textarea):focus, #popNexusWindow .nd-tb :where(textarea):is(input, select, textarea):focus { outline: 2px solid rgba(15, 118, 110, .25); border-color: #0f766e !important; }
html.bms-phone-v2 #popNexusWindow .nd-tb :where(input):is(input, select, textarea):not(#\#), html.bms-phone-v2 #popNexusWindow .nd-tb :where(select):is(input, select, textarea):not(#\#), html.bms-phone-v2 #popNexusWindow .nd-tb :where(textarea):is(input, select, textarea):not(#\#) { font-size: 16px; height: 40px !important; }
html.bms-phone-v2 #popNexusWindow .nd-tb textarea:not(#\#) { height: auto !important; }

/* điện thoại: vào chế độ Xử lý bản vẽ là mở cao khung chat ngay cho rộng rãi (anh Hiệp 03/11), thẻ bản vẽ cũng vậy */
html.bms-phone-v2.ph-nexus-open #popNexusWindow:not([hidden]):not(#\#):is(:has(.pop-nexus-composer[data-nx-mode="drawing"]), :has(.nd-card), :has(.nd-ask)) { height: 86vh !important; transition: height .25s cubic-bezier(.2, .8, .2, 1); }
/* có kết quả bản vẽ trong chat: khung kéo lên toàn màn hình, nút X góc trên để đóng (anh Hiệp 03/11) */
html.bms-phone-v2.ph-nexus-open #popNexusWindow#popNexusWindow:not([hidden]):not(#\#):has(.pop-nexus-composer[data-nx-mode="drawing"]):has(.nd-card) { top: 0 !important; height: 100% !important; max-height: none !important; border-radius: 0 !important; padding-top: calc(52px + env(safe-area-inset-top, 0px)) !important; }
#popNexusWindow .ph-nx-close { display: none; }
html.bms-phone-v2.ph-nexus-open #popNexusWindow:has(.pop-nexus-composer[data-nx-mode="drawing"]):has(.nd-card) .ph-nx-close:not(#\#) { display: inline-flex; align-items: center; justify-content: center; position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 3; width: 40px !important; height: 40px !important; min-height: 0 !important; padding: 0 !important; border: 1px solid #e5e7eb !important; border-radius: 50% !important; background: #fff !important; box-shadow: none !important; color: #374151; cursor: pointer; }
#popNexusWindow .ph-nx-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---- phóng to bản vẽ */
.nd-viewer { position: fixed; inset: 0; z-index: 2147483000; display: flex; flex-direction: column; background: #111827; font-family: Roboto, Arial, sans-serif; }
.nd-viewer header { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top, 0px)) 10px 10px 16px; color: #fff; }
.nd-viewer header b { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.nd-viewer header button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .15); color: #fff; cursor: pointer; }
.nd-viewer header svg { fill: none; stroke: currentColor; }
.nd-viewer .nd-vbox { flex: 1 1 auto; min-height: 0; display: flex; overflow: auto; padding: 4px 4px max(4px, env(safe-area-inset-bottom, 0px)); touch-action: pan-x pan-y pinch-zoom; }
/* khung bọc có đúng kích thước sau khi xoay để cuộn/căn giữa đúng; tờ vẽ xoay quanh tâm khung */
.nd-viewer .nd-vfit { position: relative; flex: 0 0 auto; margin: auto; }
.nd-viewer .nd-vfit > svg { position: absolute; left: 50%; top: 50%; display: block; max-width: none; background: #fff; transform-origin: 50% 50%; }

/* ---- máy tính: Xử lý bản vẽ = khung Nexus viền xanh giãn ra toàn màn hình, giao diện đầy đủ bên trong */
.nx-drawfull { position: fixed; inset: 12px; z-index: 1500; display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden; border: 1.5px solid #0757b8; border-radius: 18px; background: var(--bms-bg, #f5f7fa); box-shadow: 0 24px 70px rgba(7, 87, 184, .22), 0 0 0 6px rgba(7, 87, 184, .06); font-family: Roboto, Arial, sans-serif; }
.nx-drawfull .nx-df-h { flex: none; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px 0 14px; border-bottom: 1px solid #e5e7eb; background: var(--bms-surface, #fff); }
.nx-drawfull .nx-df-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #0757b8; color: #fff; }
.nx-drawfull .nx-df-logo svg { width: 20px; height: 20px; }
.nx-drawfull .nx-df-h b { font-size: 15px; font-weight: 500; color: #111827; }
.nx-drawfull .nx-df-mode { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 8px; background: #0f766e; color: #fff; font-size: 12px; font-weight: 500; }
.nx-drawfull .nx-df-x { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #374151; font: 500 13px Roboto, Arial, sans-serif; cursor: pointer; }
.nx-drawfull .nx-df-x:hover { background: #f3f4f6; }
.nx-drawfull .nx-df-x svg { fill: none; stroke: currentColor; }
.nx-drawfull .nx-df-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 20px 20px; transition: opacity .18s ease .12s; }
.nx-drawfull.growing .nx-df-body, .nx-drawfull.growing .nx-df-h > :not(.nx-df-logo) { opacity: 0; transition: none; }
html.nx-drawfull-open body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .nx-drawfull .nx-df-body { transition: none; } }

/* định dạng bản vẽ: biểu mẫu ngắn trong hội thoại sau khi gửi file, bấm Bắt đầu vẽ mới gửi BCC Nexus */
#popNexusWindow .nd-ask { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
#popNexusWindow .nd-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#popNexusWindow .nd-opts label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#popNexusWindow .nd-opts label.w { grid-column: 1 / -1; }
#popNexusWindow .nd-opts label > span { font-size: 11px; line-height: 14px; color: #6b7280; }
#popNexusWindow .nd-opts :where(input):is(input, select):not(#\#), #popNexusWindow .nd-opts :where(select):is(input, select):not(#\#) { box-sizing: border-box; width: 100%; height: 34px !important; min-height: 0 !important; margin: 0; padding: 0 8px; border: 1px solid #d1d5db !important; border-radius: 8px; background: #fff !important; box-shadow: none !important; color: #111827; font: 400 13px Roboto, Arial, sans-serif; }
#popNexusWindow .nd-opts textarea:not(#\#) { box-sizing: border-box; width: 100%; min-height: 56px; margin: 0; padding: 7px 8px; border: 1px solid #d1d5db !important; border-radius: 8px; background: #fff !important; box-shadow: none !important; color: #111827; font: 400 13px/18px Roboto, Arial, sans-serif; resize: vertical; }
html.bms-phone-v2 #popNexusWindow .nd-opts textarea:not(#\#) { font-size: 15px; line-height: 20px; }
#popNexusWindow .nd-ask-done { white-space: pre-line; }
#popNexusWindow .nd-ask .nd-start:not(#\#) { align-self: flex-start; height: 36px !important; min-height: 0 !important; width: auto !important; padding: 0 18px; border: 0 !important; border-radius: 8px; background: #0f766e !important; color: #fff !important; font: 500 14px Roboto, Arial, sans-serif; cursor: pointer; }
#popNexusWindow .nd-ask .nd-start:disabled { opacity: .6; cursor: default; }
#popNexusWindow .nd-ask-done { margin: 4px 0 0; color: #0f766e; font-size: 13px; font-weight: 500; }
html.bms-phone-v2 #popNexusWindow .nd-opts :where(input):is(input, select):not(#\#), html.bms-phone-v2 #popNexusWindow .nd-opts :where(select):is(input, select):not(#\#) { height: 40px !important; font-size: 15px; }
html.bms-phone-v2 #popNexusWindow .nd-ask .nd-start:not(#\#) { height: 42px !important; font-size: 15px; }


/* điện thoại xoay ngang: bảng công cụ mở trong ô hỏi không được đẩy ô hỏi ra ngoài khung */
@media (orientation: landscape) and (max-height: 500px) {
  html.bms-phone-v2.ph-nexus-open #popNexusWindow:not([hidden]):not(#\#):has(.pop-nexus-composer.nx-tools-open) { height: 92vh !important; }
  html.bms-phone-v2.ph-nexus-open #popNexusWindow .pop-nexus-composer.nx-tools-open > .ph-nx-picker:not(#\#) { max-height: 46vh !important; overflow-y: auto !important; }
}

/* nút × thoát chế độ: lớp ::after của .ph-nx-chip (vùng chạm rộng) phủ lên nút, chuột bấm không trúng */
#popNexusWindow .ph-nx-moderow .nx-mode-pill:not(#\#)::after { content: none !important; }
#popNexusWindow .ph-nx-moderow .nx-mode-pill .nm-x:not(#\#) { position: relative; z-index: 1; }
