* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0d1117;
  color: #c9d1d9;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
}

#toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.tool-btn {
  padding: 4px 9px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}
.tool-btn:hover { background: #30363d; }
.tool-btn.active { background: #1f6feb; border-color: #388bfd; color: #fff; }
.tool-btn.primary { background: #238636; border-color: #2ea043; color: #fff; }
.tool-btn.primary:hover { background: #2ea043; }

.sep { width: 1px; height: 20px; background: #30363d; flex-shrink: 0; }

#logo { color: #58a6ff; font-weight: bold; font-size: 13px; margin-right: 4px; }
#layout-name-input {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 3px;
  color: #c9d1d9;
  padding: 3px 8px;
  font-size: 11px;
  width: 140px;
}
#layout-name-input:focus { outline: none; border-color: #58a6ff; }

#workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}

#sidebar {
  width: 185px;
  min-width: 185px;
  background: #161b22;
  border-right: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-section {
  border-bottom: 1px solid #21262d;
  padding: 8px;
}
.sidebar-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  color: #58a6ff;
  letter-spacing: 1px;
  margin-bottom: 7px;
}

.prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  gap: 4px;
}
.prop-row label { color: #8b949e; font-size: 11px; }
.prop-row input[type=text], .prop-row input[type=number] {
  width: 78px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 3px;
  color: #c9d1d9;
  padding: 2px 5px;
  font-size: 11px;
}
.prop-row input:focus { outline: none; border-color: #58a6ff; }
.prop-row input[type=color] { width: 36px; height: 22px; border: 1px solid #30363d; border-radius: 3px; cursor: pointer; background: none; padding: 0; }

.sidebar-select {
  width: 100%;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 3px;
  color: #c9d1d9;
  padding: 3px 5px;
  font-size: 11px;
  margin-bottom: 5px;
  cursor: pointer;
}

.sidebar-btn {
  width: 100%;
  padding: 5px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 3px;
  color: #c9d1d9;
  cursor: pointer;
  font-size: 11px;
  margin-bottom: 4px;
  text-align: left;
}
.sidebar-btn:hover { background: #30363d; }

.stat-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.stat-row span:first-child { color: #8b949e; }
.stat-row span:last-child { color: #c9d1d9; }

#main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#view-tabs {
  display: flex;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 0 8px;
  flex-shrink: 0;
}
.view-tab {
  padding: 6px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 11px;
  color: #8b949e;
}
.view-tab.active { color: #58a6ff; border-bottom-color: #58a6ff; }
.view-tab:hover:not(.active) { color: #c9d1d9; }

#canvas-area {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

#layout-view, #pcb-view {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0d1117;
}
#pcb-view { display: none; }

#view-3d {
  width: 38%;
  min-width: 180px;
  border-left: 1px solid #30363d;
  background: #0a0f1a;
  position: relative;
  overflow: hidden;
}
#view-3d canvas { display: block; }
#view-3d-label {
  position: absolute;
  top: 6px; left: 10px;
  font-size: 10px;
  color: #30363d;
  pointer-events: none;
}
#view-3d-status {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8b949e;
  font-size: 12px;
  gap: 10px;
  z-index: 1;
}
.retry-3d-btn {
  padding: 5px 14px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  cursor: pointer;
  font-size: 11px;
}
.retry-3d-btn:hover { background: #30363d; }

#status-bar {
  padding: 3px 12px;
  background: #161b22;
  border-top: 1px solid #30363d;
  font-size: 10px;
  color: #8b949e;
  display: flex;
  gap: 18px;
  flex-shrink: 0;
}
#status-bar span { white-space: nowrap; }

#no-sel-msg { color: #444d56; font-size: 11px; text-align: center; padding: 8px 0; }
