/**
 * Văn phòng 3D làm trang chính (specs/019-van-phong-3d) — kiểu dáng các phần mới: bảng tên / bong bóng kiểu bản thử, dòng báo, mặt bằng 2D đầy sân khấu.
 * [no-test] (CSS — chủ dự án duyệt ở Gate 2026-11-16); nạp sau css/office3d.css để đè các lớp cũ mà test vẫn đọc (.status-pill.*, .agent-badge-card).
 */

/* ---- Bảng tên "Tên · vai ngắn" (CSS2D): nhỏ gọn, chấm màu trạng thái — không hoạt hình chạy liên tục (SC-005) */
.office-nameplate .agent-badge-card {
  gap: 6px;
  padding: 3px 9px 3px 7px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  background: rgba(20, 30, 38, 0.86);
  color: #ffffff;
  border: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.office-nameplate:hover .agent-badge-card {
  background: rgba(31, 78, 95, 0.95);
}
.office-nameplate .status-pill {
  display: inline-block;
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  animation: none;
  font-size: 0;
}
.office-nameplate .status-pill.doing { background: #0a84ff; }
.office-nameplate .status-pill.review { background: #ff9f0a; }
.office-nameplate .status-pill.free { background: #34c759; }
.office-nameplate .status-pill.notools { background: #9aa0a6; }

/* ---- Bong bóng lời (đang làm / chờ anh) */
.office-bubble {
  position: relative;
  max-width: 230px;
  padding: 4px 10px;
  border-radius: 11px;
  background: #ffffff;
  color: #1d2b31;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}
.office-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #ffffff;
  border-bottom: 0;
}
.office-bubble[hidden] { display: none; }
/* Bong bóng luôn nằm trên mọi bảng tên: CSS2DRenderer đặt z-index theo khoảng cách cho từng nhãn, bảng tên người ngồi cạnh (nâng cao 0,62 m) che mất
   lời của người bên cạnh khi nhìn chéo. */
.css2d-label.office-bubble { z-index: 100000 !important; }

/* ---- Nút ở thanh dưới (Bên trong / Bên ngoài, Ban ngày / Chiều tối, 3D / 2D): chữ một dòng */
.myoffice-dock .view-btn { white-space: nowrap; }

/* ---- Dòng báo của văn phòng (không vẽ được 3D / mất kết nối với server) */
.office-notice {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.office-notice p {
  margin: 0;
  padding: 7px 14px;
  border-radius: 16px;
  background: rgba(15, 25, 30, 0.82);
  color: #ffffff;
  font-size: 12.5px;
  white-space: nowrap;
}
.office-notice p[data-notice="offline"] { background: rgba(178, 74, 30, 0.9); }
.office-notice p[hidden] { display: none; }

/* ---- Mặt bằng 2D: đầy sân khấu (đè khung thẻ nhỏ của sơ đồ 8 phòng cũ) */
#plan-wrapper {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 18px 18px 86px;
  border: 0;
  border-radius: 0;
  background: #eef3f5;
}
#plan-wrapper svg#plan {
  width: 100%;
  height: 100%;
  display: block;
}
#plan .office-seat:focus { outline: none; }
#plan .office-seat:focus circle:first-of-type,
#plan .office-seat:hover circle:first-of-type { stroke-width: 0.18; }

/* ---- Thẻ hồ sơ nhân viên bên phải (FR-007) — nổi trên sân khấu 3D, cuộn riêng */
.office-profile {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 86px;
  z-index: 25;
  width: min(360px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  overflow-y: auto;
  border-radius: 14px;
  /* gần đặc, không đặc hẳn: lớp đặc che canvas WebGL làm trình duyệt chạy ẩn (WebGL phần mềm) vẽ đen phần canvas dưới khung */
  background: rgba(255, 255, 255, 0.985);
  color: #1d2b31;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.office-profile[hidden] { display: none; }
.office-profile-head { position: relative; padding-right: 28px; }
.office-profile-head h3 { margin: 0 0 2px; font-size: 18px; }
.office-profile-role { color: #4a5d66; font-weight: 600; }
.office-profile-status { display: flex; align-items: center; gap: 7px; margin: 6px 0 4px; font-weight: 600; }
.office-profile-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; }
.office-profile-row { display: grid; grid-template-columns: 88px 1fr; gap: 6px; margin-top: 3px; }
.office-profile-row small { color: #6b7c84; font-size: 11.5px; padding-top: 1px; }
.office-profile-close {
  position: absolute;
  top: -4px;
  right: -6px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #4a5d66;
  font-size: 20px;
  cursor: pointer;
}
.office-profile-close:hover { background: #eef3f5; }
.office-profile-btns { display: flex; gap: 8px; }
.office-profile-btn {
  flex: 1;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: #1f4e5f;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}
.office-profile-btn.alt { background: #e3eef2; color: #1f4e5f; }
.office-profile-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.office-profile-sec { border-top: 1px solid #e3eaed; padding-top: 8px; }
.office-profile-sec h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: #4a5d66; }
.office-profile-sec ul { margin: 0; padding-left: 18px; }
.office-profile-sec p { margin: 2px 0; }
.office-profile-muted { color: #6b7c84; }
.office-profile-spec { color: #8a989e; font-size: 11.5px; }

/* ---- Bảng tiến độ phẳng của phòng họp (FR-015) và sơ đồ tổ chức (FR-014) — nổi giữa sân khấu, cùng một chỗ (mở cái này đóng cái kia) */
.office-board,
.office-org {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  width: min(820px, calc(100% - 24px));
  max-height: calc(100% - 110px);
  overflow-y: auto;
  padding: 14px 16px 16px;
  border-radius: 14px;
  /* gần đặc, không đặc hẳn: lớp đặc che canvas WebGL làm trình duyệt chạy ẩn (WebGL phần mềm) vẽ đen phần canvas dưới khung */
  background: rgba(255, 255, 255, 0.985);
  color: #1d2b31;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.office-board[hidden],
.office-org[hidden] { display: none; }
.office-board-head,
.office-org-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.office-board-head h3,
.office-org-head h3 { margin: 0; font-size: 17px; }
.office-board-close,
.office-org-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #4a5d66;
  font-size: 20px;
  cursor: pointer;
}
.office-board-close:hover,
.office-org-close:hover { background: #eef3f5; }
.office-board-note,
.office-org-note { margin: 0 0 10px; padding: 8px 12px; border-radius: 9px; background: #eef3f5; color: #4a5d66; }
.office-board-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.office-board-col h4 { margin: 0 0 6px; padding: 5px 10px; border-radius: 8px; color: #ffffff; font-size: 12.5px; }
.office-board-col[data-board-col="doing"] h4 { background: #0a84ff; }
.office-board-col[data-board-col="waiting"] h4 { background: #ff9f0a; }
.office-board-col[data-board-col="recent"] h4 { background: #34a853; }
.office-board-col ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.office-board-row { padding: 7px 9px; border-radius: 9px; background: #f4f7f8; }
.office-board-row[data-status="failed"], .office-board-row[data-status="stale"] { background: #fbf1ec; }
.office-board-who { display: flex; justify-content: space-between; gap: 6px; }
.office-board-status { color: #4a5d66; font-size: 12px; text-align: right; }
.office-board-title { margin: 2px 0; }
.office-board-meta { color: #6b7c84; font-size: 11.5px; }
.office-board-none { margin: 0; color: #8a989e; text-align: center; }
@media (max-width: 640px) {
  .office-board-cols { grid-template-columns: 1fr; }
}
/* Lớp nhãn CSS2D (bảng tên, bong bóng, biển khu vực) là một ngữ cảnh xếp lớp riêng ở dưới thẻ hồ sơ / bảng tiến độ: z-index của từng nhãn (kể cả bong
   bóng 100000 ở trên) chỉ so với nhau, không nổi lên trên các khung đó. */
.office3d-labels { z-index: 1; }

/* ---- Sơ đồ tổ chức: mỗi team một cột Manager → Leader → Member */
.office-org-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.office-org-team, .office-org-others { padding: 10px 12px; border-radius: 12px; background: #f4f7f8; }
.office-org-team h4, .office-org-others h4 { margin: 0 0 8px; font-size: 13px; color: #1f4e5f; }
.office-org-others { margin-top: 12px; }
.office-org-level { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.office-org-label { color: #6b7c84; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.office-org-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.office-org-arrow { text-align: center; color: #9aa0a6; line-height: 1.1; margin: 2px 0; }
.office-org-person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid #dfe7ea;
  border-radius: 999px;
  background: #ffffff;
  color: #1d2b31;
  font: inherit;
  cursor: pointer;
}
.office-org-person:hover { border-color: #1f4e5f; }
.office-org-person small { color: #6b7c84; font-size: 11px; }
.office-org-dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; }
.office-org-none { color: #8a989e; }

/* ---- Khung nói chuyện riêng (specs/020 FR-007) — cùng chỗ, cùng kiểu với thẻ hồ sơ; vẽ ở js/presentation/chat-panel.js */
.office-chat {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 86px;
  z-index: 26;
  /* rộng theo màn hình (thử tay chủ dự án 2026-11-17: khung nhỏ, chữ khó đọc) */
  width: min(clamp(400px, 30vw, 560px), calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
  border-radius: 20px;
  /* gần đặc, không đặc hẳn (như thẻ hồ sơ): lớp đặc che canvas WebGL làm trình duyệt chạy ẩn vẽ đen phần canvas dưới khung */
  background: rgba(255, 255, 255, 0.985);
  color: #1d2b31;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 18px 50px rgba(15, 37, 48, 0.3);
}
.office-chat[hidden] { display: none; }
/* Kiểu dáng B "Tin nhắn" (chủ dự án chọn 2026-11-17): vòng chữ đầu tên (--chat-initial do chat-panel.js đặt), nhãn tròn, bong bóng trắng có viền. */
.office-chat-head { display: grid; gap: 2px; padding-bottom: 4px; }
.office-chat-head h3 { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; font-size: 17px; }
.office-chat-head h3::before {
  content: var(--chat-initial, "?");
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a7a93, #1d4f62);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}
.office-chat-back {
  justify-self: start;
  padding: 3px 9px;
  border: 0;
  border-radius: 8px;
  background: #e3eef2;
  color: #1f4e5f;
  font-weight: 600;
  cursor: pointer;
}
.office-chat-back:hover { background: #d3e5eb; }
.office-chat-role { margin-left: 46px; color: #4a5d66; font-weight: 500; font-size: 12px; }
.office-chat-status { display: flex; align-items: center; gap: 7px; margin-left: 46px; font-weight: 600; }
.office-chat-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; }
.office-chat-project,
.office-chat-budget {
  justify-self: start;
  margin-left: 46px;
  padding: 1px 9px;
  border-radius: 999px;
  background: #eef3f5;
  color: #4a5d66;
  font-size: 11px;
}
.office-chat-notice { margin: 0; padding: 6px 10px; border-radius: 8px; background: #fff3e0; color: #8a4b00; font-size: 12.5px; }
.office-chat-notice[hidden] { display: none; }
.office-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 14px;
  background: #f4f8f9;
}
.office-chat-entry { max-width: 88%; padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; }
.office-chat-entry.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2a6b80, #1d4f62);
  color: #ffffff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 6px rgba(29, 79, 98, 0.25);
}
.office-chat-entry.assistant {
  position: relative;
  align-self: flex-start;
  margin-left: 30px;
  max-width: calc(100% - 34px);
  background: #ffffff;
  border: 1px solid #dfe8eb;
  border-bottom-left-radius: 5px;
  color: #1d2b31;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.office-chat-entry.assistant::before {
  content: var(--chat-initial, "?");
  position: absolute;
  left: -30px;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1d4f62;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: normal;
}
.office-chat-entry.tool,
.office-chat-entry.note { align-self: center; max-width: 94%; padding: 3px 11px; border-radius: 999px; background: #e1edf1; color: #1f4e5f; font-size: 11.5px; }
.office-chat-entry.job { align-self: stretch; max-width: none; padding: 5px 9px; border-radius: 12px; background: #ffffff; border: 1px dashed #c9d6db; color: #4a5d66; font-size: 12px; }
.office-chat-entry.error { align-self: stretch; max-width: none; background: #fdecea; color: #a12a1d; font-size: 12.5px; }
/* Câu trả lời của Claude vẽ theo ChatThread.richText (020 FR-007): đoạn, gạch đầu dòng hai cấp, đậm, mã. */
.office-chat-entry.assistant .office-chat-p { margin: 0 0 6px; }
.office-chat-entry.assistant .office-chat-ul { margin: 0 0 6px; padding-left: 18px; }
.office-chat-entry.assistant .office-chat-p:last-child,
.office-chat-entry.assistant .office-chat-ul:last-child { margin-bottom: 0; }
.office-chat-entry.assistant li { margin: 2px 0; }
.office-chat-entry.assistant li.l2 { margin-left: 16px; list-style-type: circle; }
.office-chat-entry.assistant .office-chat-h { font-size: 13.5px; }
.office-chat-entry.assistant code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; background: #dbe5e9; padding: 0 4px; border-radius: 4px; }
.office-chat-form { display: flex; gap: 8px; align-items: flex-end; }
.office-chat-input {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  padding: 9px 13px;
  border: 1px solid #d9e4e8;
  border-radius: 18px;
  font: inherit;
  color: inherit;
  background: #f4f8f9;
}
.office-chat-input:focus { outline: 2px solid #8fc1d1; border-color: #8fc1d1; }
.office-chat-form .office-profile-btn { flex: none; padding: 9px 14px; border-radius: 18px; }

/* ---- Khung nhóm chung của dự án (specs/021 FR-001) — vẽ ở js/presentation/group-panel.js; cùng chỗ bên phải với thẻ hồ sơ / khung nói chuyện, rộng hơn;
   kiểu dáng B của khung nói chuyện (vòng chữ đầu tên --member-initial do group-panel.js đặt, nhãn tròn, bong bóng trắng có viền). */
.office-group {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 86px;
  z-index: 27;
  /* rộng theo màn hình (thử tay chủ dự án 2026-11-17) */
  width: min(clamp(480px, 38vw, 720px), calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.985);
  color: #1d2b31;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 18px 50px rgba(15, 37, 48, 0.3);
}
.office-group[hidden] { display: none; }
.office-group-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; }
.office-group-head h3 { margin: 2px 0 0; font-size: 17px; color: #1d4f62; }
.office-group-close { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #e3eef2; color: #1f4e5f; font-size: 17px; cursor: pointer; }
.office-group-close:hover { background: #d3e5eb; }
.office-group-budget { grid-column: 1 / -1; justify-self: start; padding: 1px 9px; border-radius: 999px; background: #eef3f5; color: #4a5d66; font-size: 11px; }
.office-group-members { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0 6px; border-bottom: 1px solid #e3ecef; }
.office-group-member {
  position: relative;
  flex: none;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 58px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: #1d2b31;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.office-group-member::before {
  content: var(--member-initial, "?");
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a7a93, #1d4f62);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}
.office-group-member:hover::before { box-shadow: 0 0 0 3px #bfe0ea; }
.office-group-dot { position: absolute; top: 26px; left: 30px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #ffffff; }
.office-group-name { max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-group-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 14px;
  background: #f4f8f9;
}
.office-group-entry { max-width: 92%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; }
.office-group-entry.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2a6b80, #1d4f62);
  color: #ffffff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 6px rgba(29, 79, 98, 0.25);
}
.office-group-attach { margin-top: 4px; font-size: 11.5px; opacity: 0.9; }
.office-group-entry.say,
.office-group-entry.is-card {
  position: relative;
  align-self: flex-start;
  margin-left: 30px;
  max-width: calc(100% - 34px);
  background: #ffffff;
  border: 1px solid #dfe8eb;
  border-bottom-left-radius: 5px;
  color: #1d2b31;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.office-group-entry.say::before,
.office-group-entry.is-card::before {
  content: var(--member-initial, "?");
  position: absolute;
  left: -30px;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1d4f62;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: normal;
}
.office-group-who { font-size: 12px; font-weight: 700; color: #1f4e5f; margin-bottom: 2px; }
.office-group-entry.tool,
.office-group-entry.note { align-self: center; max-width: 94%; padding: 4px 12px; border-radius: 999px; background: #e1edf1; color: #1f4e5f; font-size: 12.5px; }
.office-group-entry.tool .office-group-who,
.office-group-entry.note .office-group-who { display: inline; margin: 0 4px 0 0; }
.office-group-entry.tool .office-group-text,
.office-group-entry.note .office-group-text { display: inline; }
.office-group-entry.error { align-self: stretch; max-width: none; background: #fdecea; color: #a12a1d; font-size: 12.5px; }
/* Thẻ trong nhóm (kế hoạch, thiết kế, câu hỏi…): bong bóng có viền đứt như thẻ việc của khung nói chuyện; trạng thái là nhãn tròn. */
.office-group-entry.is-card { border-style: dashed; border-color: #c9d6db; }
.office-group-card-status { display: inline-block; margin: 6px 0 2px; padding: 1px 10px; border-radius: 999px; background: #eef3f5; color: #4a5d66; font-size: 12px; }
.office-group-card-status[data-plan-status="approved"] { background: #e3f6e8; color: #1e6b34; }
.office-group-card-status[data-plan-status="superseded"],
.office-group-card-status[data-plan-status="stopped"] { background: #f1f1f1; color: #7a8288; }
.office-group-entry.is-card .office-chat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.office-group-entry.is-card .office-profile-btn { padding: 6px 14px; border-radius: 14px; font-size: 13px; }
.office-group-entry.is-card .office-profile-btn[disabled] { opacity: 0.45; cursor: default; }
/* Thẻ thiết kế (021 US3): dòng kiểm 57 (còn lỗi → đỏ), ghi chú phòng ngoài căn, nút xác nhận khi còn lỗi; thẻ đã chấp nhận → nhãn xanh. */
.office-group-card-check { margin-top: 4px; font-size: 12px; color: #1e6b34; }
.office-group-card-check[data-group-check="errors"] { color: #a12a1d; font-weight: 600; }
.office-group-notes { margin: 4px 0 0; padding-left: 18px; font-size: 11.5px; color: #8a5a00; }
.office-group-card-status[data-design-status="accepted"] { background: #e3f6e8; color: #1e6b34; }
.office-group-entry.is-card .office-profile-btn.warn { background: #fdecea; color: #a12a1d; }
.office-group-entry.is-card .office-profile-btn[hidden] { display: none; }
/* Thẻ câu hỏi (021 US3): chuỗi chuyển Hà → Điền → Minh → anh, lựa chọn, ô chữ trả lời; đã trả lời → nhãn xanh. */
.office-group-chain { margin-top: 2px; font-size: 11px; color: #6b7c84; }
/* Lựa chọn trả lời: bề rộng theo chữ, xuống hàng tự nhiên (nhãn dài — vd danh sách phòng bỏ — chiếm cả hàng thay vì thành cột hẹp). */
.office-group-entry.is-card .office-profile-btn[data-group-answer] { flex: 0 1 auto; text-align: left; }
.office-group-card-status[data-question-status="answered"] { background: #e3f6e8; color: #1e6b34; }
.office-group-card-status[data-question-status="expired"] { background: #f1f1f1; color: #7a8288; }
.office-group-answer-form { display: flex; gap: 6px; margin-top: 6px; }
.office-group-answer-text { flex: 1; min-width: 0; padding: 5px 10px; border: 1px solid #c9d6db; border-radius: 14px; font: inherit; font-size: 12px; }
.office-group-card-status[data-resume-status="resumed"] { background: #e3f6e8; color: #1e6b34; }
/* specs/022 — thẻ kế hoạch dựng: trạng thái theo bước dựng thật (data-build-status nằm trên thẻ). */
.is-card[data-group-card="build"][data-build-status="built"] .office-group-card-status { background: #e3f6e8; color: #1e6b34; }
.is-card[data-group-card="build"][data-build-status="buildWaiting"] .office-group-card-status { background: #fff4d6; color: #7a5a00; }
.is-card[data-group-card="build"][data-build-status="buildError"] .office-group-card-status,
.is-card[data-group-card="build"][data-build-status="buildFailed"] .office-group-card-status { background: #fde8e6; color: #9b2c1f; }
.is-card[data-group-card="build"][data-build-status="superseded"],
.is-card[data-group-card="build"][data-build-status="buildRejected"],
.is-card[data-group-card="build"][data-build-status="buildExpired"] { opacity: 0.75; }
.is-card[data-group-card="build"] [data-build-line] { font-size: 12.5px; }
/* Phần kế hoạch nhóm chung trên bảng tiến độ phẳng (021 US4): dòng theo người + ô từng căn tô theo trạng thái thật. */
.office-board-plan { margin: 6px 0 10px; padding: 8px 10px; border-radius: 10px; background: #f4f8f9; border: 1px solid #dfe8eb; }
.office-board-plan h4 { margin: 0 0 6px; font-size: 13px; }
.office-board-plan-line { margin: 4px 0; font-size: 12.5px; }
.office-board-plan-units { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.office-board-plan-unit { padding: 1px 8px; border-radius: 999px; background: #eef3f5; color: #4a5d66; font-size: 11px; }
.office-board-plan-unit[data-status="running"] { background: #e1efff; color: #0a5bd6; }
.office-board-plan-unit[data-status="waitingAnswer"], .office-board-plan-unit[data-status="waitingAccept"] { background: #fff1dc; color: #8a5a00; }
.office-board-plan-unit[data-status="accepted"], .office-board-plan-unit[data-status="handedOver"] { background: #e3f6e8; color: #1e6b34; }
.office-board-plan-unit[data-status="failed"], .office-board-plan-unit[data-status="interrupted"] { background: #fdecea; color: #a12a1d; }
/* specs/022 — dòng "Dựng thông gió · Mai": ô căn theo bước dựng. */
.office-board-plan-unit[data-status="built"] { background: #e3f6e8; color: #1e6b34; }
.office-board-plan-unit[data-status="buildWaiting"], .office-board-plan-unit[data-status="applying"] { background: #fff1dc; color: #8a5a00; }
.office-board-plan-unit[data-status="buildError"], .office-board-plan-unit[data-status="buildFailed"] { background: #fdecea; color: #a12a1d; }
/* Xem tệp kế hoạch / tiến độ (chỉ xem — FR-008). */
.office-group-file { max-height: 55%; display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 12px; background: #fbfcfc; border: 1px solid #dfe8eb; }
.office-group-file[hidden] { display: none; }
.office-group-file-head { display: flex; align-items: center; justify-content: space-between; color: #1f4e5f; }
.office-group-file-doc { flex: 1; min-height: 0; overflow: auto; font-size: 13px; line-height: 1.5; }
.office-group-file-doc .office-chat-p { margin: 0 0 6px; white-space: pre-wrap; }
.office-group-file-doc .office-chat-h { margin-top: 8px; font-size: 14px; color: #1d4f62; }
.office-group-file-doc .office-chat-ul { margin: 0 0 6px; padding-left: 18px; }
.office-group-entry .office-chat-p { margin: 0 0 6px; }
.office-group-entry .office-chat-ul { margin: 0 0 6px; padding-left: 18px; }
.office-group-entry .office-chat-p:last-child,
.office-group-entry .office-chat-ul:last-child { margin-bottom: 0; }

/* ---- Chip chi phí API Claude trên thanh trên (specs/020 FR-004, FR-006) — chữ đặt ở js/app/chat-boot.js */
.budget-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2, #c9d6db);
  background: var(--card, #ffffff);
  color: var(--ink, #1d2b31);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.budget-chip:empty { display: none; }
.budget-chip[data-mock="true"] { color: #6b7c84; }
/* Kiểu dáng B: chạy thật thì chip có thanh đã dùng chạy ngầm sau chữ — --pct + data-level do chat-panel.js đặt (ChatThread.budgetGauge). */
.budget-chip[data-level] {
  background: linear-gradient(90deg, var(--gauge-fill) 0 var(--pct, 0%), var(--card, #ffffff) var(--pct, 0%) 100%);
}
.budget-chip[data-level="ok"] { --gauge-fill: rgba(52, 199, 89, 0.38); border-color: rgba(52, 199, 89, 0.6); }
.budget-chip[data-level="warn"] { --gauge-fill: rgba(255, 159, 10, 0.42); border-color: rgba(255, 159, 10, 0.75); }
.budget-chip[data-level="high"] { --gauge-fill: rgba(255, 69, 58, 0.45); border-color: rgba(255, 69, 58, 0.8); }

/* ---- Sau thử tay của chủ dự án (specs/021, video 2026-11-17): dấu "… đang trả lời", thanh chờ duyệt, bảng trong tệp / câu trả lời. */
.office-group-typing,
.office-chat-typing {
  position: relative;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 30px;
  padding: 7px 13px;
  border-radius: 16px;
  border-bottom-left-radius: 5px;
  background: #ffffff;
  border: 1px solid #dfe8eb;
  color: #4a5d66;
  font-size: 13px;
  font-style: italic;
}
.office-group-typing::before,
.office-chat-typing::before {
  content: var(--member-initial, var(--chat-initial, "?"));
  position: absolute;
  left: -30px;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1d4f62;
  color: #ffffff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.office-typing-dots { display: inline-flex; gap: 4px; }
.office-typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: #7f9aa4; animation: office-typing 1.2s infinite ease-in-out; }
.office-typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.office-typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes office-typing { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .office-typing-dots i { animation: none; opacity: 0.6; } }
/* Thanh "Kế hoạch bản N chờ anh duyệt" ngay trên ô nhập (FR-009). */
.office-group-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff6e5;
  border: 1px solid #f1d49b;
  color: #6b4b00;
  font-weight: 600;
}
.office-group-pending[hidden] { display: none; }
.office-group-pending .office-chat-actions { display: flex; gap: 6px; }
.office-group-pending .office-profile-btn { padding: 6px 14px; border-radius: 14px; font-size: 13px; white-space: nowrap; }
.office-group-pending-text { flex: 1 1 200px; min-width: 0; }
/* Bảng (ChatThread.richText) trong tệp kế hoạch / tiến độ và câu trả lời của Claude. */
.office-chat-table { width: 100%; margin: 4px 0 8px; border-collapse: collapse; font-size: 12.5px; line-height: 1.4; white-space: normal; }
.office-chat-table th,
.office-chat-table td { padding: 4px 8px; border: 1px solid #dfe8eb; text-align: left; vertical-align: top; }
.office-chat-table th { background: #eef3f5; color: #1f4e5f; font-weight: 700; }
.office-chat-table tbody tr:nth-child(even) td { background: #f8fbfc; }

/* ===== Cột trái danh sách dự án (specs/023 FR-006) — vẽ ở js/presentation/project-panel.js ===== */
.project-list {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 86px;
  z-index: 24;
  width: min(220px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  border-radius: 14px;
  /* gần đặc như thẻ hồ sơ — lớp đặc che canvas WebGL làm trình duyệt chạy ẩn vẽ đen */
  background: rgba(255, 255, 255, 0.985);
  color: #1d2b31;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.proj-head { font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: #4a5d66; }
.proj-empty { color: #4a5d66; font-size: 12.5px; }
.proj-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.proj-item { position: relative; display: flex; flex-direction: column; padding: 7px 30px 7px 9px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.proj-item:hover, .proj-item:focus { background: #eef4f6; outline: none; }
.proj-item.is-selected { background: #e1eef2; border-color: #9cc3cf; }
.proj-item.is-selected .proj-name { font-weight: 700; }
.proj-code { font-size: 11.5px; color: #4a5d66; }
.proj-model { font-size: 11.5px; color: #6b7c84; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-waiting { position: absolute; top: 7px; right: 8px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #d64545; color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.proj-actions, .proj-form { display: flex; flex-wrap: wrap; gap: 6px; }
.proj-form input { flex: 1 1 100%; padding: 5px 7px; border: 1px solid #c9d6db; border-radius: 7px; font: inherit; }
.proj-btn { padding: 4px 9px; border: 1px solid #c9d6db; border-radius: 7px; background: #fff; color: #1d2b31; font: inherit; font-size: 12px; cursor: pointer; }
.proj-btn:hover { background: #eef4f6; }
.proj-error { color: #b42318; font-size: 12px; }
/* 023 — mục "Chưa rõ dự án" cuối cột trái + danh sách chuyển sang dự án */
.project-list .proj-unknown .proj-name { font-style: italic; }
.project-list .proj-unknown-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 6px; }
.project-list .proj-unknown-label { flex: 1 1 100%; font-size: 12px; }
/* 023 — "Chờ anh" gom mọi dự án: nút trên thanh trên + danh sách thả xuống; thẻ nhóm được mở từ đó có viền nổi */
.waiting-wrap { position: relative; display: inline-flex; }
.waiting-btn.has-waiting { background: #d64545; color: #fff; border-color: #d64545; }
.waiting-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: min(420px, 90vw); max-height: 60vh; overflow-y: auto; padding: 6px; border-radius: 10px; background: #fff; color: #1f2933; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.waiting-list[hidden] { display: none; }
.waiting-item { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; width: 100%; padding: 8px; border: 0; border-bottom: 1px solid #e5e7eb; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.waiting-item:last-child { border-bottom: 0; }
.waiting-item:hover { background: #f3f4f6; }
.waiting-kind { font-weight: 700; font-size: 12px; color: #b42318; }
.waiting-project { font-size: 12px; color: #4b5563; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waiting-at { font-size: 11px; color: #6b7280; }
.waiting-text { grid-column: 1 / -1; font-size: 13px; }
.waiting-empty { padding: 10px; font-size: 13px; color: #6b7280; }
#groupLog [data-focus] { outline: 2px solid #d64545; outline-offset: 2px; }
/* 023 — chi tiết chi phí theo dự án dưới chip chi phí */
.budget-wrap { position: relative; display: inline-flex; }
.budget-chip { cursor: pointer; }
.budget-detail { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 280px; padding: 8px; border-radius: 10px; background: #fff; color: #1f2933; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13px; }
.budget-detail[hidden] { display: none; }
.budget-detail-head { font-weight: 700; margin-bottom: 6px; }
.budget-detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid #e5e7eb; }
.budget-detail-total { font-weight: 700; }
.budget-detail-empty { color: #6b7280; }

/* ── specs/024: ô phần trong thẻ (nhóm / khung riêng), dòng "Hà đang", nút Dừng ─────────────────────────────── */
.office-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.office-parts[hidden] { display: none; }
.office-part { border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 8px; background: #f9fafb; font-size: 12px; }
.office-part[data-status="chot"] { border-color: #16a34a; background: #f0fdf4; }
.office-part[data-status="ai"] { border-color: #2563eb; background: #eff6ff; }
.office-part[data-status="nhap"] { opacity: 0.7; }
.office-part[data-review="1"] { border-color: #d97706; box-shadow: inset 0 0 0 1px #d97706; }
.office-part-name { font-weight: 700; }
.office-part-status { color: #4b5563; margin: 2px 0; }
.office-part-sum { color: #111827; }
.office-part-actions { display: flex; gap: 4px; margin-top: 4px; }
.office-part-btn { font-size: 11px; padding: 2px 8px; border-radius: 6px; border: 1px solid #9ca3af; background: #fff; cursor: pointer; }
.office-part-btn.alt { border-color: #d97706; }
.office-part-btn:disabled { opacity: 0.5; cursor: default; }
.office-chat-job-activity { font-size: 12px; color: #1d4ed8; margin: 4px 0; }
.office-chat-job-activity[hidden] { display: none; }
.stop-all-btn { color: #b91c1c; }
.proj-item [data-project-stop] { margin-left: auto; font-size: 11px; }

/* Đăng nhập khi dùng chung (specs/025) — ô đăng nhập phủ cả trang; tên người trên thanh trên. */
/* color-scheme light: trang khai báo giao diện tối → trình duyệt tô ô nhập màu tối (VPS 2026-11-20: hai ô đăng nhập bị đen). */
.login-screen { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: #eef2f5;
  color-scheme: light; }
.login-screen[hidden] { display: none; }
.login-card { display: flex; flex-direction: column; gap: 12px; width: min(340px, calc(100vw - 32px)); padding: 28px; background: #fff; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(20, 40, 60, .15); font: 14px/1.4 system-ui, sans-serif; color: #1d2b36; }
.login-card label { display: flex; flex-direction: column; gap: 4px; }
.login-card input { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid #c5d0d9; border-radius: 6px; font: inherit;
  background: #fff; color: #1d2b36; }
.login-card input:focus { outline: 2px solid #e8875a; outline-offset: 1px; border-color: #e8875a; }
.login-card .btn { justify-content: center; padding: 10px; font-size: 15px; font-weight: 600; }
.login-logo { width: 160px; align-self: center; margin-bottom: 6px; }
.login-error { min-height: 1.2em; color: #c0392b; }
.user-chip { color: #e8f0f5; font-size: 13px; white-space: nowrap; }

/* Kết nối Revit của tôi (specs/025) */
.revit-mine { position: absolute; top: 48px; right: 16px; z-index: 900; width: 360px; padding: 12px 14px; background: #fff; color: #223; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 13px; }
.revit-mine[hidden] { display: none; }
.revit-mine-row { margin-bottom: 6px; word-break: break-all; }
.revit-mine-note { color: #667; margin: 6px 0; }
.revit-mine-title { margin-top: 10px; font-weight: 600; }
.revit-mine-list { margin: 4px 0 0; padding-left: 18px; }
