/* CAD 工艺工具 全局样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #1a1a1e; --panel: #232328; --line: #3a3a42;
  --ink: #e2e4e8; --muted: #8a919e; --accent: #3b82f6;
  --accent-soft: #1e2a42;
}
html, body { height: 100%; }
body {
  font: 13px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--bg); overflow: hidden;
}

#topbar {
  height: 46px; display: flex; align-items: center; gap: 16px;
  padding: 0 14px; background: #1f2430; color: #fff;
}
.brand { font-weight: 700; font-size: 14px; letter-spacing: .5px; }
#tool-tabs { display: flex; gap: 6px; }
#tool-tabs .tab {
  border: none; background: transparent; color: #b9c0cc; cursor: pointer;
  padding: 7px 14px; border-radius: 6px; font-size: 13px;
}
#tool-tabs .tab:hover { background: rgba(255,255,255,.08); color: #fff; }
#tool-tabs .tab.active { background: var(--accent); color: #fff; }
#current-drawing {
  margin-left: auto; color: #b9c0cc; font-size: 12px;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

#layout {
  display: grid; height: calc(100vh - 46px);
  grid-template-columns: 230px 1fr 330px;
}
#left-panel, #right-panel {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
#right-panel { border-right: none; border-left: 1px solid var(--line); }

.panel-block { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.panel-block.grow { flex: 1; overflow-y: auto; border-bottom: none; min-height: 0; }
.panel-block h3 {
  font-size: 12px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.mini {
  border: 1px solid var(--line); background: var(--panel); border-radius: 4px;
  font-size: 11px; padding: 1px 8px; color: var(--muted); cursor: pointer;
}
.mini:hover { color: var(--accent); border-color: var(--accent); }

.file-list { overflow-y: auto; max-height: 220px; }
.file-group { font-size: 11px; color: var(--muted); margin: 8px 0 2px; }
.file-item {
  padding: 4px 8px; border-radius: 4px; cursor: pointer; color: #c8ccd4;
  display: flex; justify-content: space-between; gap: 4px;
}
.file-item:hover { background: var(--accent-soft); }
.file-item.active { background: var(--accent); color: #fff; }
.file-item .size { color: var(--muted); font-size: 10px; flex: none; }
.file-item.active .size { color: #cfe0fb; }

#layer-list { overflow-y: auto; max-height: 260px; }
.layer-item { display: flex; align-items: center; gap: 6px; padding: 3px 2px; }
.layer-item label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.kind-tag {
  font-size: 10px; padding: 0 5px; border-radius: 3px; flex: none;
  background: #2e2e35; color: #8a919e;
}
.kind-tag.k-dim { background: #3d2e1a; color: #f59e0b; }
.kind-tag.k-aux { background: #3d1a1a; color: #f87171; }
.kind-tag.k-body { background: #1a3d20; color: #4ade80; }
.kind-tag.k-frame { background: #1e1e3d; color: #a78bfa; }
.kind-tag.k-text { background: #1a2e3d; color: #60a5fa; }

#canvas-wrap { position: relative; min-width: 0; min-height: 0; background: #000000; }
#cad { display: block; position: absolute; inset: 0; }
#toolbar {
  position: absolute; top: 10px; left: 10px; display: flex; gap: 6px;
  align-items: center; background: #2a2a30; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
#toolbar button {
  border: 1px solid var(--line); background: #2a2a30; border-radius: 5px;
  padding: 2px 10px; cursor: pointer; font-size: 12px; color: var(--ink);
}
#toolbar button:hover { border-color: var(--accent); color: var(--accent); }
#toolbar .sep { width: 1px; height: 16px; background: var(--line); }
#toolbar .hint { color: var(--muted); font-size: 11px; }
#mode-hint { max-width: 340px; }

.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: rgba(0,0,0,.7); font-size: 13px; color: var(--muted);
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

#toast {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 8px 18px; border-radius: 6px;
  font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  transition: opacity .25s; opacity: 1; max-width: 80%;
}
#toast.fade { opacity: 0; }

.tool-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.tool-desc {
  padding: 10px 12px; font-size: 12px; color: #9ca3af;
  background: #1e1e22; border-bottom: 1px solid var(--line); line-height: 1.6;
}
.btn-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.btn-row.wrap { flex-wrap: wrap; }
button.primary {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 6px 14px; cursor: pointer; font-size: 12px;
}
button.primary:hover { background: #1d4fd7; }
button.primary:disabled { background: #2a4070; color: #6b7280; cursor: not-allowed; }
button.ghost {
  background: var(--panel); color: #9ca3af; border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 14px; cursor: pointer; font-size: 12px;
}
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
.chk { display: flex; gap: 5px; align-items: center; font-size: 12px; color: #9ca3af; cursor: pointer; }

.count-badge {
  background: var(--accent-soft); color: var(--accent); border-radius: 8px;
  font-size: 10px; padding: 1px 7px;
}

.dim-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.dim-row {
  display: grid; grid-template-columns: 20px 1fr auto 22px; gap: 6px;
  align-items: center; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: #2a2a30;
}
.dim-row.locate { cursor: pointer; }
.dim-row .no { color: var(--muted); font-size: 11px; }
.dim-row input {
  border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px;
  font-size: 13px; width: 100%; color: var(--ink); background: #1e1e22;
}
.dim-row input:focus { outline: none; border-color: var(--accent); }
.dim-row .layer { color: var(--muted); font-size: 10px; max-width: 90px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dim-row .del {
  border: none; background: none; color: #c2c8d1; cursor: pointer; font-size: 14px;
}
.dim-row .del:hover { color: #dc2626; }

/* 工具2 */
.step-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px;
  background: #2a2a30;
}
.step-item.active { border-color: var(--accent); background: var(--accent-soft); }
.step-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; cursor: pointer; }
.step-item input.step-name {
  flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 4px;
  padding: 2px 6px; font-size: 12px; background: transparent; color: var(--ink);
}
.step-item input.step-name:hover, .step-item input.step-name:focus {
  border-color: var(--line); background: #1e1e22; outline: none;
}
.step-item .cnt { color: var(--muted); font-size: 11px; flex: none; }
.step-item .ops { display: flex; gap: 2px; flex: none; }
.step-item .ops button {
  border: none; background: none; cursor: pointer; color: #9aa1ad;
  font-size: 12px; padding: 1px 3px; border-radius: 3px;
}
.step-item .ops button:hover { color: var(--accent); background: #1e2a42; }
.step-item .ops button.danger:hover { color: #f87171; background: #3d1a1a; }

.gallery { display: flex; flex-direction: column; gap: 14px; }
.gallery-step h4 { font-size: 12px; color: #c8ccd4; margin-bottom: 6px; }
.gallery-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shot { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #2a2a30; }
.shot img { width: 100%; display: block; }
.shot .cap {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 8px; font-size: 10px; color: var(--muted); border-top: 1px solid var(--line);
}
.shot .cap a { color: var(--accent); text-decoration: none; cursor: pointer; }

.muted { color: var(--muted); }
.small { font-size: 11px; }
.empty-tip { padding: 8px 4px; }
