/* ==========================================================================
   Khung làm việc Web Modeler (specs/013-ui-workspace)
   Toàn màn hình, nền sáng, một màu nhấn; cột kết quả bên trái, bản vẽ to bên phải.
   Mọi quy tắc nằm trong phạm vi #twoTeamsModal.ws — không đụng trang văn phòng 3D.
   ========================================================================== */

#twoTeamsModal.ws {
  /* Bảng màu riêng của khung (luôn sáng, không theo giao diện tối của trang ngoài). */
  --bg: #F4F5F7;
  --bar: #FFFFFF;
  --side: #FFFFFF;
  --card: #FFFFFF;
  --card-2: #F4F5F7;
  --card-3: #E5E7EB;
  --sheet: #FFFFFF;
  --paper: #F4F5F7;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #5B6472;
  --faint: #8A93A2;
  --line: #E5E7EB;
  --line-2: #D1D5DB;
  /* Màu nhấn = xanh của logo Kuub Engineering (#1D4F62) */
  --accent: #1D4F62;
  --accent-hi: #163E4E;
  --accent-soft: #E8F0F3;
  --accent-line: #8FB0BD;
  --on-accent: #FFFFFF;
  --green: #15803D;
  --amber: #B45309;
  --red: #B91C1C;
  color-scheme: light;

  position: fixed;
  inset: 0;
  z-index: 85;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.ws .ws-frame {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

/* ---------------------------------------------------------------- thanh trên cùng */
.ws .ws-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 56px;
  flex: none;
  padding: 0 16px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.ws .ws-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ws .ws-brand-logo { display: block; height: 30px; width: auto; flex: none; }
.ws .ws-brand-name { font-weight: 700; font-size: 15px; }
.ws .ws-brand-sub { padding-left: 14px; border-left: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ws .ws-teams { display: flex; align-items: center; gap: 10px; }
.ws .ws-team {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.ws .ws-team:hover { background: var(--card-2); }
.ws .ws-team .ws-step {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card-3);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}
.ws .ws-team.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hi); }
.ws .ws-team.active .ws-step { background: var(--accent); color: #fff; }
.ws .ws-arrow { font-size: 12px; color: var(--faint); white-space: nowrap; }

.ws .ws-top-right { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
/* Đèn kết nối Revit (specs/018) — kiểu chung ở index.html, ở đây chỉ cỡ chữ theo thanh trên của bàn làm việc; lời dài cắt "…" (đủ lời khi rê chuột)
   để các nút bên cạnh không xuống dòng */
.ws .revit-badge { font-size: 12px; max-width: 300px; }
.ws .ws-top-right .ws-link { white-space: nowrap; }
.ws .ws-link {
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ws .ws-link:hover { background: var(--card-2); }
.ws .ws-link.active { background: var(--accent-soft); color: var(--accent-hi); }
.ws .ws-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.ws .ws-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}
.ws .ws-close:hover { background: var(--card-2); }

/* ---------------------------------------------------------------- bố cục màn hình */
.ws .ws-screen {
  flex: 1;
  min-height: 0;
  grid-template-columns: 380px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.ws .ws-screen.ws-modeler { grid-template-columns: 96px 400px minmax(0, 1fr); }
.ws #panelWorkflow2T { background: var(--bg); }

/* Thanh việc (Team Modeler): mỗi lúc một việc */
.ws .ws-rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 6px;
  background: #ECEEF1;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.ws .ws-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}
.ws .ws-nav .ws-nav-ico { color: var(--faint); }
.ws .ws-nav:hover { background: rgba(17, 24, 39, 0.06); color: var(--ink); }
.ws .ws-nav.active { background: #fff; color: var(--accent-hi); box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08); }
.ws .ws-nav.active .ws-nav-ico { color: var(--accent); }

/* Cột kết quả */
.ws .ws-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.ws #wsSide { padding: 16px; gap: 22px; }
.ws #dtSide { overflow: hidden; }
.ws .ws-side-head { padding: 16px 16px 8px; }
.ws .ws-side-title { font-weight: 700; font-size: 16px; }
.ws .ws-side-hint { margin-top: 4px; font-size: 13px; color: var(--muted); }
.ws .ws-side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.ws .ws-side-foot { padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }

/* Chỉ hiện khối của việc đang chọn */
.ws .ws-modeler[data-task="data"] [data-ws-task]:not([data-ws-task~="data"]),
.ws .ws-modeler[data-task="water"] [data-ws-task]:not([data-ws-task~="water"]),
.ws .ws-modeler[data-task="vent"] [data-ws-task]:not([data-ws-task~="vent"]),
.ws .ws-modeler[data-task="check"] [data-ws-task]:not([data-ws-task~="check"]),
.ws .ws-modeler[data-task="draw"] [data-ws-task]:not([data-ws-task~="draw"]),
.ws .ws-modeler[data-task="ai"] [data-ws-task]:not([data-ws-task~="ai"]) { display: none !important; }

.ws .ws-block { min-width: 0; }

.ws .ws-block-title { margin-bottom: 10px; font-weight: 700; font-size: 16px; color: var(--ink); }

/* Chữ nhỏ của các khối cũ (cỡ viết thẳng trong thẻ) → cỡ dễ đọc */
.ws .ws-side [style*="font-size:0.7"],
.ws .ws-side [style*="font-size:0.68"],
.ws .ws-drawer [style*="font-size:0.7"] { font-size: 13px !important; }
.ws .ws-side [style*="max-height"] { max-height: none !important; }
.ws code { padding: 1px 4px; border-radius: 4px; background: var(--card-2); font-size: 0.92em; }

/* ---------------------------------------------------------------- nút và ô nhập */
.ws .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ws .btn:hover { background: var(--card-2); }
.ws .btn.primary, .ws .btn.ok { border-color: var(--accent); background: var(--accent); color: #fff; }
.ws .btn.primary:hover, .ws .btn.ok:hover { background: var(--accent-hi); }
.ws .btn.ghost { background: #fff; border-color: var(--line-2); color: var(--ink); }
.ws .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ws .btn.ws-wide { width: 100%; padding: 10px 12px; font-size: 14px; }

.ws input[type=text], .ws input[type=number], .ws select, .ws textarea {
  width: 100%;
  min-height: 0;
  padding: 7px 9px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}
.ws textarea { resize: vertical; line-height: 1.45; }
.ws input:focus, .ws select:focus, .ws textarea:focus, .ws button:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.ws input[type=checkbox] { width: auto; }
.ws input[type=file] { width: 100%; font-size: 13px; color: var(--muted); }
.ws input[type=file]::file-selector-button {
  margin-right: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ws .ws-field { display: block; margin-top: 10px; font-size: 13px; color: var(--muted); }
.ws .ws-field > input, .ws .ws-field > select, .ws .ws-field > textarea { margin-top: 4px; }
.ws .ws-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.ws .ws-status { margin: 10px 0; font-size: 13px; color: var(--muted); }
/* specs/012b: "🏗️ Lập kế hoạch dựng" là bước cuối của khối Thông gió (sau Đọc / Kiểm 57) — tách khỏi danh sách phía trên. Lỗi lập
   kế hoạch hiện trong #ventStatus: mỗi dòng lý do (NothingToBuild) một dòng, lời gốc của Revit chữ nhỏ. */
.ws #btnVentPlan { margin-top: 14px; }
.ws #ventStatus > div { margin-top: 2px; color: var(--ink-2); }
.ws #ventStatus small { color: var(--muted); }
.ws .ws-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* Thẻ con trong một khối */
.ws .ws-tabs { display: flex; gap: 2px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.ws .ws-tab {
  padding: 8px 12px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ws .ws-tab:hover { color: var(--ink); }
.ws .ws-tab.active { border-bottom-color: var(--accent); color: var(--accent-hi); }

.ws .ws-setup { margin-bottom: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #FAFAFB; }
.ws .ws-setup > summary { font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }

/* Danh sách kết quả: tiêu đề nhóm + dòng, số liệu dễ quét mắt */
.ws .ws-summary { margin: 12px 0 4px; font-size: 14px; font-weight: 600; }
.ws .ws-summary:empty { display: none; }
.ws .ws-group { margin-top: 14px; }
.ws .ws-group:has(> .ws-list:empty):not(:has(.ws-group-actions)) { display: none; }
.ws .ws-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--card-2);
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ws .ws-group-actions { display: inline-flex; gap: 6px; letter-spacing: 0; text-transform: none; }
.ws .ws-group-actions .btn { padding: 4px 9px; font-size: 12.5px; }
.ws .ws-list { font-size: 13px; overflow-wrap: anywhere; }
.ws .ws-list > div { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.ws .ws-list > div:last-child { border-bottom: 0; }
.ws .ws-list:empty { display: none; }
.ws .ws-issues > div:first-child { font-weight: 600; }
.ws .ws-issues .btn { padding: 2px 8px !important; font-size: 12px !important; margin-left: 4px; }

/* ---------------------------------------------------------------- vùng bản vẽ to */
.ws .ws-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #E9EBEF; }
.ws .ws-stagebar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  min-height: 46px;
  padding: 6px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.ws .ws-stage-title { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws .ws-stage-title b { color: var(--ink); font-weight: 700; margin-right: 6px; }
.ws .ws-views, .ws .ws-zoom, .ws .ws-stage-actions { display: flex; gap: 4px; flex: none; }
.ws .ws-views[hidden], .ws .ws-stage-actions[hidden] { display: none; }
.ws .ws-tool {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.ws .ws-tool-text { font-size: 13px; padding: 0 10px; }
.ws .ws-tool:hover { background: var(--card-2); }
.ws .ws-tool.active { border-color: var(--accent); background: var(--accent); color: #fff; }

.ws .ws-viewport { position: relative; flex: 1; min-height: 0; display: flex; overflow: auto; padding: 16px; }
.ws .ws-sheet { display: none; flex: none; margin: auto; background: #fff; box-shadow: 0 1px 4px rgba(17, 24, 39, 0.16); }
.ws .ws-sheet canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.ws .ws-sheet-model { overflow: hidden; border-radius: 4px; }
.ws #webModelerCanvas { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #fff; }
.ws .ws-stage[data-view="model"] .ws-sheet[data-sheet="model"],
.ws .ws-stage[data-view="water"] .ws-sheet[data-sheet="water"],
.ws .ws-stage[data-view="vent"] .ws-sheet[data-sheet="vent"],
.ws .ws-stage[data-view="roof"] .ws-sheet[data-sheet="roof"],
.ws .ws-stage[data-view="pdf"] .ws-sheet[data-sheet="pdf"],
.ws .ws-stage[data-view="design"] .ws-sheet[data-sheet="design"] { display: block; }
.ws .ws-empty {
  display: none;
  margin: auto;
  max-width: 420px;
  padding: 28px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.ws .ws-stage[data-view="empty"] .ws-empty,
.ws .ws-stage.is-blank .ws-empty { display: block; }
.ws .ws-stage.is-blank .ws-sheet { display: none !important; }
.ws .ws-viewport.is-panning { cursor: grabbing; }

/* ---------------------------------------------------------------- Team Thiết kế: ô bản vẽ */
.ws .dt-slot { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.ws .dt-slot:hover { border-color: var(--line-2); }
.ws .dt-slot.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ws .dt-slot.has-file .dt-slot-name::after { content: " ✓"; color: var(--green); }
.ws .dt-slot-name { margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.ws .dt-slot-eg { font-weight: 400; color: var(--faint); font-size: 12.5px; }

/* Team Thiết kế: hai thẻ — bàn giao bản vẽ | thiết kế thông gió (specs/015) */
.ws .dt-tabs { display: flex; gap: 6px; padding: 12px 16px 0; }
.ws .dt-tab {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer;
}
.ws .dt-tab:hover { border-color: var(--line-2); color: var(--ink-2); }
.ws .dt-tab.active { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 2px var(--accent-soft); }
.ws .dv-panel[hidden], .ws [data-dt-pane][hidden] { display: none !important; }
.ws .dv-row { display: flex; gap: 10px; }
.ws .dv-row > .ws-field { flex: 1; min-width: 0; }
.ws .dv-row > .dv-scale { flex: 0 0 96px; }
.ws .dv-block { display: flex; flex-direction: column; gap: 8px; }
.ws .dv-block-title { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.ws .dv-units { display: flex; flex-wrap: wrap; gap: 6px; }
.ws .dv-unit {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 600; font-size: 13px; cursor: pointer;
}
.ws .dv-unit:hover { border-color: var(--line-2); }
.ws .dv-unit.selected { border-color: var(--accent); background: var(--accent-soft); }
.ws .dv-empty { color: var(--faint); font-size: 13px; }
.ws .dv-wtw { font-size: 13px; color: var(--ink-2); }
.ws .dv-rooms { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.ws .dv-rooms:empty { display: none; }
.ws .dv-room {
  display: grid; grid-template-columns: minmax(64px, 1fr) minmax(96px, 1.5fr) 58px 26px; gap: 6px; align-items: center;
  padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.ws .dv-room:last-of-type { border-bottom: 0; }
.ws .dv-room.is-user .dv-room-label::after { content: " ✎"; color: var(--accent); font-weight: 400; }
.ws .dv-room-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws .dv-room select, .ws .dv-room input { min-width: 0; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; background: #fff; }
.ws .dv-room-area { text-align: right; font-variant-numeric: tabular-nums; }
.ws .dv-room-del { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 14px; }
.ws .dv-room-del:hover { color: var(--red); }
.ws .dv-warning { padding: 6px 10px; color: var(--amber); font-size: 12.5px; }
.ws .dv-hint { font-size: 12.5px; color: var(--faint); }
.ws .dv-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.ws .dv-tools .btn.active { border-color: var(--accent); background: var(--accent-soft); }
/* Số đếm to khi tìm tuyến — phương án đang thử vẽ trên bản vẽ lớn (specs/015 FR-007) */
.ws #dtStage { position: relative; }   /* mốc cho số đếm to #designLive */
.ws .dv-live { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 5; padding: 10px 18px; border-radius: 10px;
  background: rgba(17, 24, 39, 0.82); color: #fff; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.ws .dv-live[hidden] { display: none; }
/* Khớp IFC trên mặt bằng 2D (specs/015 FR-016) và câu hỏi của Hà trả lời ngay ở Team Thiết kế (FR-017) */
.ws .dv-ifc-align { display: grid; gap: 6px; margin-top: 4px; }
.ws .dv-ifc-align[hidden] { display: none; }
.ws .dv-ask { display: grid; gap: 8px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); }
.ws .dv-ask[hidden] { display: none; }
.ws .dv-ask-q { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ws .dv-ask-reply { display: flex; gap: 6px; }
.ws .dv-ask-reply input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.ws .dv-panel { overflow-x: hidden; }
.ws .dv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ws .dv-actions .btn { white-space: normal; }
.ws .dv-actions .btn.primary { flex: 1 1 auto; }
/* Ô agent kiểu video: ai đang làm, đã thử bao nhiêu phương án, phương án đang thử ✓ / ✗ */
.ws .dv-progress { display: flex; flex-direction: column; gap: 8px; }
.ws .dv-progress:empty { display: none; }
.ws .dv-agent { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.5px; }
.ws .dv-agent-who { font-weight: 700; font-size: 13px; color: var(--ink); }
.ws .dv-agent-line { margin-top: 4px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ws .dv-agent-now { margin-top: 2px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws .dv-results { display: flex; flex-direction: column; gap: 8px; }
.ws .dv-results:empty { display: none; }
.ws .dv-result { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.5px; }
.ws .dv-result-head { font-weight: 700; font-size: 13px; border-left: 4px solid var(--sys, var(--accent)); padding-left: 8px; }
.ws .dv-result-line { margin-top: 4px; color: var(--ink-2); }
.ws .dv-agent-sketch { display: block; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fafafa; }
.ws .dv-agent-best { margin-top: 2px; color: var(--ink-2); font-weight: 600; }
.ws .dv-agent-best:empty { display: none; }
.ws .dv-list { border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.5px; }
.ws .dv-list > summary { padding: 8px 10px; font-weight: 600; cursor: pointer; }
.ws .dv-row { padding: 6px 10px; border-top: 1px solid var(--line); cursor: pointer; }
.ws .dv-row:hover { background: var(--card-2); }
.ws .dv-row.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.ws .dv-row.dv-error { color: var(--red); }
.ws .dv-row.dv-warn { color: var(--amber); }
.ws .dv-num { float: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ws .dv-confirm { border-color: var(--amber); color: var(--amber); font-weight: 600; }
.ws .dv-confirm[hidden] { display: none; }
.ws .dv-saved { display: flex; flex-direction: column; gap: 6px; }
.ws .dv-saved-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 12.5px; text-align: left; cursor: pointer;
}
.ws .dv-saved-row span { color: var(--muted); }
.ws .dv-saved-row:hover { border-color: var(--line-2); }
.ws .dv-saved-row.selected { border-color: var(--accent); background: var(--accent-soft); }

/* Khung 3D gộp (specs/015, US4): thay chỗ vùng bản vẽ khi bấm 3D; nút 2D / 3D chỉ hiện ở thẻ thiết kế thông gió */
.ws .dv-viewtoggle { display: none; gap: 4px; flex: none; }
.ws .ws-stage[data-view="design"] .dv-viewtoggle,
.ws .ws-stage[data-view="3d"] .dv-viewtoggle { display: flex; }
.ws .dv-3d { display: none; position: relative; flex: 1; min-height: 0; overflow: hidden; background: #F7F8FA; }
.ws .ws-stage[data-view="3d"] .dv-3d { display: block; }
.ws .ws-stage[data-view="3d"] .ws-viewport,
.ws .ws-stage[data-view="3d"] .ws-zoom { display: none; }
.ws .dv-3d-canvas { position: absolute; inset: 0; }
.ws .dv-3d-canvas canvas { display: block; }
.ws .dv-3d-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }
.ws .dv-3d-notice {
  position: absolute; top: 10px; left: 10px; max-width: 50%; padding: 6px 10px; border: 1px solid #F2C27B; border-radius: 8px;
  background: #FFF8EC; font-size: 12.5px;
}
.ws .dv-3d-legend {
  position: absolute; left: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: 70%; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.92); font-size: 12px;
}
.ws .dv-3d-notice:empty, .ws .dv-3d-legend:empty { display: none; }
.ws .dv-3d-legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; background: var(--c); vertical-align: -1px;
}

/* ---------------------------------------------------------------- sổ việc */
.ws .ws-drawer {
  position: absolute;
  top: 56px;
  right: 0;
  bottom: 0;
  z-index: 5;
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(17, 24, 39, 0.12);
}
.ws .ws-drawer[hidden] { display: none; }
.ws .ws-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ws .ws-drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; }
.ws .ws-log-row { display: grid; gap: 3px; }
.ws .ws-log-when { font-size: 12px; color: var(--faint); }
.ws .ws-log-files { font-weight: 600; }
.ws .ws-log-note { color: var(--ink-2); }
.ws .ws-log-state { font-size: 12px; color: var(--muted); }
.ws .ws-log-empty { color: var(--muted); }

@media (max-width: 1100px) {
  .ws .ws-screen { grid-template-columns: 320px minmax(0, 1fr); }
  .ws .ws-screen.ws-modeler { grid-template-columns: 78px 320px minmax(0, 1fr); }
  .ws .ws-arrow { display: none; }
}

/* Dòng kết quả bấm được: rê chuột đổi nền, dòng đang chọn có vạch màu nhấn (bản vẽ chỉ đúng chỗ đó) */
.ws #ventTerminals > div, .ws #ventIssues > div[data-issue] { cursor: pointer; border-left: 3px solid transparent; }
.ws #ventTerminals > div:hover, .ws #ventIssues > div[data-issue]:hover { background: var(--card-2); }
.ws .ws-list > div.selected { background: var(--accent-soft); border-left-color: var(--accent); }
.ws .ws-list > div.ws-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ws .ws-num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ws #ventIssues > div[data-issue] > b { display: inline-block; margin-right: 4px; font-size: 12px; }
/* Nút "Xem trong Revit" chỉ hiện ở dòng đang chọn / đang rê chuột — danh sách đỡ rối */
.ws #ventIssues > div[data-issue] .btn { visibility: hidden; }
.ws #ventIssues > div[data-issue]:hover .btn,
.ws #ventIssues > div[data-issue].selected .btn,
.ws #ventIssues > div[data-issue] .btn:focus-visible { visibility: visible; }

/* Nút không xuống dòng; hàng nút tự xuống hàng khi chật */
.ws .btn { white-space: nowrap; }
.ws .ws-side div[style*="display:flex"][style*="gap:6px"] { flex-wrap: wrap; }
/* Bàn vẽ mô hình: đang xem cả tờ thì ẩn nhãn cỡ ống (chồng chữ) — phóng to thì hiện lại */
.ws .ws-stage[data-zoom="low"] .mep-segment rect,
.ws .ws-stage[data-zoom="low"] .mep-segment text { display: none; }

/* Danh sách tuyến ống nước (013 bước 2): dòng bấm được, ô đổi căn + chiều dài canh phải */
.ws .ws-routes .ws-group { margin-top: 12px; }
.ws #pdfRouteResult [data-route-row] { cursor: pointer; border-left: 3px solid transparent; }
.ws #pdfRouteResult [data-route-row]:hover { background: var(--card-2); }
.ws .ws-row-end { display: inline-flex; align-items: center; gap: 10px; }
.ws .ws-row-end select { width: auto; padding: 2px 6px; font-size: 12px; }
.ws .ws-dim { color: var(--faint); font-size: 12px; }
.ws #pdfGroupTable > div { display: grid; padding: 5px 2px; }
/* Tiêu đề nhóm tuyến có đơn vị (m) — không viết hoa toàn bộ */
.ws .ws-routes .ws-group-head { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* Danh sách lỗi quy tắc (013 bước 2): dòng gọn, bấm được; nút "Xem trong Revit" chỉ hiện ở dòng đang chọn / rê chuột */
.ws #ruleIssues .ws-issue-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; border-left: 3px solid transparent; }
.ws #ruleIssues .ws-issue-row:hover { background: var(--card-2); }
.ws #ruleIssues .ws-issue-row .btn { padding: 2px 8px; font-size: 12px; visibility: hidden; }
.ws #ruleIssues .ws-issue-row:hover .btn,
.ws #ruleIssues .ws-issue-row.selected .btn,
.ws #ruleIssues .ws-issue-row .btn:focus-visible { visibility: visible; }
.ws #ruleFocusNote:empty, .ws #ruleSummary:empty { display: none; }

/* Khối Giao việc AI / Vẽ thêm (013 bước 2) */
.ws .ws-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.ws .ws-callout { margin-top: 12px; padding: 12px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.ws .ws-callout-ask { border-color: #F2C27B; background: #FFF8EC; }
.ws #jobStream:empty, .ws #jobActiveRole:empty, .ws #addSegWarnings:empty, .ws #connInfo:empty { display: none; }
.ws #jobStream { max-height: 320px; overflow-y: auto; margin-top: 8px; }

/* ── specs/024: bàn Thiết kế — thanh bốn phần + lịch sử của bàn vẽ ─────────────────────────────────────── */
.dv-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dv-part { border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 8px; font-size: 12px; background: #fff; }
.dv-part[data-status="chot"] { border-color: #16a34a; background: #f0fdf4; }
.dv-part[data-review="1"] { border-color: #d97706; }
.dv-part[data-active="1"] { box-shadow: 0 0 0 2px #2563eb; }
.dv-part-name { font-weight: 700; }
.dv-part-status { color: #4b5563; }
.dv-history { max-height: 220px; overflow: auto; font-size: 12px; }
.dv-history-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 0; border-top: 1px solid #e5e7eb; }
