.lcad-shell {
  display: grid;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  grid-template-columns: var(--toolbar-w) minmax(0, 1fr) var(--sidebar-w);
  grid-template-rows: var(--header-h) minmax(0, 1fr) var(--cmd-h) var(
      --status-h
    );
  grid-template-areas: 'header header header' 'toolbar canvas sidebar' 'toolbar cmdline sidebar' 'status status status';
}
.lcad-shell.sidebar-collapsed {
  grid-template-columns: var(--toolbar-w) minmax(0, 1fr) 0;
}
.sidebar-collapsed .lcad-sidebar {
  display: none;
}
.lcad-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: #131822;
  border-bottom: 1px solid var(--border-color);
  min-width: 0;
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand-logo {
  font-weight: 750;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 19px;
  letter-spacing: -0.6px;
}
.brand-logo b {
  color: #38bdf8;
  font-size: 12px;
}
.brand-title {
  font-size: 11px;
  color: #94a3b8;
}
.brand-title small {
  display: block;
}
.header-toolbar {
  display: flex;
  gap: 5px;
  overflow: auto;
  min-width: 0;
}
.lcad-toolbar {
  grid-area: toolbar;
  background: #10151e;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 7px 5px;
  gap: 3px;
  overflow: auto;
}
.tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 40px;
  padding: 4px 2px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 5px;
  color: #94a3b8;
  font-size: 9px;
  flex-shrink: 0;
}
.tool-item .tool-icon {
  font-size: 17px;
  font-family: var(--font-mono);
  color: #cbd5e1;
}
.tool-item:hover {
  background: #1a2130;
}
.tool-item.active {
  background: var(--accent-soft);
  border-color: #3b82f6;
  color: #93c5fd;
}
.tool-category {
  font: 8px var(--font-mono);
  color: #475569;
  text-align: center;
  margin: 8px 0 3px;
}
.lcad-viewport {
  grid-area: canvas;
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  touch-action: none;
}
#cadCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}
.viewport-overlay-top {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  pointer-events: none;
}
.hud-chip {
  display: flex;
  gap: 10px;
  padding: 4px 8px;
  background: #131822cf;
  border: 1px solid #263044;
  border-radius: 4px;
  font: 10px var(--font-mono);
  color: #64748b;
}
.hud-chip strong {
  color: #cbd5e1;
}
.notice {
  position: absolute;
  top: 48px;
  left: 14px;
  background: #6b451ceb;
  border: 1px solid #c08434;
  color: #fde68a;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 12px;
  max-width: 90%;
}
.notice .btn {
  margin-left: 10px;
}
.import-progress {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: #0b0e14e8;
}
.lcad-sidebar {
  grid-area: sidebar;
  position: relative;
  overflow-y: auto;
  background: #131822;
  border-left: 1px solid var(--border-color);
  min-width: 0;
  z-index: 30;
}
.sidebar-resize {
  position: fixed;
  top: 54px;
  bottom: 32px;
  width: 6px;
  cursor: col-resize;
  z-index: 35;
  touch-action: none;
}
.sidebar-section {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-color);
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 9px;
}
.section-header span {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
}
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 270px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.layer-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  background: #0d1119;
  padding: 5px;
  border-radius: 4px;
}
.layer-row.active {
  border-color: #3b82f6;
  background: #3b82f612;
}
.layer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: none;
  text-align: left;
  font: 11px var(--font-mono);
}
.layer-control {
  border: none;
  background: none;
  color: #94a3b8;
  min-width: 22px;
  padding: 3px;
  font-size: 12px;
}
.layer-control.off {
  opacity: 0.35;
}
.layer-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 2px;
}
.import-report {
  padding: 9px;
  background: #3b82f60e;
  border: 1px solid #3b82f63a;
  color: #94a3b8;
  font-size: 11px;
  margin-top: 10px;
  white-space: pre-line;
  max-height: 160px;
  overflow: auto;
}
.lcad-cmdline {
  grid-area: cmdline;
  background: #10151e;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  min-width: 0;
  font: 11px var(--font-mono);
}
.cmd-history {
  height: 53px;
  overflow: auto;
  padding: 4px 12px;
  color: #94a3b8;
  user-select: text;
  line-height: 16px;
}
.cmd-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border-top: 1px solid #26304466;
  padding: 0 12px;
  min-width: 0;
}
.cmd-label {
  color: #60a5fa;
  font-size: 10px;
}
.cmd-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  max-width: 350px;
  min-width: 90px;
}
#commandPrompt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
  flex: 2;
}
.lcad-status {
  grid-area: status;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-top: 1px solid var(--border-color);
  background: #0a0d12;
  font: 10px var(--font-mono);
  color: #94a3b8;
  overflow: hidden;
}
.status-group {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.status-pill {
  font: 9px var(--font-mono);
  padding: 3px 5px;
  border: 1px solid #263044;
  background: #131822;
  color: #64748b;
  border-radius: 3px;
  white-space: nowrap;
}
.status-pill.on {
  border-color: #0f7656;
  color: #34d399;
  background: #10b98112;
}
.dynamic-input {
  position: absolute;
  pointer-events: auto;
  z-index: 15;
  width: 150px;
}
.dynamic-input input {
  width: 100%;
  font: 11px var(--font-mono);
  padding: 4px 7px;
  background: #131822e8;
  border-color: #3b82f655;
}
.field-mode 