:root {
  --primary: #006BDF; --primary-dark: #0052ad; --primary-soft: #e6f0fc; --accent: #CC3500;
  --bg: #F3F6FB; --panel: #ffffff; --line: #D5DEE9; --line-soft: #e8eef5;
  --text: #1c2733; --muted: #5B6B7C; --faint: #8A97A6;
  --ok: #1f8a4c; --warn: #b7791f; --err: #c62828; --info: #2b6cb0;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,32,48,.06), 0 4px 16px rgba(16,32,48,.06);
  --side: 220px; --top: 52px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- khung trang ---------- */
.topbar { height: var(--top); background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 14px; padding: 0 16px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--primary); font-size: 16px; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); min-width: 0; overflow: hidden; }
.crumbs a { color: var(--muted); } .crumbs b { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.usermenu { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid;
  place-items: center; font-weight: 700; font-size: 12px; }
.layout { display: flex; min-height: calc(100vh - var(--top)); }
.sidenav { width: var(--side); background: var(--panel); border-right: 1px solid var(--line); padding: 12px 8px; flex-shrink: 0; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: var(--text); margin-bottom: 2px; }
.sidenav a:hover { background: var(--bg); text-decoration: none; }
.sidenav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidenav .ic { width: 18px; text-align: center; color: var(--faint); }
.sidenav a.on .ic { color: var(--primary); }
.sidenav .sep { height: 1px; background: var(--line-soft); margin: 10px 6px; }
.layout.navc .sidenav { width: 52px; padding: 8px 6px; }
.layout.navc .sidenav .t, .layout.navc .sidenav .label { display: none; }
.layout.navc .sidenav a { justify-content: center; padding: 9px 0; gap: 0; }
.navtog { display: block; margin: 0 0 6px auto; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 16px; padding: 0 6px; border-radius: 5px; }
.navtog:hover { background: var(--bg); color: var(--text); }
.layout.navc .navtog { margin: 0 auto 6px; }
.sidenav .label { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; padding: 6px 12px; }
.main { flex: 1; min-width: 0; padding: 20px 24px; }
.main.full { padding: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 650; }
.page-head .sub { color: var(--muted); }

/* ---------- thành phần ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 7px 14px; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { border-color: #b8c6d6; background: #fafcff; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--err); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 6px 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-h { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card .card-b, .card-b { padding: 16px; }
.card-b.scroll, .card .card-b.scroll { overflow-x: auto; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 14px 16px; } .stat .n { font-size: 26px; font-weight: 700; } .stat .t { color: var(--muted); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); }
.field .hint { font-size: 11px; color: var(--faint); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: #fff; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.err-text { color: var(--err); }
table.t { width: 100%; border-collapse: collapse; background: #fff; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); background: #f8fafd; padding: 9px 12px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #f6f9fe; }
table.t tr.sel td { background: var(--primary-soft); }
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: #eef1f5; color: var(--muted); white-space: nowrap; }
.b-WIP { background: #fff4e0; color: #9a5b00; } .b-SHARED { background: #e6f0fc; color: #0b5cc0; }
.b-PUBLISHED { background: #e3f5ea; color: #1f7a45; } .b-ARCHIVED { background: #eceff3; color: #5b6b7c; }
.b-Open { background: #fde8e6; color: #b42318; } .b-InProgress { background: #fff4e0; color: #9a5b00; }
.b-Resolved { background: #e6f0fc; color: #0b5cc0; } .b-Closed { background: #e3f5ea; color: #1f7a45; }
.b-Critical { background: #b42318; color: #fff; } .b-High { background: #fde8e6; color: #b42318; }
.b-Normal { background: #eef1f5; color: var(--muted); } .b-Low { background: #f3f6fb; color: var(--faint); }
.b-error { background: #fde8e6; color: #b42318; } .b-warning { background: #fff4e0; color: #9a5b00; } .b-info { background: #e6f0fc; color: #0b5cc0; }
.b-done { background: #e3f5ea; color: #1f7a45; } .b-running, .b-queued { background: #fff4e0; color: #9a5b00; }
.empty { padding: 40px; text-align: center; color: var(--faint); }

/* ---------- đăng nhập ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 500px at 80% -10%, var(--primary-soft), transparent), var(--bg); }
.auth .card { width: 380px; padding: 28px; }
.auth h1 { font-size: 20px; margin: 14px 0 4px; } .auth .brand { font-size: 20px; }

/* ---------- dự án ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pcard { padding: 16px; cursor: pointer; transition: border-color .15s; display: flex; flex-direction: column; gap: 8px; }
.pcard:hover { border-color: var(--primary); }
.pcard .code { font-size: 12px; color: var(--primary); font-weight: 700; letter-spacing: .03em; }
.pcard .name { font-size: 16px; font-weight: 600; }
.pcard .meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-top: auto; }

/* ---------- file ---------- */
.files { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.tree { padding: 8px; } .tree .node { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.tree .node:hover { background: var(--bg); } .tree .node.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tree .kids { margin-left: 14px; }
.drop { outline: 2px dashed transparent; outline-offset: -6px; }
.drop.over { outline-color: var(--primary); background: var(--primary-soft); }
.drawer { position: fixed; right: 0; top: var(--top); bottom: 0; width: 460px; max-width: 100%; background: #fff; border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(16,32,48,.08); z-index: 30; display: flex; flex-direction: column; }
.drawer .dh { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 10px; }
.drawer .dh h2 { font-size: 16px; margin: 0; word-break: break-all; flex: 1; }
.drawer .db { padding: 16px; overflow: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 13px; margin-bottom: 14px; }
.kv .k { color: var(--muted); }
.timeline { border-left: 2px solid var(--line-soft); margin-left: 6px; padding-left: 14px; }
.timeline .ev { margin-bottom: 12px; position: relative; }
.timeline .ev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); position: absolute; left: -19px; top: 5px; }
.progress { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); width: 0; transition: width .2s; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- modal, toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16,24,40,.35); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 10px; width: 520px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal.wide { width: 760px; }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); font-weight: 650; font-size: 16px; }
.modal .mb { padding: 18px 20px; overflow: auto; }
.modal .mf { padding: 12px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #1c2733; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; }
.toast.err { background: var(--err); } .toast.ok { background: var(--ok); }
.toast.warn { background: #b26a00; }
.secret { font-family: Consolas, monospace; font-size: 16px; background: var(--bg); border: 1px dashed var(--line); padding: 10px; border-radius: 6px; user-select: all; }

/* ---------- viewer ---------- */
.viewer { --lw: 280px; --rw: 320px; display: grid; grid-template-columns: var(--lw) minmax(0, 1fr) var(--rw); grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - var(--top)); min-height: 320px;
  position: relative; }
.viewer > .vpanel.left { grid-column: 1; grid-row: 1; }
.viewer > .canvas-wrap { grid-column: 2; grid-row: 1; }
.viewer > .vpanel.right { grid-column: 3; grid-row: 1; }
.viewer.noprops, .viewer.hideR { --rw: 0px; }
.viewer.hideL { --lw: 0px; }
.viewer.hideL > .vpanel.left, .viewer.hideR > .vpanel.right { visibility: hidden; overflow: hidden; border: 0; }
/* tự ẩn: trỏ chuột vào mép -> thanh trượt ra đè lên mô hình (không làm co vùng xem) */
.viewer.hideL > .vpanel.left.peek, .viewer.hideR > .vpanel.right.peek { visibility: visible; overflow: auto; position: absolute; top: 0; bottom: 0; z-index: 30;
  box-shadow: 0 8px 28px rgba(15,23,42,.22); }
.viewer.hideL > .vpanel.left.peek { left: 0; width: 280px; border-right: 1px solid var(--line); }
.viewer.hideR > .vpanel.right.peek { right: 0; width: 320px; border-left: 1px solid var(--line); }
.vedge { position: absolute; top: 50%; transform: translateY(-50%); z-index: 25; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow);
  cursor: pointer; font-size: 12px; color: var(--muted); user-select: none; }
