/* 设计画布样式 */
.drawing-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  margin: -20px -24px -40px;
  background: #eef1f5;
}
.drawing-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #111827;
  color: #fff;
}
.drawing-top .title { font-weight: 700; margin-right: 10px; }
.drawing-top .btn { padding: 6px 12px; font-size: 12px; }
.drawing-top .btn.dark {
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #374151;
}
.drawing-top .btn.dark:hover { background: #374151; }
.drawing-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}
/* 左右面板中部折叠把手（对齐绿米：面板滑出/滑入） */
.drawing-fold {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 14px;
  height: 64px;
  background: #fff;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .10);
  user-select: none;
  transition: left .2s ease, right .2s ease;
}
.drawing-fold:hover { background: #f1f5f9; color: #334155; }
.drawing-fold-left { left: 232px; }
.drawing-fold-right { right: 232px; }
body.nav-hidden #sidebar { display: none; }
.drawing-left.hidden { display: none; }
.drawing-right.hidden { display: none; }
.drawing-left {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.drawing-left .head {
  padding: 10px 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.drawing-left .tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px 0;
}
.drawing-left .tab {
  padding: 6px 12px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.drawing-left .tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
  font-weight: 600;
}
.drawing-left .filters {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
}
.drawing-left .filters select,
.drawing-left .filters input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
}
.drawing-left .list {
  flex: 1;
  overflow: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
}
.drawing-left .item {
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: center;
}
.drawing-left .item:hover {
  border-color: var(--accent-2);
  background: #f8fafc;
}
.drawing-left .item.selected {
  border-color: var(--accent-2);
  background: #e8efff;
  color: var(--accent-2);
  font-weight: 600;
}
.drawing-left .item .thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 6px;
}
.drawing-left .item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.drawing-left .item .name {
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.drawing-left .item .ph {
  color: #9ca3af;
  font-size: 11px;
}
.drawing-left .item { position: relative; }
.drawing-left .item .item-add {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--accent-2);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.drawing-left .item .item-add:hover { background: var(--accent-1); }

.drawing-center {
  flex: 1;
  position: relative;
  overflow: auto;
  padding: 28px 16px 16px;
  min-width: 0;
}
.drawing-stage-wrap {
  min-width: 900px;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawing-stage {
  position: relative;
  background: #fff;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .12);
  transform-origin: center center;
  flex-shrink: 0;
}
.drawing-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: center center;
}
.drawing-stage.drop-active {
  outline: 3px dashed var(--accent-2);
  outline-offset: 4px;
}
.drawing-left .item {
  cursor: grab;
}
.drawing-left .item:active {
  cursor: grabbing;
}
.drawing-stage img.plan {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: none;
  user-select: none;
  pointer-events: none;
}
.drawing-stage .placeholder {
  width: 900px;
  height: 620px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 2px dashed #cbd5e1;
}
.drawing-page .ctx-item {
  padding: 7px 12px;
  cursor: pointer;
  border-radius: 6px;
  color: #1f2937;
  user-select: none;
}
.drawing-page .ctx-item:hover { background: #eef2ff; }
.drawing-page .ctx-item.danger { color: #dc2626; }
.drawing-page .ctx-item.danger:hover { background: #fee2e2; }
.drawing-top .btn.on { background: var(--accent-2, #7c3aed); box-shadow: inset 0 0 0 2px #fff; }
#d_annot { pointer-events: none; }
#d_annot .annot { pointer-events: auto; cursor: move; }
#d_annot .rot-handle { pointer-events: auto; cursor: grab; }
/* 基础图形组件 */
.drawing-left .group-label { padding: 8px 10px 4px; font-size: 12px; color: #64748b; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.drawing-left .shape-list { padding: 4px 10px 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.drawing-left .shape { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; padding: 10px 4px; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; font-size: 12px; color: #334155; background: #fff; transition: all .12s; }
.drawing-left .shape:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.drawing-left .shape.on { border-color: #2563eb; color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 1px #2563eb; }
.drawing-left .shape-ic { font-size: 22px; line-height: 1; }
.live-price { font-size: 14px; font-weight: 700; color: #dc2626; background: #fff1f2; padding: 5px 12px; border-radius: 6px; border: 1px solid #fecdd3; white-space: nowrap; }
/* 画布右侧报价明细面板 */
.qp-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 2000; display: flex; justify-content: flex-end; }
.qp-panel { width: 700px; max-width: 94vw; background: #fff; height: 100%; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(15,23,42,.22); }
.qp-head { padding: 14px 16px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: #0f172a; }
.qp-body { flex: 1; overflow: auto; padding: 12px 16px; }
.qp-room { margin-bottom: 14px; }
.qp-room-head { display: flex; justify-content: space-between; font-weight: 600; color: #0f172a; padding: 6px 0; border-bottom: 1px dashed #e2e8f0; margin-bottom: 4px; }
.qp-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.qp-img { width: 34px; height: 34px; object-fit: contain; border-radius: 4px; background: #f8fafc; flex-shrink: 0; }
.qp-main { flex: 1; min-width: 0; }
.qp-name { color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qp-merged-tag { font-size: 11px; color: #2563eb; margin-top: 1px; }
.qp-sub { color: #94a3b8; font-size: 12px; }
.qp-up, .qp-qty, .qp-subtotal { white-space: nowrap; color: #475569; font-size: 12px; text-align: right; }
.qp-up { width: 52px; } .qp-qty { width: 58px; } .qp-edit { width: 34px; } .qp-fee { width: 78px; }
.qp-edit .btn { padding: 2px 6px; font-size: 12px; }
.qp-disc input { width: 40px; font-size: 12px; border: 1px solid #e2e8f0; border-radius: 4px; padding: 2px; }
.qp-disc-tag { font-size: 11px; color: #94a3b8; }
.qp-fee select { font-size: 12px; border: 1px solid #e2e8f0; border-radius: 4px; padding: 2px; }
.qp-fee-tag { font-size: 11px; color: #94a3b8; margin-left: 2px; }
.qp-subtotal { width: 70px; font-weight: 600; color: #0f172a; }
.qp-empty { color: #94a3b8; padding: 8px 0; font-size: 12px; }
.qp-foot { padding: 12px 16px; border-top: 1px solid #e2e8f0; }
.qp-total { display: flex; justify-content: space-between; font-weight: 600; color: #0f172a; margin: 4px 0; }
.qp-total.qp-grand { border-top: 1px solid #e2e8f0; padding-top: 8px; color: #dc2626; font-size: 15px; }
.qp-fee-line { color: #64748b; font-size: 13px; }

/* 点位图导出弹窗（多图层选择） */
.drawing-export-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.drawing-export-panel { width: 420px; max-width: 92vw; background: #fff; border-radius: 12px; box-shadow: 0 18px 50px rgba(15,23,42,.28); display: flex; flex-direction: column; overflow: hidden; }
.drawing-export-head { padding: 14px 16px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: #0f172a; font-size: 14px; }
.drawing-export-body { padding: 14px 16px; max-height: 60vh; overflow: auto; }
.drawing-export-tip { color: #64748b; font-size: 13px; margin-bottom: 10px; }
.drawing-export-item { display: flex; align-items: center; gap: 8px; padding: 7px 4px; font-size: 14px; color: #0f172a; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.drawing-export-item input { width: 16px; height: 16px; accent-color: #2f6fed; }
.drawing-export-actions { display: flex; gap: 8px; margin-top: 10px; }
.drawing-export-foot { padding: 12px 16px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 8px; }

.drawing-marker {
  position: absolute;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 8px;
  background: #2f6fed;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: grab;
  z-index: 3;
  user-select: none;
}
.drawing-marker.orange { background: #f59e0b; }
.drawing-marker.red { background: #dc2626; }
.drawing-marker.green { background: #059669; }
.drawing-marker.has-img { background: transparent; }
.drawing-marker .drawing-marker-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: contain;
  object-position: center;
}
.drawing-marker .qty {
  position: absolute;
  top: -14px;
  right: -8px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 15px;
  height: auto;
  line-height: 1.4;
  padding: 0 4px;
  text-align: center;
  white-space: nowrap;
  border: 1px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.drawing-marker .mm-unit { color: #1f3a5f; font-weight: 600; font-size: 12px; }
.drawing-marker.selected {
  outline: 2px solid #2f6fed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .22);
}
.drawing-marker.selected .h {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #fff;
  border: 2px solid #2f6fed;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
  z-index: 5;
}
.drawing-marker.selected .h.tl { left: -6px; top: -6px; }
.drawing-marker.selected .h.tr { right: -6px; top: -6px; }
.drawing-marker.selected .h.bl { left: -6px; bottom: -6px; }
.drawing-marker.selected .h.br { right: -6px; bottom: -6px; }
.drawing-marker .tag {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(17,24,39,.88);
  color: #fff;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  pointer-events: none;
}
.drawing-marker:active { cursor: grabbing; }

.drawing-right {
  width: 240px;
  background: #fff;
  border-left: 1px solid var(--line);
  overflow: auto;
  padding: 12px;
}
.drawing-right h3 {
  margin: 0 0 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawing-right .sec {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.drawing-right .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  font-size: 13px;
}
.drawing-right .row .rl {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--ink);
}
.drawing-right .row select,
.drawing-right .row input[type="text"],
.drawing-right .row input[type="number"] {
  width: 130px;
  max-width: 130px;
  padding: 6px 8px;
  font-size: 12px;
}
.drawing-right .row input[type="color"] {
  width: 100px;
  height: 32px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.drawing-right .row .ori-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.drawing-right .row .ori-btn {
  border: 0;
  background: #fff;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink);
}
.drawing-right .row .ori-btn.on {
  background: var(--accent-2);
  color: #fff;
  font-weight: 600;
}
.drawing-right .row .ori-btn + .ori-btn {
  border-left: 1px solid var(--line);
}
.drawing-right .row .switch { position: relative; display: inline-flex; width: 36px; height: 20px; cursor: pointer; }
.drawing-right .row .switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.drawing-right .row .switch i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 20px; transition: .18s; }
.drawing-right .row .switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .18s; }
.drawing-right .row .switch input:checked + i { background: #2f6fed; }
.drawing-right .row .switch input:checked + i::after { left: 18px; }

.drawing-right .plan-thumb {
  width: 100%;
  height: 90px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}
.drawing-right .plan-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.drawing-right .btn-link {
  color: var(--accent-2);
  cursor: pointer;
  font-size: 12px;
  border: 0;
  background: none;
}
.floor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.drawing-bottom {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  background: #111827;
  color: #9ca3af;
}
.drawing-bottom .dtab {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}
.drawing-bottom .dtab.active {
  color: #fff;
  border-bottom-color: var(--accent-2);
  font-weight: 600;
}
.drawing-bottom .tab-x {
  opacity: 0;
  color: #9ca3af;
  font-size: 14px;
  padding: 0 2px;
  cursor: pointer;
}
.drawing-bottom .dtab:hover .tab-x { opacity: 1; }
.drawing-bottom .tab-x:hover { color: #f87171; }
.drawing-bottom .plus {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 18px;
  color: #fff;
}

/* marker action menu */
.marker-menu {
  position: fixed;
  z-index: 80;
  width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  padding: 12px;
  font-size: 12px;
}
.marker-menu .mm-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--accent);
}
.marker-menu .mm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.marker-menu .mm-colors, #d_cfg .mm-colors {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.marker-menu .mm-dot, #d_cfg .mm-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  outline: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.marker-menu .mm-dot:hover, #d_cfg .mm-dot:hover {
  transform: scale(1.12);
}
.marker-menu .mm-dot.on, #d_cfg .mm-dot.on {
  outline: 2px solid var(--brand, #2f6fed);
  box-shadow: 0 0 0 2px #fff inset;
}
.marker-menu input[type="color"] {
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.marker-menu .mm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 户型图库：多张户型图缩略图点选 */
.plan-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  margin: 6px 0;
}
.pg-item {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  position: relative;
}
.pg-item.on {
  border-color: #2f6fed;
  box-shadow: 0 0 0 2px rgba(47, 111, 237, .18);
}
.pg-item.on::after {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  line-height: 15px;
  text-align: center;
  font-size: 11px;
  color: #fff;
  background: #2f6fed;
  border-radius: 50%;
}
.pg-item.broken img { display: none; }
.pg-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pg-thumb.blank {
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 6px, #e2e8f0 6px, #e2e8f0 12px);
  color: #94a3b8;
  font-size: 11px;
}
.pg-name {
  font-size: 11px;
  color: #475569;
  padding: 3px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f1f5f9;
}
.pg-del {
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.pg-del:hover { color: #dc2626; }

