:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #18232f;
  --muted: #6b7a89;
  --line: #dbe3ec;
  --navy: #142d4c;
  --navy-2: #1d426d;
  --teal: #0f766e;
  --teal-soft: #e5f4f1;
  --amber: #b7791f;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(20, 45, 76, .08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 13px;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;        /* 圆形外框 */
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  font-size: 24px;
  color: #8fe3d8;
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .04em; font-weight: 700; }
.brand p { margin: 3px 0 0; font-size: 11.5px; color: rgba(255,255,255,.82); }

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1;
  transition: .16s ease;
}
.btn:hover { background: rgba(255,255,255,.16); transform: translateY(-1px); }
.btn.primary { background: #6fae3c; border-color: #6fae3c; color: #ffffff; font-weight: 700; }   /* 草绿 */
.btn.primary:hover { background: #7cbd46; border-color: #7cbd46; }
.btn.ghost { background: transparent; color: rgba(255,255,255,.8); }
.btn.small { padding: 7px 10px; font-size: 11.5px; background: #f4f7fb; color: var(--navy); border-color: var(--line); }
.btn.small:hover { background: #e9eff7; }
.btn.small.ghost { background: transparent; color: var(--muted); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.app {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px 26px;
  align-items: start;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #b8c5d3 transparent;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 13px;
  box-shadow: 0 3px 12px rgba(20,45,76,.035);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--navy);
  letter-spacing: .02em;
}
.card h2 span {
  font-size: 10px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 5px;
  padding: 3px 5px;
  letter-spacing: .08em;
}
.badge {
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #f7f9fc;
  border-radius: 20px;
  padding: 3px 8px;
  white-space: nowrap;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 9px; }
.grid3 label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.grid3 input { width: 100%; border: 1px solid var(--line); background: #fbfcfe; color: var(--ink); border-radius: 8px; padding: 7px 8px; outline: none; }
.grid2 label, .layer-row label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.grid2 input, .grid2 select, .layer-row input, .layer-row select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 8px;
  outline: none;
  transition: .15s;
}
.grid2 input:focus, .grid2 select:focus, .layer-row input:focus, .layer-row select:focus {
  border-color: #7fb7b1;
  box-shadow: 0 0 0 3px rgba(15,118,110,.09);
  background: #fff;
}
input[type="color"] { padding: 3px; height: 33px; cursor: pointer; }
.is-muted { opacity: .5; pointer-events: none; }

.hint { margin: 9px 0 10px; font-size: 10.8px; line-height: 1.55; color: var(--muted); }
.hint code { background: #eef3f8; color: #38536f; padding: 1px 4px; border-radius: 4px; }

.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid #d7e0ea;
  background: #f7f9fc;
  color: #35506b;
  border-radius: 20px;
  padding: 6px 10px;
  font-size: 11px;
}
.chip:hover { border-color: #8fc3bc; color: var(--teal); background: #f0faf8; }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--teal); width: 14px; height: 14px; }
.switch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; margin-bottom: 10px; }

.layer-list { display: flex; flex-direction: column; gap: 8px; }
.layer-row {
  display: grid;
  grid-template-columns: 1.1fr .8fr .75fr 28px;
  gap: 6px;
  align-items: end;
  background: #f8fafc;
  border: 1px solid #e8eef5;
  border-radius: 9px;
  padding: 7px;
}
.layer-row .del {
  width: 26px; height: 30px;
  border: 1px solid #efd5d2;
  background: #fff7f6;
  color: var(--danger);
  border-radius: 7px;
  font-size: 15px;
  line-height: 1;
}
.layer-row .del:hover { background: #fee9e7; }
.layer-empty { font-size: 11px; color: #98a6b5; padding: 4px 2px 2px; }

.btn-row { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }

.color-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.color-item { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.color-item input { width: 28px; height: 26px; padding: 2px; border-radius: 6px; border: 1px solid var(--line); }
.color-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stage {
  position: sticky;
  top: 88px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 14px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid #edf1f6;
  background: linear-gradient(180deg, #fff, #fbfcfe);
}
.stage-head h2 { margin: 0; font-size: 17px; color: var(--navy); white-space: nowrap; }
.stage-head p { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); }
.stage-tools { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; justify-content: flex-end; flex: 0 0 auto; }
.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: #eef3f8;
  border: 1px solid #e3eaf2;
  border-radius: 10px;
}
.view-tab {
  border: 0;
  background: transparent;
  color: #5f7182;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  line-height: 1;
  transition: .16s ease;
}
.view-tab:hover { color: var(--navy); }
.view-tab.active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 2px 7px rgba(20,45,76,.10);
  font-weight: 700;
}
.zoom { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.hidden { display: none !important; }
.icon-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover { background: #f0f5fa; }

.canvas-wrap {
  position: relative;
  overflow: hidden;
  height: calc(100vh - 260px);
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background-color: #fff;
  background-image:
    linear-gradient(to right, rgba(224, 232, 240, .72) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(224, 232, 240, .72) 1px, transparent 1px);
  background-size: 20px 20px;
}
.canvas-wrap.no-grid {
  background-image: none;
}
#cableSvg {
  width: 100%;
  height: 100%;
  max-height: none;
  display: block;
  transition: transform .18s ease;
  transform-origin: center center;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.three-wrap {
  position: relative;
  height: calc(100vh - 260px);
  min-height: 560px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 35%, #ffffff 0%, #f4f7fa 45%, #e9eff5 100%);
}
#threeCanvasHost {
  position: absolute;
  inset: 0;
}
#threeCanvasHost canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}
.three-toolbar {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 9px;
  border: 1px solid rgba(219, 227, 236, .9);
  border-radius: 11px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(8px);
  box-shadow: 0 5px 18px rgba(20,45,76,.08);
}
.three-toolbar .switch { padding: 0 2px; white-space: nowrap; }
.three-toolbar .btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.three-hint {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 14px;
  left: auto;
  top: auto;
  transform: none;
  padding: 6px 10px;
  border-radius: 20px;
  background: rgba(20, 45, 76, .78);
  color: rgba(255,255,255,.86);
  font-size: 10.5px;
  white-space: nowrap;
  pointer-events: none;
}
.three-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}
.three-leaders .label-dot,
.three-leaders .label-dot-hit {
  pointer-events: all;
  cursor: grab;
}
.three-leaders .label-dot-hit {
  cursor: grab;
}
.three-leaders .label-dot-hit:active,
.three-leaders .label-dot-hit.dragging {
  cursor: grabbing;
}
.label-dot-2d,
.label-dot-hit-2d {
  pointer-events: all;
  cursor: grab;
}
.label-dot-hit-2d:active,
.label-dot-hit-2d.dragging {
  cursor: grabbing;
}
.three-wrap,
.three-wrap * {
  user-select: none;
  -webkit-user-select: none;
}
body.right-panning,
body.right-panning * {
  user-select: none !important;
  -webkit-user-select: none !important;
}
body.right-panning {
  cursor: grabbing;
}
.three-labels {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.three-label {
  position: absolute;
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
  padding: 4px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #40566d;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: none;
}
.three-label.dragging-label {
  cursor: grabbing;
  z-index: 12;
  background: transparent;
  box-shadow: none;
}
.three-label b { color: #142d4c; font-weight: 700; }
.three-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

.stage-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px 16px;
  border-top: 1px solid #edf1f6;
  background: #fff;
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; max-width: 78%; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 10.8px; color: var(--muted); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); }
.status { font-size: 10.8px; color: #8b98a6; text-align: right; white-space: nowrap; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: #142d4c;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* SVG typography */
.svg-title { font: 700 28px "Microsoft YaHei", sans-serif; fill: #142d4c; }
.svg-sub { font: 400 13px "Microsoft YaHei", sans-serif; fill: #6b7a89; }
.svg-label { font: 400 12px "Microsoft YaHei", sans-serif; fill: #40566d; }
.svg-label-strong { font: 700 12px "Microsoft YaHei", sans-serif; fill: #142d4c; }
.svg-dim { font: 400 11px "Microsoft YaHei", sans-serif; fill: #6b7a89; }
.svg-small { font: 400 10px "Microsoft YaHei", sans-serif; fill: #8b98a6; }
.svg-note { font: 400 10px "Microsoft YaHei", sans-serif; fill: #9aa7b4; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 340px minmax(0, 1fr); padding: 14px; }
  .brand p { display: none; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .panel { max-height: none; overflow: visible; }
  .stage { position: static; }
  #cableSvg { max-height: none; }
  .three-wrap { height: 66vh; min-height: 420px; }
  .top-actions .btn { padding: 7px 9px; font-size: 11px; }
  .stage-foot { flex-direction: column; }
  .legend { max-width: 100%; }
}

@media print {
  body { background: #fff; }
  .app { display: block; padding: 0; }
  .stage { border: 0; box-shadow: none; position: static; }
  .canvas-wrap { padding: 0; min-height: 0; }
  #cableSvg { max-height: none; width: 100%; box-shadow: none; }
}

/* ------------------------------------------------------------------ tree editor */
.tree-panel {
  max-height: calc(100vh - 96px);
  overflow: hidden;
  gap: 0;
  padding-right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.tree-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid #edf1f6;
}
.tree-panel-head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.tree-panel-head p { margin: 4px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.tree-add-wrap { position: relative; flex: 0 0 auto; }
.add-menu {
  position: absolute;
  right: 0;
  top: 36px;
  z-index: 20;
  width: 150px;
  padding: 5px;
  background: #fff;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(20,45,76,.16);
}
.add-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  color: #31465d;
  font-size: 12px;
  cursor: pointer;
}
.add-menu button:hover { background: #f2f6fa; }
.tree-view {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  padding: 8px 10px 10px;
  scrollbar-width: thin;
}
.tree-group { margin: 2px 0 8px; }
.tree-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 6px;
  color: #50657c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.tree-group-head button {
  border: 0;
  background: #eef4fa;
  color: #31557a;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.tree-node {
  position: relative;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fbfcfe;
}
.tree-node.selected { border-color: #9fc0e2; background: #f2f8ff; }
.tree-node.drag-over { border-color: #d6a13c; background: #fff9e9; }
.tree-node-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  cursor: pointer;
  user-select: none;
}
.tree-node-row .node-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #8fb6d9; flex: 0 0 auto;
}
.tree-node-row .node-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #243b53;
}
.node-tag { font-size: 9.5px; color: #7a8da1; background: #f0f4f8; border-radius: 4px; padding: 2px 5px; }
.node-actions { display: flex; gap: 2px; opacity: .25; transition: opacity .12s; }
.tree-node:hover .node-actions { opacity: 1; }
.node-actions button {
  border: 0; background: transparent;
  color: #6a8097; width: 19px; height: 19px;
  border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1;
}
.node-actions button:hover { background: #e8f0f8; color: #1e4f7c; }
.tree-children { padding: 0 8px 7px 21px; }
.tree-child {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 0; color: #74879a; font-size: 10.5px;
}
.tree-child::before { content: '��'; color: #bdcbd8; font-size: 10px; }
.tree-child-ref { color: #4f7193; }
.tree-empty { padding: 16px 10px; color: #98a8b8; font-size: 11px; text-align: center; }
.tree-options {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  padding: 8px 14px;
  border-top: 1px solid #edf1f6;
  border-bottom: 1px solid #edf1f6;
  background: #fbfcfe;
}
.tree-options .switch { font-size: 10.5px; }
.node-inspector {
  flex: 0 0 auto;
  max-height: 48%;
  overflow: auto;
  padding: 10px 12px 14px;
  background: #f8fafc;
  scrollbar-width: thin;
}
.inspector-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  color: #294a69; font-size: 12px; font-weight: 700;
}
.inspector-title small { color: #8a9cad; font-weight: 400; }
.inspector-section {
  margin: 9px 0;
  padding: 9px;
  background: #fff;
  border: 1px solid #e6edf5;
  border-radius: 8px;
}
.inspector-section h4 { margin: 0 0 7px; font-size: 10.5px; color: #5e7891; text-transform: uppercase; letter-spacing: .05em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.form-row { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 10px; color: #7b8fa3; }
.form-row input, .form-row select {
  width: 100%; box-sizing: border-box;
  border: 1px solid #d9e3ed; border-radius: 6px;
  padding: 6px 7px; font-size: 11px; color: #2b4057; background: #fff;
}
.form-row input[type=color] { padding: 2px; height: 29px; }
.form-row input[type=checkbox] { width: auto; }
.inspector-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.inspector-actions button, .mini-btn {
  border: 1px solid #d7e2ed; background: #fff; color: #3c5d7c;
  border-radius: 6px; padding: 5px 8px; font-size: 10px; cursor: pointer;
}
.inspector-actions button:hover, .mini-btn:hover { background: #f0f6fc; }
.inspector-list { display: flex; flex-direction: column; gap: 5px; }
.inspector-list-row {
  display: flex; align-items: center; gap: 5px;
  padding: 5px; border: 1px solid #e3ebf3; border-radius: 6px; background: #fbfdff;
}
.inspector-list-row select { flex: 1 1 auto; min-width: 0; }
.inspector-list-row button { flex: 0 0 auto; }
.stage-error {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(248,250,252,.86);
  color: #9b4336; font-size: 13px; text-align: center; line-height: 1.7;
}
.stage-error.hidden { display: none; }

/* multi-shield editor */
.shield-add-row {
  display: flex;
  gap: 7px;
  margin-bottom: 9px;
}
.shield-add-row select { flex: 1 1 auto; min-width: 0; }
.shield-add-row .btn { flex: 0 0 auto; white-space: nowrap; }
.shield-list { display: flex; flex-direction: column; gap: 7px; }
.shield-row {
  border: 1px solid #e2eaf3;
  background: #fbfdff;
  border-radius: 8px;
  padding: 7px;
}
.shield-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.shield-row-title { font-size: 11px; font-weight: 700; color: #35546f; }
.shield-row-actions { display: flex; gap: 2px; }
.shield-row-actions button {
  border: 0; background: #eef4fa; color: #52708c;
  width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
}
.shield-row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.shield-row-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 9.5px; color: #7d90a3; }
.shield-row-grid input { width: 100%; box-sizing: border-box; }

/* align shield thickness and color controls */
.shield-row-grid { align-items: end; }
.shield-row-grid input[type="number"],
.shield-row-grid input[type="color"] {
  height: 32px;
  min-height: 32px;
  box-sizing: border-box;
}
.shield-row-grid input[type="number"] { padding: 6px 8px; }
.shield-row-grid input[type="color"] {
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
}
.shield-row-grid input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.shield-row-grid input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}
.shield-row-grid input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 6px;
}
.shield-row-grid.single { grid-template-columns: 1fr; }
.shield-row-grid select {
  width: 100%;
  height: 32px;
  min-height: 32px;
  box-sizing: border-box;
  padding: 0 8px;
}

/* 3D ��ͼ���ظ������ͼ�� */
body.view-3d #drawingSub,
body.view-3d #legend {
  display: none;
}

/* 2D / 3D �����ظ������ͼ�� */
#drawingSub,
#legend {
  display: none;
}

/* per-core insulation colors */
.core-color-head {
  margin: 10px 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: #5d7690;
}
.core-color-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 7px;
}
.core-color-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #7d90a3;
}
.core-color-item input[type="color"] {
  width: 30px;
  height: 24px;
  min-height: 24px;
  padding: 1px;
  border-radius: 5px;
}

/* wider core insulation swatches */
.core-color-list {
  grid-template-columns: 1fr 1fr;
  gap: 7px 10px;
}
.core-color-item {
  justify-content: flex-start;
}
.core-color-item input[type="color"] {
  width: 64px;
  min-width: 64px;
  height: 24px;
  min-height: 24px;
  padding: 2px;
  border-radius: 5px;
}
.core-color-item span {
  white-space: nowrap;
}

.material-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
  font-size: 10px;
  color: #7d90a3;
}
.material-row > span { margin-right: 2px; }
.material-row label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.material-row input[type="radio"] { accent-color: var(--teal); margin: 0; }
.ins-core-colors { margin-top: 7px; }

/* align insulation material/color radio rows */
.material-row {
  display: grid;
  grid-template-columns: 58px 1fr 1fr;
  align-items: center;
  column-gap: 8px;
}
.material-row > span {
  margin: 0;
  white-space: nowrap;
}
.material-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}
.material-row input[type="radio"] {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

/* cabling card title matches other parameter titles */
.card h2 #cablingTitle {
  font-size: inherit;
  color: inherit;
  background: none;
  border-radius: 0;
  padding: 0;
  letter-spacing: inherit;
}

/* editable annotation text */
.editable-label {
  cursor: text;
  pointer-events: auto;
}
.three-label.editable-label {
  pointer-events: auto;
}
.label-text-editor {
  position: fixed;
  z-index: 9999;
  width: 150px;
  height: 30px;
  box-sizing: border-box;
  border: 1px solid var(--teal);
  border-radius: 6px;
  background: #fff;
  color: #1d344c;
  padding: 4px 7px;
  font: 13px "Microsoft YaHei", sans-serif;
  box-shadow: 0 6px 18px rgba(20, 45, 76, .18);
  outline: none;
}

/* ��ע���߲㲻���� 3D �����ת��Բ���Կ��϶� */
.three-leaders {
  pointer-events: none;
}
.three-leaders .label-dot,
.three-leaders .label-dot-hit {
  pointer-events: all;
}

/* view options moved into stage title area */
.stage-view-options {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px 12px;
  margin-left: auto;
}
.stage-view-options .switch {
  font-size: 10px;
  white-space: nowrap;
}
.stage-view-options .btn {
  height: 26px;
}
@media (max-width: 900px) {
  .stage-view-options { margin-left: 0; justify-content: flex-start; }
}

/* conductor and insulation nested inside core structure card */
.sub-param-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #e2eaf3;
}
.sub-param-title {
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .02em;
}

.build-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 9px;
  font-weight: 400;
  vertical-align: middle;
}

.switch:has(input:disabled) {
  opacity: .45;
  cursor: not-allowed;
}
.switch input:disabled {
  cursor: not-allowed;
}

/* ���ʵ�ѡ���벻ͬɫ��ѡ��о����ɫ��ͳһ�ж��� */
.color-mode-row {
  grid-template-columns: 58px 1fr;
}
.ins-core-colors {
  margin-left: 58px;
  grid-template-columns: 1fr 1fr;
}

/* о����ɫ�������ƣ�ʹ�����Ե�벻ͬɫ��ѡ����� */
.ins-core-colors {
  margin-left: 74px;
}

/* �ϸ��ж��룺���ʵ�ѡ����ͬɫ��ѡ��о����ɫ��ͳһ�ӵڶ��п�ʼ */
.material-row > label {
  display: flex;
  align-items: center;
  gap: 4px;
}
.material-row input[type="radio"],
.material-row input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.ins-core-colors {
  flex: 1 0 100%;
  width: 100%;
  /* 抵消父级内边距，使两列外侧间距与左侧一致 */
  margin-right: -46px;
  margin-left: 0;
  grid-column: 1 / -1;
  justify-items: stretch;
  justify-content: space-between;   /* 两列靠左右边缘等距 */
  column-gap: 10px;
}
.ins-core-colors .core-color-item {
  width: 100%;
  justify-content: flex-start;
  gap: 4px;
}
/* 色块自动撑满剩余宽度，使两列贴住左右边界、外侧间距相等 */
.ins-core-colors .core-color-item input[type="color"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 48px;
}
.ins-core-colors .core-color-item span { flex: 0 0 auto; }

/* ��Ե���η�ʽ�������е�ѡ������ϸ���� */
.shield-mode-row {
  grid-template-columns: 58px 1fr;
}
.shield-mode-grid {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 22px;
  gap: 6px 14px;
  align-items: center;
}
.shield-mode-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  font-size: 10px;
  color: #52677d;
}
.shield-mode-grid input[type="radio"] {
  margin: 0;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

/* ���η�ʽ�������һ�е�ѡ��ťˮƽ���� */
.shield-mode-row {
  align-items: start;
}
.shield-mode-row > span {
  height: 22px;
  line-height: 22px;
}

/* 铠装方式：三项一行均匀分布 */
.shield-mode-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  column-gap: 8px;
}

/* 结构类型：整行宽度，与上下两栏左右对齐 */
.field-full {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.field-full select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--ink);
  height: 33px;
}

/* 芯线颜色旁的“注条”开关 */
.core-stripe-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}
.core-stripe-toggle input { width: auto; margin: 0; }

/* 标题右侧站点标识 */
.brand-site {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.78);
  vertical-align: middle;
}

/* 侧边栏顶部的品牌块（从标题栏移入） */
.brand--panel {
  margin: 0 0 10px;
  padding: 12px 10px 14px;
  border-bottom: 1px dashed #dbe6f1;
}
.brand--panel .mark {
  width: 38px; height: 38px;
  background: #eef4fb;
  border: 1px solid #d7e4f1;
  color: #3b7fb0;
  font-size: 21px;
}
.brand--panel h1 {
  font-size: 17px;
  color: #12263a;
  letter-spacing: .02em;
}
.brand--panel p { color: #6b8298; font-size: 11px; }
.brand--panel .brand-site { color: #8aa0b5; margin-left: 8px; font-size: 12px; }
.caret { font-size: 10px; opacity: .65; margin-left: 2px; }
.stage-actions { margin-left: 12px; }
.btn.small { padding: 6px 10px; font-size: 11.5px; }

/* 视图区标题栏：不换行、间距紧凑 */
.stage-head > div:first-child { min-width: 0; flex: 0 0 auto; }
.stage-head #drawingTitle { white-space: nowrap; }
.stage-view-options { flex: 0 0 auto; }
.stage-actions { margin-left: 6px; flex-wrap: nowrap; }

/* 视图区标题栏空间紧张：隐藏副标题行，保证主标题与按钮同排 */
.stage-head #drawingSub { display: none; }
.stage-head h2 { font-size: 15.5px; max-width: none; }
.stage-view-options { gap: 8px; }
.stage-view-options .switch { font-size: 11px; }
.stage-head { gap: 10px; }

/* 视图区标题栏：紧凑排布，保证 3D/2D 下按钮都不被裁切 */
.stage-head { padding: 10px 16px 9px; gap: 8px; }
.stage-head h2 { font-size: 14.5px; }
.stage-view-options { gap: 6px; }
.stage-view-options .switch { font-size: 10.5px; gap: 4px; }
.stage-view-options .btn { padding: 4px 8px; font-size: 10.5px; }
.view-tab { padding: 5px 9px; font-size: 11.5px; }
.stage-actions { gap: 6px; margin-left: 2px; }
.stage-actions .btn { padding: 5px 9px; font-size: 11px; }

/* 操作提示移到视图底栏（仅 3D 视图显示） */
.foot-hint {
  font-size: 10.8px;
  color: #8b98a6;
  white-space: nowrap;
  margin-left: 0;
  margin-right: auto;      /* 提示靠左，状态靠右 */
  display: none;
}
body.view-3d .foot-hint { display: inline-block; }
.stage-foot { align-items: center; }
/* ===== 与站点顶栏（navbar-fixed-top）对齐：避免遮住侧边栏/视图区 ===== */
body { padding-top: 52px !important; }
.app { height: calc(100vh - 52px) !important; }
@media (max-width: 767px) {
  body { padding-top: 50px !important; }
  .app { height: auto !important; min-height: calc(100vh - 50px) !important; }
}
/* 站点 navbar 在本页的最小修补：确保容器背景与高度一致 */
.wpkt-header { background: #fff; }
/* ===== 顶栏对齐站点（删除旧假顶栏后必需）===== */
.wpkt-header { background: #fff; }
.wpkt-header .navbar-brand1 img { width: 52px; height: auto; border-radius: 20%; }
.wpkt-header .nav > li > a[href*="/forum/"] { color: #2563eb; }
.wpkt-header .nav > li > a[href*="/forum/"]:hover,
.wpkt-header .nav > li > a[href*="/forum/"]:focus { color: #1d4ed8; }
/* 固定顶栏留高度（保持与顶栏实际高度一致；如仍差几像素，只改这里一个数字） */
body { padding-top: 52px !important; }
.app { height: calc(100vh - 52px) !important; }
@media (max-width: 767px) {
  body { padding-top: 50px !important; }
  .app { height: auto !important; min-height: calc(100vh - 50px) !important; }
}