.vedge span { display: block; writing-mode: vertical-rl; padding: 12px 5px; white-space: nowrap; }
.vedge.left { left: 0; border-left: 0; border-radius: 0 8px 8px 0; }
.vedge.left span { transform: rotate(180deg); }
.vedge.right { right: 0; border-right: 0; border-radius: 8px 0 0 8px; }
.vedge:hover { color: var(--primary, #006BDF); }
.pbtns { display: flex; justify-content: flex-end; gap: 2px; padding: 4px 6px 0; position: sticky; top: 0; z-index: 2; background: #fff; }
.vpanel.right .pbtns { justify-content: flex-start; }
.pbtn { border: 0; background: transparent; cursor: pointer; font-size: 13px; color: var(--muted); padding: 2px 6px; border-radius: 5px; line-height: 1.2; }
.pbtn:hover { background: var(--line-soft, #eef2f7); color: var(--text, #111); }
.vpanel { background: #fff; border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; min-height: 0; }
.vpanel.right { border-right: 0; border-left: 1px solid var(--line); }
.vpanel .sec { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.vpanel .sec h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.model-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.model-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 9px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.vtree { font-size: 13px; padding: 6px 8px; }
.vtree .tn { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 4px; cursor: pointer; }
.vtree .tn:hover { background: var(--bg); }
.vtree .tn .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vtree .tn .cnt { color: var(--faint); font-size: 11px; }
.vtree .tk { margin-left: 16px; }
.vtree .tog { width: 14px; color: var(--faint); text-align: center; }
/* vùng xem luôn vừa khung màn hình (không để kích thước canvas đẩy chiều cao) - mọi bảng nổi đo theo vùng này */
.canvas-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #eef2f7; --tbh: 50px;
  container: vwrap / inline-size; }
.canvas-wrap > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vtoolbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: max-content; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); display: flex; gap: 2px; padding: 4px; z-index: 5; flex-wrap: wrap; max-width: calc(100% - 20px); }
.vtoolbar .btn { border: 0; padding: 5px 8px; font-size: 13px; }
.vtoolbar .sepv { width: 1px; background: var(--line); margin: 2px 4px; }
.vloading { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: #fff; padding: 16px 20px; border-radius: 8px;
  box-shadow: var(--shadow); min-width: 300px; z-index: 6; }
.vsection { position: absolute; top: calc(var(--tbh) + 18px); left: 10px; max-height: calc(100% - var(--tbh) - 30px);
  max-width: calc(100% - 20px); overflow: auto; box-sizing: border-box; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  padding: 10px 12px; z-index: 5; width: 250px; font-size: 13px; }
.vsection .srow { display: grid; grid-template-columns: 22px 70px 1fr 26px; align-items: center; gap: 6px; margin: 4px 0; }
.vhint { position: absolute; bottom: 8px; left: 10px; color: var(--faint); font-size: 12px; pointer-events: none; }
.props-group { margin-bottom: 10px; }
.props-group .pg-h { font-weight: 600; font-size: 12px; padding: 6px 8px; background: #f6f8fb; border-radius: 4px; cursor: pointer; }
.props-group table { width: 100%; font-size: 12px; border-collapse: collapse; }
.props-group td { padding: 4px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; word-break: break-word; }
.props-group td:first-child { color: var(--muted); width: 45%; }
.snap { width: 100%; max-height: 300px; object-fit: contain; background: #eef2f7; border: 1px solid var(--line); border-radius: 6px; display: block; }
.comment { padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 6px; margin-bottom: 8px; background: #fbfcfe; }
.comment .ch { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.comment .tx { white-space: pre-wrap; }
.score { font-size: 34px; font-weight: 700; }
.bar { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; }
pre.pre { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 6px; font-size: 12px; }

/* menu chuột phải / gợi ý tạo mặt cắt */
.vmenu { position: absolute; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; min-width: 210px; }
.vmenu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; }
.vmenu button:hover { background: var(--primary-soft); }
.vmenu button.primary { color: var(--primary); font-weight: 600; }
.vmenu .sep { height: 1px; background: var(--line-soft); margin: 4px 2px; }
.vsection .cutrow { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.vsection .cutrow input[type=number], .vsection input[type=number] { padding: 3px 5px; height: auto; }
.canvas-wrap.picking canvas { cursor: crosshair; }
.walkmap canvas { width: 100%; height: auto; max-height: min(230px, 32vh); object-fit: contain; border: 1px solid var(--line); border-radius: 6px; cursor: crosshair; display: block; background: #fff; }
.walkmap.big canvas { max-height: min(55vh, 520px); }
/* vùng xem hẹp (màn nhỏ / mở cả 2 thanh bên): thanh công cụ chỉ hiện biểu tượng, chữ hiện khi trỏ chuột */
.vtoolbar .lb { margin-left: 3px; }
@container vwrap (max-width: 1300px) { .vtoolbar .btn.hasic .lb { display: none; } .vtoolbar .btn { padding: 5px 7px; } }
@container vwrap (max-width: 560px) { .vtoolbar .sepv { display: none; } .vhint { display: none; } }
.vhint { max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* thẻ thao tác tại điểm chọn (kiểu Dalux) */
.vcard { position: absolute; z-index: 26; transform: translate(-50%, calc(-100% - 15px)); background: #fff; border-radius: 10px;
  box-shadow: 0 6px 22px rgba(20, 30, 40, .2); padding: 5px; user-select: none; }
.vcard::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: #fff;
  transform: translateX(-50%) rotate(45deg); box-shadow: 3px 3px 5px rgba(20, 30, 40, .08); }
.vcard .prow { display: flex; gap: 2px; position: relative; z-index: 1; }
.vcard .ptool { position: relative; display: flex; flex-direction: column; align-items: stretch; border-radius: 8px; }
.vcard .ptool:hover { background: #f1f4f6; }
.vcard .pmain { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; padding: 7px 13px 1px;
  cursor: pointer; color: #546E7A; font: inherit; font-size: 12.5px; }
.vcard .pmain:hover { color: #263238; }
.vcard .pchev { background: none; border: 0; cursor: pointer; padding: 0 0 3px; color: #90A4AE; line-height: 0; }
.vcard .pchev:hover { color: #37474F; }
.vcard .ico { display: inline-flex; line-height: 0; }
.vcard .pmain .ico svg { width: 24px; height: 24px; }
.vcard .pchev .ico svg { width: 11px; height: 11px; }
.vcard .pclose { position: absolute; top: -11px; right: -11px; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 1px solid #CFD8DC;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12); display: flex; align-items: center; justify-content: center; cursor: pointer; color: #37474F; padding: 0; z-index: 2; }
.vcard .pclose .ico svg { width: 13px; height: 13px; }
.vcard .pdrop { position: absolute; top: 100%; left: 0; margin-top: 8px; background: #fff; border-radius: 8px; box-shadow: 0 6px 20px rgba(20, 30, 40, .18);
  padding: 4px; min-width: 200px; z-index: 3; }
.vcard .pdrop button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; white-space: nowrap; }
.vcard .pdrop button:hover { background: var(--primary-soft); }

.vtoolbar .qsel { width: auto; padding: 4px 6px; font-size: 13px; height: auto; border-radius: 6px; }

/* ---- đo (kiểu Dalux) */
.mlayer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.mlabel { position: absolute; left: 0; top: 0; background: #ff6d00; color: #fff; font-size: 12px; font-weight: 600; padding: 2px 7px;
  border-radius: 10px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.mlabel.prev { background: rgba(255,109,0,.85); }
.mlabel.leg { font-size: 11px; font-weight: 500; padding: 1px 6px; background: #fff; border: 1.5px solid; }
.mlabel.leg.x { color: #c62828; border-color: #e53935; } .mlabel.leg.y { color: #2e7d32; border-color: #43a047; } .mlabel.leg.z { color: #1565c0; border-color: #1e88e5; }
.msnap { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border: 2px solid #ff6d00; background: rgba(255,255,255,.6); border-radius: 50%; }
.msnap.vertex { border-radius: 2px; background: #ff6d00; }
.msnap.edge { border-radius: 2px; transform-origin: center; }
.msnap.edge::after { content: ''; position: absolute; inset: 2px; background: #ff6d00; transform: rotate(45deg); }
.msnap.obj { border-color: #1E6FD9; }
.canvas-wrap.measuring canvas { cursor: crosshair; }
.vsection.vmeasure { left: auto; right: 10px; width: 300px; }
.vmeasure .mmodes { display: flex; gap: 4px; flex-wrap: wrap; }
.vmeasure .mmodes .btn.on { background: #fff3e0; border-color: #ff6d00; color: #e65100; }
.vmeasure .mrow { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.mxyz { display: flex; gap: 8px; margin-top: 2px; } .mxyz .x { color: #c62828; } .mxyz .y { color: #2e7d32; } .mxyz .z { color: #1565c0; }
/* ---- view đã lưu */
.viewitem { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.viewitem .vi-main { cursor: pointer; margin-bottom: 6px; }
.viewitem .vi-main:hover b { color: var(--primary); }
.viewitem .vi-models { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; color: var(--muted); }
.viewitem .vi-models .newer { color: #e65100; }
.warn-text { color: #b45309; margin-top: 3px; }
.viewitem.group { background: #f7f9fc; }
.viewitem.share { cursor: pointer; } .viewitem.share:hover { border-color: var(--primary); }
.viewitem.share.on { border-color: var(--primary); background: #eef5ff; }
.mlabel.blue { background: #1e6fd9; } .mlabel.red { background: #e53935; } .mlabel.green { background: #2e9e50; }
.mlabel.ang { font-size: 11px; padding: 1px 6px; }
.v2dbar { position: absolute; top: calc(var(--tbh) + 16px); left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px 10px; white-space: nowrap;
  max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: center; }
.model-item .prep { cursor: pointer; white-space: nowrap; }
